From 08a59f7fef61faea8bf3a00ea1bdda10ad69eead Mon Sep 17 00:00:00 2001 From: PavelSindler Date: Thu, 6 Apr 2017 18:57:11 +0200 Subject: [PATCH] status messages for temp calibration added, initial versoin of temp calibration on/off from menu --- Firmware/Marlin.h | 1 + Firmware/Marlin_main.cpp | 52 +++++++++++++------ Firmware/language_all.cpp | 29 ++++++++++- Firmware/language_all.h | 10 ++++ Firmware/language_en.h | 11 ++-- Firmware/ultralcd.cpp | 24 ++++++++- Firmware/ultralcd.h | 4 +- .../ultralcd_implementation_hitachi_HD44780.h | 16 ++++++ 8 files changed, 122 insertions(+), 25 deletions(-) diff --git a/Firmware/Marlin.h b/Firmware/Marlin.h index c9a20ac8d..82e40a9ee 100644 --- a/Firmware/Marlin.h +++ b/Firmware/Marlin.h @@ -284,6 +284,7 @@ extern unsigned long starttime; extern unsigned long stoptime; extern bool is_usb_printing; extern bool homing_flag; +extern bool temp_cal_active; extern bool loading_flag; extern unsigned int usb_printing_counter; diff --git a/Firmware/Marlin_main.cpp b/Firmware/Marlin_main.cpp index d10450c7f..4abe0ba17 100644 --- a/Firmware/Marlin_main.cpp +++ b/Firmware/Marlin_main.cpp @@ -250,6 +250,8 @@ int extruder_multiply[EXTRUDERS] = {100 bool is_usb_printing = false; bool homing_flag = false; +bool temp_cal_active = false; + unsigned long kicktime = millis()+100000; unsigned int usb_printing_counter; @@ -2750,18 +2752,6 @@ void process_commands() } break; - /** - * G80: Mesh-based Z probe, probes a grid and produces a - * mesh to compensate for variable bed height - * - * The S0 report the points as below - * - * +----> X-axis - * | - * | - * v Y-axis - * - */ case 76: //PINDA probe temperature calibration { @@ -2777,7 +2767,11 @@ void process_commands() repeatcommand_front(); // repeat G76 with all its parameters enquecommand_front_P((PSTR("G28 W0"))); break; - } + } + custom_message = true; + custom_message_type = 4; + custom_message_state = 1; + custom_message = MSG_TEMP_CALIBRATION; current_position[X_AXIS] = PINDA_PREHEAT_X; current_position[Y_AXIS] = PINDA_PREHEAT_Y; current_position[Z_AXIS] = 0; @@ -2807,7 +2801,7 @@ void process_commands() SERIAL_ECHOLNPGM(""); for (int i = 0; i<5; i++) { - + custom_message_state = i + 2; t_c = 60 + i * 10; setTargetBed(t_c); @@ -2838,7 +2832,14 @@ void process_commands() } + custom_message_type = 0; + custom_message = false; + calibration_status_store(CALIBRATION_STATUS_CALIBRATED); + lcd_show_fullscreen_message_and_wait_P(MSG_TEMP_CALIBRATION_DONE); + lcd_update_enable(true); + lcd_update(2); + setTargetBed(0); //set bed target temperature back to 0 } @@ -2874,6 +2875,18 @@ void process_commands() #endif + /** + * G80: Mesh-based Z probe, probes a grid and produces a + * mesh to compensate for variable bed height + * + * The S0 report the points as below + * + * +----> X-axis + * | + * | + * v Y-axis + * + */ case 80: case_G80: @@ -2896,7 +2909,7 @@ void process_commands() break; } - if (run == false && card.sdprinting == true) { + if (run == false && card.sdprinting == true && temp_cal_active == true) { temp_compensation_start(); run = true; repeatcommand_front(); // repeat G80 with all its parameters @@ -3043,7 +3056,7 @@ void process_commands() } clean_up_after_endstop_move(); SERIAL_ECHOLNPGM("clean up finished "); - temp_compensation_apply(); //apply PINDA temperature compensation + if(temp_cal_active == true) temp_compensation_apply(); //apply PINDA temperature compensation babystep_apply(); // Apply Z height correction aka baby stepping before mesh bed leveing gets activated. SERIAL_ECHOLNPGM("babystep applied"); bool eeprom_bed_correction_valid = eeprom_read_byte((unsigned char*)EEPROM_BED_CORRECTION_VALID) == 1; @@ -3109,7 +3122,7 @@ void process_commands() go_home_with_z_lift(); SERIAL_ECHOLNPGM("Go home finished"); //unretract (after PINDA preheat retraction) - if (card.sdprinting == true && degHotend(active_extruder) > EXTRUDE_MINTEMP) { + if (card.sdprinting == true && degHotend(active_extruder) > EXTRUDE_MINTEMP && temp_cal_active == true) { current_position[E_AXIS] += DEFAULT_RETRACTION; plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS], 400, active_extruder); } @@ -6213,6 +6226,8 @@ void bed_analysis(float x_dimension, float y_dimension, int x_points_num, int y_ #endif void temp_compensation_start() { + custom_message = true; + custom_message_type = 5; if (degHotend(active_extruder)>EXTRUDE_MINTEMP) current_position[E_AXIS] -= DEFAULT_RETRACTION; plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS], 400, active_extruder); @@ -6225,6 +6240,9 @@ void temp_compensation_start() { while (fabs(degBed() - target_temperature_bed) > 3) delay_keep_alive(1000); for(int i = 0; i < PINDA_HEAT_T; i++) delay_keep_alive(1000); + + custom_message_type = 0; + custom_message = false; } void temp_compensation_apply() { diff --git a/Firmware/language_all.cpp b/Firmware/language_all.cpp index eddaa8ef2..a9a79a78d 100644 --- a/Firmware/language_all.cpp +++ b/Firmware/language_all.cpp @@ -494,11 +494,16 @@ const char * const MSG_CALIBRATE_E_LANG_TABLE[LANG_NUM] PROGMEM = { MSG_CALIBRATE_E_DE }; -const char MSG_CALIBRATE_PINDA_EN[] PROGMEM = "Calibrate PINDA"; +const char MSG_CALIBRATE_PINDA_EN[] PROGMEM = "Temp. calibration"; const char * const MSG_CALIBRATE_PINDA_LANG_TABLE[1] PROGMEM = { MSG_CALIBRATE_PINDA_EN }; +const char MSG_CALIBRATION_PINDA_MENU_EN[] PROGMEM = "Temp. calibration"; +const char * const MSG_CALIBRATION_PINDA_MENU_LANG_TABLE[1] PROGMEM = { + MSG_CALIBRATION_PINDA_MENU_EN +}; + const char MSG_CARD_MENU_EN[] PROGMEM = "Print from SD"; const char MSG_CARD_MENU_CZ[] PROGMEM = "Tisk z SD"; const char MSG_CARD_MENU_IT[] PROGMEM = "Stampa da SD"; @@ -1736,7 +1741,7 @@ const char * const MSG_PICK_Z_LANG_TABLE[LANG_NUM] PROGMEM = { MSG_PICK_Z_DE }; -const char MSG_PINDA_NOT_CALIBRATED_EN[] PROGMEM = "PINDA probe has not been calibrated"; +const char MSG_PINDA_NOT_CALIBRATED_EN[] PROGMEM = "Temperature calibration has not been run yet"; const char * const MSG_PINDA_NOT_CALIBRATED_LANG_TABLE[1] PROGMEM = { MSG_PINDA_NOT_CALIBRATED_EN }; @@ -2693,6 +2698,26 @@ const char * const MSG_TEMPERATURE_LANG_TABLE[LANG_NUM] PROGMEM = { MSG_TEMPERATURE_DE }; +const char MSG_TEMP_CALIBRATION_EN[] PROGMEM = "Temp. calibration "; +const char * const MSG_TEMP_CALIBRATION_LANG_TABLE[1] PROGMEM = { + MSG_TEMP_CALIBRATION_EN +}; + +const char MSG_TEMP_CALIBRATION_DONE_EN[] PROGMEM = "Temperature calibration is finished. Click to continue."; +const char * const MSG_TEMP_CALIBRATION_DONE_LANG_TABLE[1] PROGMEM = { + MSG_TEMP_CALIBRATION_DONE_EN +}; + +const char MSG_TEMP_CALIBRATION_OFF_EN[] PROGMEM = "Temp. cal. [OFF]"; +const char * const MSG_TEMP_CALIBRATION_OFF_LANG_TABLE[1] PROGMEM = { + MSG_TEMP_CALIBRATION_OFF_EN +}; + +const char MSG_TEMP_CALIBRATION_ON_EN[] PROGMEM = "Temp. cal. [ON]"; +const char * const MSG_TEMP_CALIBRATION_ON_LANG_TABLE[1] PROGMEM = { + MSG_TEMP_CALIBRATION_ON_EN +}; + const char MSG_TOSHIBA_FLASH_AIR_COMPATIBILITY_OFF_EN[] PROGMEM = "SD card [normal]"; const char MSG_TOSHIBA_FLASH_AIR_COMPATIBILITY_OFF_PL[] PROGMEM = "karta SD [normal]"; const char * const MSG_TOSHIBA_FLASH_AIR_COMPATIBILITY_OFF_LANG_TABLE[LANG_NUM] PROGMEM = { diff --git a/Firmware/language_all.h b/Firmware/language_all.h index a49d098e1..49211d762 100644 --- a/Firmware/language_all.h +++ b/Firmware/language_all.h @@ -109,6 +109,8 @@ extern const char* const MSG_CALIBRATE_E_LANG_TABLE[LANG_NUM]; #define MSG_CALIBRATE_E LANG_TABLE_SELECT(MSG_CALIBRATE_E_LANG_TABLE) extern const char* const MSG_CALIBRATE_PINDA_LANG_TABLE[1]; #define MSG_CALIBRATE_PINDA LANG_TABLE_SELECT_EXPLICIT(MSG_CALIBRATE_PINDA_LANG_TABLE, 0) +extern const char* const MSG_CALIBRATION_PINDA_MENU_LANG_TABLE[1]; +#define MSG_CALIBRATION_PINDA_MENU LANG_TABLE_SELECT_EXPLICIT(MSG_CALIBRATION_PINDA_MENU_LANG_TABLE, 0) extern const char* const MSG_CARD_MENU_LANG_TABLE[LANG_NUM]; #define MSG_CARD_MENU LANG_TABLE_SELECT(MSG_CARD_MENU_LANG_TABLE) extern const char* const MSG_CHANGE_EXTR_LANG_TABLE[LANG_NUM]; @@ -521,6 +523,14 @@ extern const char* const MSG_TAKE_EFFECT_LANG_TABLE[LANG_NUM]; #define MSG_TAKE_EFFECT LANG_TABLE_SELECT(MSG_TAKE_EFFECT_LANG_TABLE) extern const char* const MSG_TEMPERATURE_LANG_TABLE[LANG_NUM]; #define MSG_TEMPERATURE LANG_TABLE_SELECT(MSG_TEMPERATURE_LANG_TABLE) +extern const char* const MSG_TEMP_CALIBRATION_LANG_TABLE[1]; +#define MSG_TEMP_CALIBRATION LANG_TABLE_SELECT_EXPLICIT(MSG_TEMP_CALIBRATION_LANG_TABLE, 0) +extern const char* const MSG_TEMP_CALIBRATION_DONE_LANG_TABLE[1]; +#define MSG_TEMP_CALIBRATION_DONE LANG_TABLE_SELECT_EXPLICIT(MSG_TEMP_CALIBRATION_DONE_LANG_TABLE, 0) +extern const char* const MSG_TEMP_CALIBRATION_OFF_LANG_TABLE[1]; +#define MSG_TEMP_CALIBRATION_OFF LANG_TABLE_SELECT_EXPLICIT(MSG_TEMP_CALIBRATION_OFF_LANG_TABLE, 0) +extern const char* const MSG_TEMP_CALIBRATION_ON_LANG_TABLE[1]; +#define MSG_TEMP_CALIBRATION_ON LANG_TABLE_SELECT_EXPLICIT(MSG_TEMP_CALIBRATION_ON_LANG_TABLE, 0) extern const char* const MSG_TOSHIBA_FLASH_AIR_COMPATIBILITY_OFF_LANG_TABLE[LANG_NUM]; #define MSG_TOSHIBA_FLASH_AIR_COMPATIBILITY_OFF LANG_TABLE_SELECT(MSG_TOSHIBA_FLASH_AIR_COMPATIBILITY_OFF_LANG_TABLE) extern const char* const MSG_TOSHIBA_FLASH_AIR_COMPATIBILITY_ON_LANG_TABLE[LANG_NUM]; diff --git a/Firmware/language_en.h b/Firmware/language_en.h index 3793f8b70..920ea7860 100644 --- a/Firmware/language_en.h +++ b/Firmware/language_en.h @@ -266,6 +266,11 @@ #define MSG_TOSHIBA_FLASH_AIR_COMPATIBILITY_OFF "SD card [normal]" #define MSG_TOSHIBA_FLASH_AIR_COMPATIBILITY_ON "SD card [FlshAir]" -#define MSG_CALIBRATE_PINDA "Calibrate PINDA" -#define MSG_PINDA_NOT_CALIBRATED "PINDA probe has not been calibrated" -#define MSG_PINDA_PREHEAT "Preheating" \ No newline at end of file +#define MSG_CALIBRATE_PINDA "Temp. calibration" +#define MSG_CALIBRATION_PINDA_MENU "Temp. calibration" +#define MSG_PINDA_NOT_CALIBRATED "Temperature calibration has not been run yet" +#define MSG_PINDA_PREHEAT "Preheating" +#define MSG_TEMP_CALIBRATION "Temp. calibration " +#define MSG_TEMP_CALIBRATION_DONE "Temperature calibration is finished. Click to continue." +#define MSG_TEMP_CALIBRATION_ON "Temp. cal. [ON]" +#define MSG_TEMP_CALIBRATION_OFF "Temp. cal. [OFF]" \ No newline at end of file diff --git a/Firmware/ultralcd.cpp b/Firmware/ultralcd.cpp index 16f4813fe..593e82c2a 100644 --- a/Firmware/ultralcd.cpp +++ b/Firmware/ultralcd.cpp @@ -2228,8 +2228,28 @@ void lcd_mesh_calibration_z() lcd_return_to_status(); } -void lcd_pinda_calibration() +void lcd_pinda_calibration_menu() { + START_MENU(); + MENU_ITEM(back, MSG_MENU_CALIBRATION, lcd_calibration_menu); + MENU_ITEM(submenu, MSG_CALIBRATE_PINDA, lcd_calibrate_pinda); + //MENU_ITEM(back, MSG_SETTINGS, lcd_settings_menu); + if (temp_cal_active == false) { + MENU_ITEM(function, MSG_TEMP_CALIBRATION_OFF, lcd_temp_calibration_set); + } + else { + MENU_ITEM(function, MSG_TEMP_CALIBRATION_ON, lcd_temp_calibration_set); + } + END_MENU(); +} + +void lcd_temp_calibration_set() { + temp_cal_active = !temp_cal_active; + digipot_init(); + lcd_goto_menu(lcd_pinda_calibration_menu, 2); +} + +void lcd_calibrate_pinda() { enquecommand_P(PSTR("G76")); lcd_return_to_status(); } @@ -2396,7 +2416,7 @@ static void lcd_calibration_menu() MENU_ITEM(function, MSG_CALIBRATE_BED, lcd_mesh_calibration); // "Calibrate Z" with storing the reference values to EEPROM. MENU_ITEM(submenu, MSG_HOMEYZ, lcd_mesh_calibration_z); - MENU_ITEM(submenu, MSG_CALIBRATE_PINDA, lcd_pinda_calibration); + MENU_ITEM(submenu, MSG_CALIBRATION_PINDA_MENU, lcd_pinda_calibration_menu); #ifndef SNMM //MENU_ITEM(function, MSG_CALIBRATE_E, lcd_calibrate_extruder); #endif diff --git a/Firmware/ultralcd.h b/Firmware/ultralcd.h index 658767cd8..1e234946b 100644 --- a/Firmware/ultralcd.h +++ b/Firmware/ultralcd.h @@ -232,5 +232,7 @@ union MenuData; char reset_menu(); -void lcd_pinda_calibration(); +void lcd_pinda_calibration_menu(); +void lcd_calibrate_pinda(); +void lcd_temp_calibration_set(); #endif //ULTRALCD_H \ No newline at end of file diff --git a/Firmware/ultralcd_implementation_hitachi_HD44780.h b/Firmware/ultralcd_implementation_hitachi_HD44780.h index 66bfc9e9e..e34f08cb5 100644 --- a/Firmware/ultralcd_implementation_hitachi_HD44780.h +++ b/Firmware/ultralcd_implementation_hitachi_HD44780.h @@ -944,6 +944,22 @@ static void lcd_implementation_status_screen() { lcd.print(lcd_status_message); } + // PINDA temp calibration in progress + if (custom_message_type == 4) { + char progress[4]; + lcd.setCursor(0, 3); + lcd_printPGM(MSG_TEMP_CALIBRATION); + lcd.setCursor(17, 3); + sprintf(progress, "%d/6", custom_message_state); + lcd.print(progress); + } + // temp compensation preheat + if (custom_message_type == 5) { + lcd.setCursor(0, 3); + lcd_printPGM(MSG_PINDA_PREHEAT); + } + + } else {