From c36af887b77ec3a4f54f6be1726411148f0c1622 Mon Sep 17 00:00:00 2001 From: PavelSindler Date: Mon, 15 Jan 2018 11:30:28 +0100 Subject: [PATCH] M600 has timeout for nozzle, different procedure for unload --- Firmware/Configuration_prusa.h | 2 +- Firmware/Marlin_main.cpp | 80 ++++++++++++++++++++++++++++++---- Firmware/language_all.cpp | 25 ++++++++++- Firmware/language_all.h | 6 +++ Firmware/language_cz.h | 5 ++- Firmware/language_en.h | 5 ++- Firmware/ultralcd.cpp | 11 +++++ Firmware/ultralcd.h | 1 + 8 files changed, 121 insertions(+), 14 deletions(-) diff --git a/Firmware/Configuration_prusa.h b/Firmware/Configuration_prusa.h index da34a377..4bab0e53 100644 --- a/Firmware/Configuration_prusa.h +++ b/Firmware/Configuration_prusa.h @@ -546,7 +546,7 @@ const bool Z_MIN_ENDSTOP_INVERTING = false; // set to true to invert the logic o #define HEATBED_V2 -#define M600_TIMEOUT 10 //600 //seconds +#define M600_TIMEOUT 600 //seconds //#define SUPPORT_VERBOSITY diff --git a/Firmware/Marlin_main.cpp b/Firmware/Marlin_main.cpp index 63f75ebe..b718b7dd 100644 --- a/Firmware/Marlin_main.cpp +++ b/Firmware/Marlin_main.cpp @@ -5525,12 +5525,14 @@ case 404: //M404 Enter the nominal filament width (3mm, 1.75mm ) N<3.0> or disp KEEPALIVE_STATE(PAUSED_FOR_USER); uint8_t cnt = 0; - int counterBeep = 0; - lcd_display_message_fullscreen_P(MSG_PRESS_TO_UNLOAD); + int counterBeep = 0; + fanSpeed = 0; unsigned long waiting_start_time = millis(); - while (!lcd_clicked() && (millis() < waiting_start_time + M600_TIMEOUT * 1000)){ + uint8_t wait_for_user_state = 0; + lcd_display_message_fullscreen_P(MSG_PRESS_TO_UNLOAD); + while (!(wait_for_user_state == 0 && lcd_clicked())){ - cnt++; + //cnt++; manage_heater(); manage_inactivity(true); @@ -5540,7 +5542,7 @@ case 404: //M404 Enter the nominal filament width (3mm, 1.75mm ) N<3.0> or disp #endif // SNMM*/ - if (cnt == 0) + //if (cnt == 0) { #if BEEPER > 0 if (counterBeep == 500) { @@ -5553,6 +5555,7 @@ case 404: //M404 Enter the nominal filament width (3mm, 1.75mm ) N<3.0> or disp if (counterBeep == 20) { WRITE(BEEPER, LOW); } + counterBeep++; #else #if !defined(LCD_FEEDBACK_FREQUENCY_HZ) || !defined(LCD_FEEDBACK_FREQUENCY_DURATION_MS) @@ -5562,18 +5565,61 @@ case 404: //M404 Enter the nominal filament width (3mm, 1.75mm ) N<3.0> or disp #endif #endif } + + switch (wait_for_user_state) { + case 0: + delay_keep_alive(4); + + if (millis() > waiting_start_time + M600_TIMEOUT * 1000) { + lcd_display_message_fullscreen_P(MSG_PRESS_TO_PREHEAT); + wait_for_user_state = 1; + setTargetHotend(0, 0); + setTargetHotend(0, 1); + setTargetHotend(0, 2); + st_synchronize(); + disable_e0(); + disable_e1(); + disable_e2(); + } + break; + case 1: + delay_keep_alive(4); + + if (lcd_clicked()) { + setTargetHotend(HotendTempBckp, active_extruder); + lcd_wait_for_heater(); + + wait_for_user_state = 2; + } + break; + case 2: + + if (abs(degTargetHotend(active_extruder) - degHotend(active_extruder)) < 1) { + lcd_display_message_fullscreen_P(MSG_PRESS_TO_UNLOAD); + waiting_start_time = millis(); + wait_for_user_state = 0; + } + else { + counterBeep = 20; //beeper will be inactive during waiting for nozzle preheat + lcd.setCursor(1, 4); + lcd.print(ftostr3(degHotend(active_extruder))); + } + break; + + } } WRITE(BEEPER, LOW); lcd_change_fil_state = 0; - while (lcd_change_fil_state == 0) { + + + // Unload filament lcd_display_message_fullscreen_P(MSG_UNLOADING_FILAMENT); KEEPALIVE_STATE(IN_HANDLER); custom_message = true; lcd_setstatuspgm(MSG_UNLOADING_FILAMENT); - // Unload filament if (code_seen('L')) { target[E_AXIS] += code_value(); @@ -5625,16 +5671,31 @@ case 404: //M404 Enter the nominal filament width (3mm, 1.75mm ) N<3.0> or disp //finish moves st_synchronize(); + + lcd_display_message_fullscreen_P(MSG_PULL_OUT_FILAMENT); + //disable extruder steppers so filament can be removed disable_e0(); disable_e1(); disable_e2(); delay(100); + + + WRITE(BEEPER, HIGH); + counterBeep = 0; + while(!lcd_clicked() && (counterBeep < 50)) { + if(counterBeep > 5) WRITE(BEEPER, LOW); + delay_keep_alive(100); + counterBeep++; + } + WRITE(BEEPER, LOW); + KEEPALIVE_STATE(PAUSED_FOR_USER); - lcd_change_fil_state = !lcd_show_fullscreen_message_yes_no_and_wait_P(MSG_UNLOAD_SUCCESSFULL, false, false); + lcd_change_fil_state = lcd_show_fullscreen_message_yes_no_and_wait_P(MSG_UNLOAD_SUCCESSFULL, false, true); + if (lcd_change_fil_state == 0) lcd_show_fullscreen_message_and_wait_P(MSG_CHECK_IDLER); //lcd_return_to_status(); lcd_update_enable(true); - } + //Wait for user to insert filament lcd_wait_interact(); //load_filament_time = millis(); @@ -5766,6 +5827,7 @@ case 404: //M404 Enter the nominal filament width (3mm, 1.75mm ) N<3.0> or disp //Not let's go back to print + fanSpeed = fanSpeedBckp; //Feed a little of filament to stabilize pressure target[E_AXIS]+= FILAMENTCHANGE_RECFEED; diff --git a/Firmware/language_all.cpp b/Firmware/language_all.cpp index f6241bea..81635870 100644 --- a/Firmware/language_all.cpp +++ b/Firmware/language_all.cpp @@ -341,6 +341,13 @@ const char * const MSG_CHANGING_FILAMENT_LANG_TABLE[LANG_NUM] PROGMEM = { MSG_CHANGING_FILAMENT_CZ }; +const char MSG_CHECK_IDLER_EN[] PROGMEM = "Please open idler and remove filament manually."; +const char MSG_CHECK_IDLER_CZ[] PROGMEM = "Prosim otevrete idler a manualne odstrante filament."; +const char * const MSG_CHECK_IDLER_LANG_TABLE[LANG_NUM] PROGMEM = { + MSG_CHECK_IDLER_EN, + MSG_CHECK_IDLER_CZ +}; + const char MSG_CHOOSE_EXTRUDER_EN[] PROGMEM = "Choose extruder:"; const char MSG_CHOOSE_EXTRUDER_CZ[] PROGMEM = "Vyberte extruder:"; const char * const MSG_CHOOSE_EXTRUDER_LANG_TABLE[LANG_NUM] PROGMEM = { @@ -1437,6 +1444,13 @@ const char * const MSG_PRESS_LANG_TABLE[LANG_NUM] PROGMEM = { MSG_PRESS_CZ }; +const char MSG_PRESS_TO_PREHEAT_EN[] PROGMEM = "Press knob to preheat nozzle and continue."; +const char MSG_PRESS_TO_PREHEAT_CZ[] PROGMEM = "Pro nahrati trysky a pokracovani stisknete tlacitko."; +const char * const MSG_PRESS_TO_PREHEAT_LANG_TABLE[LANG_NUM] PROGMEM = { + MSG_PRESS_TO_PREHEAT_EN, + MSG_PRESS_TO_PREHEAT_CZ +}; + const char MSG_PRESS_TO_UNLOAD_EN[] PROGMEM = "Please press the knob to unload filament"; const char MSG_PRESS_TO_UNLOAD_CZ[] PROGMEM = "Pro vysunuti filamentu stisknete prosim tlacitko"; const char * const MSG_PRESS_TO_UNLOAD_LANG_TABLE[LANG_NUM] PROGMEM = { @@ -1484,6 +1498,13 @@ const char * const MSG_PRUSA3D_HOWTO_LANG_TABLE[LANG_NUM] PROGMEM = { MSG_PRUSA3D_HOWTO_CZ }; +const char MSG_PULL_OUT_FILAMENT_EN[] PROGMEM = "Please pull out filament immediately"; +const char MSG_PULL_OUT_FILAMENT_CZ[] PROGMEM = "Prosim vyjmete urychlene filament"; +const char * const MSG_PULL_OUT_FILAMENT_LANG_TABLE[LANG_NUM] PROGMEM = { + MSG_PULL_OUT_FILAMENT_EN, + MSG_PULL_OUT_FILAMENT_CZ +}; + const char MSG_REBOOT_EN[] PROGMEM = "Reboot the printer"; const char MSG_REBOOT_CZ[] PROGMEM = "Restartujte tiskarnu"; const char * const MSG_REBOOT_LANG_TABLE[LANG_NUM] PROGMEM = { @@ -2195,8 +2216,8 @@ const char * const MSG_UNLOAD_FILAMENT_4_LANG_TABLE[LANG_NUM] PROGMEM = { MSG_UNLOAD_FILAMENT_4_CZ }; -const char MSG_UNLOAD_SUCCESSFULL_EN[] PROGMEM = "Repeat unloading filament?"; -const char MSG_UNLOAD_SUCCESSFULL_CZ[] PROGMEM = "Opakovat vysunuti filamentu?"; +const char MSG_UNLOAD_SUCCESSFULL_EN[] PROGMEM = "Was filament successfully unloaded?"; +const char MSG_UNLOAD_SUCCESSFULL_CZ[] PROGMEM = "Bylo vysunuti filamentu uspesne?"; const char * const MSG_UNLOAD_SUCCESSFULL_LANG_TABLE[LANG_NUM] PROGMEM = { MSG_UNLOAD_SUCCESSFULL_EN, MSG_UNLOAD_SUCCESSFULL_CZ diff --git a/Firmware/language_all.h b/Firmware/language_all.h index e4d23036..b9a60995 100644 --- a/Firmware/language_all.h +++ b/Firmware/language_all.h @@ -126,6 +126,8 @@ extern const char* const MSG_CHANGE_SUCCESS_LANG_TABLE[LANG_NUM]; #define MSG_CHANGE_SUCCESS LANG_TABLE_SELECT(MSG_CHANGE_SUCCESS_LANG_TABLE) extern const char* const MSG_CHANGING_FILAMENT_LANG_TABLE[LANG_NUM]; #define MSG_CHANGING_FILAMENT LANG_TABLE_SELECT(MSG_CHANGING_FILAMENT_LANG_TABLE) +extern const char* const MSG_CHECK_IDLER_LANG_TABLE[LANG_NUM]; +#define MSG_CHECK_IDLER LANG_TABLE_SELECT(MSG_CHECK_IDLER_LANG_TABLE) extern const char* const MSG_CHOOSE_EXTRUDER_LANG_TABLE[LANG_NUM]; #define MSG_CHOOSE_EXTRUDER LANG_TABLE_SELECT(MSG_CHOOSE_EXTRUDER_LANG_TABLE) extern const char* const MSG_CLEAN_NOZZLE_E_LANG_TABLE[LANG_NUM]; @@ -480,6 +482,8 @@ extern const char* const MSG_PREPARE_FILAMENT_LANG_TABLE[LANG_NUM]; #define MSG_PREPARE_FILAMENT LANG_TABLE_SELECT(MSG_PREPARE_FILAMENT_LANG_TABLE) extern const char* const MSG_PRESS_LANG_TABLE[LANG_NUM]; #define MSG_PRESS LANG_TABLE_SELECT(MSG_PRESS_LANG_TABLE) +extern const char* const MSG_PRESS_TO_PREHEAT_LANG_TABLE[LANG_NUM]; +#define MSG_PRESS_TO_PREHEAT LANG_TABLE_SELECT(MSG_PRESS_TO_PREHEAT_LANG_TABLE) extern const char* const MSG_PRESS_TO_UNLOAD_LANG_TABLE[LANG_NUM]; #define MSG_PRESS_TO_UNLOAD LANG_TABLE_SELECT(MSG_PRESS_TO_UNLOAD_LANG_TABLE) extern const char* const MSG_PRINTER_DISCONNECTED_LANG_TABLE[1]; @@ -494,6 +498,8 @@ extern const char* const MSG_PRUSA3D_FORUM_LANG_TABLE[LANG_NUM]; #define MSG_PRUSA3D_FORUM LANG_TABLE_SELECT(MSG_PRUSA3D_FORUM_LANG_TABLE) extern const char* const MSG_PRUSA3D_HOWTO_LANG_TABLE[LANG_NUM]; #define MSG_PRUSA3D_HOWTO LANG_TABLE_SELECT(MSG_PRUSA3D_HOWTO_LANG_TABLE) +extern const char* const MSG_PULL_OUT_FILAMENT_LANG_TABLE[LANG_NUM]; +#define MSG_PULL_OUT_FILAMENT LANG_TABLE_SELECT(MSG_PULL_OUT_FILAMENT_LANG_TABLE) extern const char* const MSG_REBOOT_LANG_TABLE[LANG_NUM]; #define MSG_REBOOT LANG_TABLE_SELECT(MSG_REBOOT_LANG_TABLE) extern const char* const MSG_RECOVERING_PRINT_LANG_TABLE[LANG_NUM]; diff --git a/Firmware/language_cz.h b/Firmware/language_cz.h index c9b630eb..fb5e021f 100644 --- a/Firmware/language_cz.h +++ b/Firmware/language_cz.h @@ -368,7 +368,10 @@ ve #define MSG_PLACE_STEEL_SHEET "Umistete prosim tiskovy plat na heatbed" #define MSG_RECOVER_PRINT "Detekovan vypadek proudu.Obnovit tisk?" #define MSG_PRESS_TO_UNLOAD "Pro vysunuti filamentu stisknete prosim tlacitko" -#define MSG_UNLOAD_SUCCESSFULL "Opakovat vysunuti filamentu?" +#define MSG_UNLOAD_SUCCESSFULL "Bylo vysunuti filamentu uspesne?" +#define MSG_PRESS_TO_PREHEAT "Pro nahrati trysky a pokracovani stisknete tlacitko." +#define MSG_PULL_OUT_FILAMENT "Prosim vyjmete urychlene filament" +#define MSG_CHECK_IDLER "Prosim otevrete idler a manualne odstrante filament." #define MSG_FILE_INCOMPLETE "Soubor nekompletni. Pokracovat?" #define MSG_FILE_CNT "Nektere soubory nebudou setrideny. Maximalni pocet souboru pro setrideni je 100." #define MSG_SORT_TIME "Trideni [Cas]" diff --git a/Firmware/language_en.h b/Firmware/language_en.h index 9cc91a00..922a8ac8 100644 --- a/Firmware/language_en.h +++ b/Firmware/language_en.h @@ -383,7 +383,10 @@ #define(length=17, lines=1) MSG_FSENS_AUTOLOAD_OFF "F. autoload [off]" #define(length=17, lines=1) MSG_FSENS_AUTOLOAD_NA "F. autoload [N/A]" #define(length=20, lines=4) MSG_PRESS_TO_UNLOAD "Please press the knob to unload filament" -#define(length=20, lines=2) MSG_UNLOAD_SUCCESSFULL "Repeat unloading filament?" +#define(length=20, lines=4) MSG_PRESS_TO_PREHEAT "Press knob to preheat nozzle and continue." +#define(length=20, lines=2) MSG_UNLOAD_SUCCESSFULL "Was filament successfully unloaded?" +#define(length=20, lines=4) MSG_CHECK_IDLER "Please open idler and remove filament manually." +#define(length=20, lines=4) MSG_PULL_OUT_FILAMENT "Please pull out filament immediately" #define(length=20, lines=2) MSG_FILE_INCOMPLETE "File incomplete. Continue anyway?" #define(length=20, lines=4) MSG_DEFAULT_SETTINGS_LOADED "Default settings loaded" diff --git a/Firmware/ultralcd.cpp b/Firmware/ultralcd.cpp index 6e984bfd..c624aa88 100644 --- a/Firmware/ultralcd.cpp +++ b/Firmware/ultralcd.cpp @@ -2455,6 +2455,17 @@ void lcd_adjust_z() { } +void lcd_wait_for_heater() { + lcd_display_message_fullscreen_P(MSG_WIZARD_HEATING); + + lcd.setCursor(0, 4); + lcd.print(LCD_STR_THERMOMETER[0]); + lcd.print(ftostr3(degHotend(active_extruder))); + lcd.print("/"); + lcd.print(ftostr3(degTargetHotend(active_extruder))); + lcd.print(LCD_STR_DEGREE); +} + void lcd_wait_for_cool_down() { lcd_set_custom_characters_degree(); setTargetHotend(0,0); diff --git a/Firmware/ultralcd.h b/Firmware/ultralcd.h index 7b7be6bf..0940a9d8 100644 --- a/Firmware/ultralcd.h +++ b/Firmware/ultralcd.h @@ -258,6 +258,7 @@ void lcd_farm_sdcard_menu(); void lcd_farm_sdcard_menu_w(); //void get_description(); +void lcd_wait_for_heater(); void lcd_wait_for_cool_down(); void adjust_bed_reset(); void lcd_extr_cal_reset();