Merge pull request #472 from XPila/MK25

Mk25
This commit is contained in:
PavelSindler 2018-02-12 09:40:51 +01:00 committed by GitHub
commit 6fb7f22555
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 48 additions and 6 deletions

View File

@ -397,9 +397,18 @@ const char* dcode_9_ADC_name(uint8_t i)
extern int current_temperature_raw[EXTRUDERS];
extern int current_temperature_bed_raw;
extern int current_temperature_raw_pinda;
#ifdef AMBIENT_THERMISTOR
extern int current_temperature_raw_ambient;
#endif //AMBIENT_THERMISTOR
#ifdef VOLT_PWR_PIN
extern int current_voltage_raw_pwr;
#endif //VOLT_PWR_PIN
#ifdef VOLT_BED_PIN
extern int current_voltage_raw_bed;
#endif //VOLT_BED_PIN
uint16_t dcode_9_ADC_val(uint8_t i)
{
@ -411,11 +420,13 @@ uint16_t dcode_9_ADC_val(uint8_t i)
case 3: return current_temperature_raw_pinda;
#ifdef VOLT_PWR_PIN
case 4: return current_voltage_raw_pwr;
case 6: return current_voltage_raw_bed;
#endif //VOLT_PWR_PIN
#ifdef AMBIENT_THERMISTOR
case 5: return current_temperature_raw_ambient;
#endif //AMBIENT_THERMISTOR
#ifdef VOLT_BED_PIN
case 6: return current_voltage_raw_bed;
#endif //VOLT_BED_PIN
}
return 0;
}

View File

@ -63,8 +63,6 @@
#define TEMP_PINDA_PIN 3 //A3
#define VOLT_PWR_PIN 4 //A4
#define VOLT_BED_PIN 9 //A9
#define E0_STEP_PIN 34

View File

@ -1554,11 +1554,15 @@ void adc_ready(void) //callback from adc when sampling finished
current_temperature_raw[0] = adc_values[0];
current_temperature_bed_raw = adc_values[2];
current_temperature_raw_pinda = adc_values[3];
#ifdef VOLT_PWR_PIN
current_voltage_raw_pwr = adc_values[4];
#endif
#ifdef AMBIENT_THERMISTOR
current_temperature_raw_ambient = adc_values[5];
#endif //AMBIENT_THERMISTOR
#ifdef VOLT_BED_PIN
current_voltage_raw_bed = adc_values[6];
#endif
temp_meas_ready = true;
}

View File

@ -318,8 +318,8 @@ volatile uint8_t slow_buttons;//Contains the bits of the currently pressed butto
#endif
uint8_t currentMenuViewOffset; /* scroll offset in the current menu */
uint8_t lastEncoderBits;
uint32_t encoderPosition;
uint32_t savedEncoderPosition;
uint16_t encoderPosition;
uint16_t savedEncoderPosition;
#if (SDCARDDETECT > 0)
bool lcd_oldcardstatus;
#endif
@ -1620,6 +1620,7 @@ static void lcd_menu_temperatures()
}
}
#ifdef defined(VOLT_BED_PIN) || defined(VOLT_BED_PIN)
#define VOLT_DIV_R1 10000
#define VOLT_DIV_R2 2370
#define VOLT_DIV_FAC ((float)VOLT_DIV_R2 / (VOLT_DIV_R2 + VOLT_DIV_R1))
@ -1636,7 +1637,9 @@ static void lcd_menu_voltages()
lcd_return_to_status();
}
}
#endif //defined(VOLT_BED_PIN) || defined(VOLT_BED_PIN)
#ifdef TMC2130
static void lcd_menu_belt_status()
{
fprintf_P(lcdout, PSTR(ESC_H(1,0) "Belt status" ESC_H(2,1) "X %d" ESC_H(2,2) "Y %d" ), eeprom_read_word((uint16_t*)(EEPROM_BELTSTATUS_X)), eeprom_read_word((uint16_t*)(EEPROM_BELTSTATUS_Y)));
@ -1646,6 +1649,7 @@ static void lcd_menu_belt_status()
lcd_return_to_status();
}
}
#endif //TMC2130
extern void stop_and_save_print_to_ram(float z_move, float e_move);
extern void restore_print_from_ram_and_continue(float e_move);
@ -1738,12 +1742,16 @@ static void lcd_support_menu()
MENU_ITEM(back, PSTR("------------"), lcd_main_menu);
if (!IS_SD_PRINTING && !is_usb_printing && (lcd_commands_type != LCD_COMMAND_V2_CAL)) MENU_ITEM(function, MSG_XYZ_DETAILS, lcd_service_mode_show_result);
MENU_ITEM(submenu, MSG_INFO_EXTRUDER, lcd_menu_extruder_info);
#ifdef TMC2130
MENU_ITEM(submenu, MSG_MENU_BELT_STATUS, lcd_menu_belt_status);
#endif //TMC2130
MENU_ITEM(submenu, MSG_MENU_TEMPERATURES, lcd_menu_temperatures);
#ifdef defined(VOLT_BED_PIN) || defined(VOLT_BED_PIN)
MENU_ITEM(submenu, MSG_MENU_VOLTAGES, lcd_menu_voltages);
#endif //defined(VOLT_BED_PIN) || defined(VOLT_BED_PIN)
#ifdef DEBUG_BUILD
MENU_ITEM(submenu, PSTR("Debug"), lcd_menu_debug);
@ -6546,11 +6554,32 @@ static void lcd_quick_feedback()
lcd_implementation_quick_feedback();
}
#define ENC_STACK_SIZE 3
static uint8_t enc_stack[ENC_STACK_SIZE]; //encoder is originaly uint16, but for menu
static uint8_t enc_stack_cnt = 0;
static void lcd_push_encoder(void)
{
if (enc_stack_cnt >= ENC_STACK_SIZE) return;
enc_stack[enc_stack_cnt] = encoderPosition;
enc_stack_cnt++;
}
static void lcd_pop_encoder(void)
{
if (enc_stack_cnt == 0) return;
enc_stack_cnt--;
encoderPosition = enc_stack[enc_stack_cnt];
}
/** Menu action functions **/
static void menu_action_back(menuFunc_t data) {
lcd_goto_menu(data);
lcd_pop_encoder();
}
static void menu_action_submenu(menuFunc_t data) {
lcd_push_encoder();
lcd_goto_menu(data);
}
static void menu_action_gcode(const char* pgcode) {