From dbd07c1d1c418b09a814bf542bf3439bdf714296 Mon Sep 17 00:00:00 2001 From: 3d-gussner <3d.gussner@gmail.com> Date: Thu, 2 Apr 2020 15:11:46 +0200 Subject: [PATCH 01/38] Limited LCD output of several uint16 values to 999 --- Firmware/ultralcd.cpp | 28 ++++++++++++++++++++++++---- 1 file changed, 24 insertions(+), 4 deletions(-) diff --git a/Firmware/ultralcd.cpp b/Firmware/ultralcd.cpp index daf9f0176..363398a93 100755 --- a/Firmware/ultralcd.cpp +++ b/Firmware/ultralcd.cpp @@ -1741,14 +1741,18 @@ static void lcd_menu_fails_stats_mmu_total() { mmu_command(MmuCmd::S3); lcd_timeoutToStatus.stop(); //infinite timeout - uint8_t fails = eeprom_read_byte((uint8_t*)EEPROM_MMU_FAIL_TOT); - uint16_t load_fails = eeprom_read_byte((uint8_t*)EEPROM_MMU_LOAD_FAIL_TOT); + uint16_t fails = eeprom_read_word((uint16_t*)EEPROM_MMU_FAIL_TOT); + uint16_t load_fails = eeprom_read_word((uint16_t*)EEPROM_MMU_LOAD_FAIL_TOT); + if (fails > 999) fails = 999; + if (load_fails > 999) load_fails = 999; + uint16_t mmu_power_fails = mmu_power_failures; + if (mmu_power_fails > 999) mmu_power_fails = 999; lcd_home(); lcd_printf_P(PSTR("%S\n" " %-16.16S%-3d\n" " %-16.16S%-3d\n" " %-16.16S%-3d"), _i("Total failures"), ////c=20 r=1 _i("MMU fails"), fails, ////c=14 r=1 _i("MMU load fails"), load_fails, ////c=14 r=1 - _i("MMU power fails"), mmu_power_failures); ////c=14 r=1 + _i("MMU power fails"), mmu_power_fails); ////c=14 r=1 menu_back_if_clicked_fb(); } @@ -1773,7 +1777,11 @@ static void lcd_menu_fails_stats_total() uint16_t filam = eeprom_read_word((uint16_t*)EEPROM_FERROR_COUNT_TOT); uint16_t crashX = eeprom_read_word((uint16_t*)EEPROM_CRASH_COUNT_X_TOT); uint16_t crashY = eeprom_read_word((uint16_t*)EEPROM_CRASH_COUNT_Y_TOT); - lcd_home(); + if (power > 999) power = 999; + if (filam > 999) filam = 999; + if (crashX > 999) crashX = 999; + if (crashY > 999) crashY = 999; + lcd_home(); lcd_printf_P(failStatsFmt, _i("Total failures"), ////c=20 r=1 _i("Power failures"), power, ////c=14 r=1 @@ -1792,6 +1800,17 @@ static void lcd_menu_fails_stats_total() //! | Crash X:000 Y:000| c=7 r=1 //! ---------------------- //! @endcode +//! @brief Show Last Print Failures Statistics with PAT9125 +//! +//! @code{.unparsed} +//! |01234567890123456789| +//! |Last print failures | c=20 r=1 +//! | Power failures 000| c=14 r=1 +//! | Runouts H 000 S 000| c=14 r=1 +//! | Crash X:000 Y:000| c=7 r=1 +//! ---------------------- +//! @endcode + //! @todo Positioning of the messages and values on LCD aren't fixed to their exact place. This causes issues with translations. static void lcd_menu_fails_stats_print() { @@ -1868,6 +1887,7 @@ static void lcd_menu_fails_stats() lcd_timeoutToStatus.stop(); //infinite timeout uint8_t filamentLast = eeprom_read_byte((uint8_t*)EEPROM_FERROR_COUNT); uint16_t filamentTotal = eeprom_read_word((uint16_t*)EEPROM_FERROR_COUNT_TOT); + if (filamentTotal > 999) filamentTotal = 999; lcd_home(); lcd_printf_P(failStatsFmt, _i("Last print failures"), ////c=20 r=1 From 2ba24fe0d459297bf03bfe81ddffaa31d880edd9 Mon Sep 17 00:00:00 2001 From: 3d-gussner <3d.gussner@gmail.com> Date: Wed, 3 Feb 2021 10:42:25 +0100 Subject: [PATCH 02/38] Add pause/resume to USB/host prints via LCD menu Depending if SD or USB/host print the firmware sends - SD print: `// action:paused` or `// action:resumed` are send to inform USB/Host - USB/host print: `// action:pause` or `// action:resume` are send to trigger the USB/host to handle it - USB/host must handle `// action:pause` and `// action:resume` correctly to work - Tested with Octoprint - It handles every thing correctly - Any combination of Octoprint and/or LCD `pause` and `resume` working correctly - Tested with Pronterface - It pauses BUT doesn't send the printer in pause position, and so it is not possible to `resume` from LCD menu - I guess some Macros can fix that. - Repetier Host/Server documentation shows that it should work. Not tested. Could save 56 bytes in first step and additional 38 bytes adding `MSG_PAUSE_PRINT` to messages.c/.h Updated `lang_en*.txt` @todo Polish translation is 19 characters long (it still fits) BUT should be corrected to 18 chars. --- Firmware/messages.c | 3 ++ Firmware/messages.h | 3 ++ Firmware/ultralcd.cpp | 92 ++++++++++++++++++++++++++----------------- lang/lang_en.txt | 2 +- lang/lang_en_cz.txt | 2 +- lang/lang_en_de.txt | 2 +- lang/lang_en_es.txt | 2 +- lang/lang_en_fr.txt | 2 +- lang/lang_en_it.txt | 2 +- lang/lang_en_pl.txt | 2 +- 10 files changed, 68 insertions(+), 44 deletions(-) diff --git a/Firmware/messages.c b/Firmware/messages.c index 0b1d58e04..950efcd3c 100644 --- a/Firmware/messages.c +++ b/Firmware/messages.c @@ -70,6 +70,7 @@ const char MSG_MMU_LOAD_FAILS[] PROGMEM_I1 = ISTR("MMU load fails"); ////c=14 const char MSG_NO[] PROGMEM_I1 = ISTR("No"); //// const char MSG_NOZZLE[] PROGMEM_I1 = ISTR("Nozzle"); //// const char MSG_PAPER[] PROGMEM_I1 = ISTR("Place a sheet of paper under the nozzle during the calibration of first 4 points. If the nozzle catches the paper, power off the printer immediately."); ////c=20 r=10 +const char MSG_PAUSE_PRINT[] PROGMEM_I1 = ISTR("Pause print");////c=18 const char MSG_PLACE_STEEL_SHEET[] PROGMEM_I1 = ISTR("Please place steel sheet on heatbed."); ////c=20 r=4 const char MSG_PLEASE_WAIT[] PROGMEM_I1 = ISTR("Please wait"); ////c=20 const char MSG_POWER_FAILURES[] PROGMEM_I1 = ISTR("Power failures"); ////c=14 @@ -188,7 +189,9 @@ const char MSG_ENDSTOP_OPEN[] PROGMEM_N1 = "open"; //// const char MSG_POWERUP[] PROGMEM_N1 = "PowerUp"; //// const char MSG_ERR_STOPPED[] PROGMEM_N1 = "Printer stopped due to errors. Fix the error and use M999 to restart. (Temperature is reset. Set it after restarting)"; //// const char MSG_ENDSTOP_HIT[] PROGMEM_N1 = "TRIGGERED"; //// +const char MSG_OCTOPRINT_PAUSE[] PROGMEM_N1 = "// action:pause"; //// const char MSG_OCTOPRINT_PAUSED[] PROGMEM_N1 = "// action:paused"; //// +const char MSG_OCTOPRINT_RESUME[] PROGMEM_N1 = "// action:resume"; //// const char MSG_OCTOPRINT_RESUMED[] PROGMEM_N1 = "// action:resumed"; //// const char MSG_OCTOPRINT_CANCEL[] PROGMEM_N1 = "// action:cancel"; //// const char MSG_FANCHECK_EXTRUDER[] PROGMEM_N1 = "Err: EXTR. FAN ERROR"; ////c=20 diff --git a/Firmware/messages.h b/Firmware/messages.h index 0a05c58f5..c99a77d99 100644 --- a/Firmware/messages.h +++ b/Firmware/messages.h @@ -69,6 +69,7 @@ extern const char MSG_MMU_LOAD_FAILS[]; extern const char MSG_NO[]; extern const char MSG_NOZZLE[]; extern const char MSG_PAPER[]; +extern const char MSG_PAUSE_PRINT[]; extern const char MSG_PLACE_STEEL_SHEET[]; extern const char MSG_PLEASE_WAIT[]; extern const char MSG_POWER_FAILURES[]; @@ -188,7 +189,9 @@ extern const char MSG_ERR_STOPPED[]; extern const char MSG_ENDSTOP_HIT[]; extern const char MSG_EJECT_FILAMENT[]; extern const char MSG_CUT_FILAMENT[]; +extern const char MSG_OCTOPRINT_PAUSE[]; extern const char MSG_OCTOPRINT_PAUSED[]; +extern const char MSG_OCTOPRINT_RESUME[]; extern const char MSG_OCTOPRINT_RESUMED[]; extern const char MSG_OCTOPRINT_CANCEL[]; extern const char MSG_FANCHECK_EXTRUDER[]; diff --git a/Firmware/ultralcd.cpp b/Firmware/ultralcd.cpp index 0f6bc1fa3..94fa0da44 100755 --- a/Firmware/ultralcd.cpp +++ b/Firmware/ultralcd.cpp @@ -1539,6 +1539,12 @@ void lcd_pause_print() } } +//! @brief Pause USB/host print, disable nozzle heater, move to park position +void lcd_pause_usb_print() +{ + SERIAL_PROTOCOLLNRPGM(MSG_OCTOPRINT_PAUSE); //pause for octoprint +} + float move_menu_scale; static void lcd_move_menu_axis(); @@ -6497,6 +6503,12 @@ void lcd_resume_print() SERIAL_PROTOCOLLNRPGM(MSG_OCTOPRINT_RESUMED); //resume octoprint } +//! @brief Resume paused USB/host print +void lcd_resume_usb_print() +{ + SERIAL_PROTOCOLLNRPGM(MSG_OCTOPRINT_RESUME); //resume octoprint +} + static void change_sheet() { eeprom_update_byte(&(EEPROM_Sheets_base->active_sheet), selected_sheet); @@ -6631,44 +6643,50 @@ static void lcd_main_menu() MENU_ITEM_SUBMENU_P(_i("Preheat"), lcd_preheat_menu);////MSG_PREHEAT } - - if(isPrintPaused && saved_printing_type == PRINTING_TYPE_USB) + if (mesh_bed_leveling_flag == false && homing_flag == false && !isPrintPaused) { -#ifdef FANCHECK - if((fan_check_error == EFCE_FIXED) || (fan_check_error == EFCE_OK)) - MENU_ITEM_SUBMENU_P(_T(MSG_RESUME_PRINT), lcd_resume_print);////MSG_RESUME_PRINT c=18 -#else - MENU_ITEM_SUBMENU_P(_T(MSG_RESUME_PRINT), lcd_resume_print);////MSG_RESUME_PRINT c=18 -#endif + if (IS_SD_PRINTING) + { + MENU_ITEM_FUNCTION_P(_T(MSG_PAUSE_PRINT), lcd_pause_print);////MSG_PAUSE_PRINT c=18 + } + else if (is_usb_printing) + { + MENU_ITEM_FUNCTION_P(_T(MSG_PAUSE_PRINT), lcd_pause_usb_print);////MSG_PAUSE_PRINT c=18 + } } - -#ifdef SDSUPPORT + if(isPrintPaused) + { + #ifdef FANCHECK + if((fan_check_error == EFCE_FIXED) || (fan_check_error == EFCE_OK)) + { + if (is_usb_printing) + { + MENU_ITEM_SUBMENU_P(_T(MSG_RESUME_PRINT), lcd_resume_usb_print);////MSG_RESUME_PRINT c=18 + } + else + { + MENU_ITEM_SUBMENU_P(_T(MSG_RESUME_PRINT), lcd_resume_print);////MSG_RESUME_PRINT c=18 + } + } + #else + if (is_usb_printing) + { + MENU_ITEM_SUBMENU_P(_T(MSG_RESUME_PRINT), lcd_resume_usb_print);////MSG_RESUME_PRINT c=18 + } + else + { + MENU_ITEM_SUBMENU_P(_T(MSG_RESUME_PRINT), lcd_resume_print);////MSG_RESUME_PRINT c=18 + } + #endif //FANCHECK + } + if(IS_SD_PRINTING || is_usb_printing || isPrintPaused) + { + MENU_ITEM_SUBMENU_P(_T(MSG_STOP_PRINT), lcd_sdcard_stop); + } +#ifdef SDSUPPORT //!@todo SDSUPPORT undefined creates several issues in source code if (card.cardOK || lcd_commands_type == LcdCommands::Layer1Cal) { - if (card.isFileOpen()) - { - if (mesh_bed_leveling_flag == false && homing_flag == false) { - if (card.sdprinting) - { - MENU_ITEM_FUNCTION_P(_i("Pause print"), lcd_pause_print);////MSG_PAUSE_PRINT - } - else if(isPrintPaused) - { - #ifdef FANCHECK - if((fan_check_error == EFCE_FIXED) || (fan_check_error == EFCE_OK)) - MENU_ITEM_SUBMENU_P(_T(MSG_RESUME_PRINT), lcd_resume_print);////MSG_RESUME_PRINT c=18 - #else - MENU_ITEM_SUBMENU_P(_T(MSG_RESUME_PRINT), lcd_resume_print);////MSG_RESUME_PRINT c=18 - #endif - - } - MENU_ITEM_SUBMENU_P(_T(MSG_STOP_PRINT), lcd_sdcard_stop); - } - } - else if (lcd_commands_type == LcdCommands::Layer1Cal && mesh_bed_leveling_flag == false && homing_flag == false) { - //MENU_ITEM_SUBMENU_P(_T(MSG_STOP_PRINT), lcd_sdcard_stop); - } - else + if (!card.isFileOpen()) { if (!is_usb_printing && (lcd_commands_type != LcdCommands::Layer1Cal)) { @@ -6680,7 +6698,7 @@ static void lcd_main_menu() } #if SDCARDDETECT < 1 MENU_ITEM_GCODE_P(_i("Change SD card"), PSTR("M21")); // SD-card changed by user////MSG_CNG_SDCARD -#endif +#endif //SDCARDDETECT } } else @@ -6689,9 +6707,9 @@ static void lcd_main_menu() MENU_ITEM_SUBMENU_P(_i("No SD card"), lcd_sdcard_menu);////MSG_NO_CARD #if SDCARDDETECT < 1 MENU_ITEM_GCODE_P(_i("Init. SD card"), PSTR("M21")); // Manually initialize the SD-card via user interface////MSG_INIT_SDCARD -#endif +#endif //SDCARDDETECT } -#endif +#endif //SDSUPPORT if(!isPrintPaused && !IS_SD_PRINTING && !is_usb_printing && (lcd_commands_type != LcdCommands::Layer1Cal)) { diff --git a/lang/lang_en.txt b/lang/lang_en.txt index bcb0a4444..d9f606ca4 100644 --- a/lang/lang_en.txt +++ b/lang/lang_en.txt @@ -544,7 +544,7 @@ # "Nozzle FAN" -#MSG_PAUSE_PRINT +#MSG_PAUSE_PRINT c=18 "Pause print" #MSG_PID_RUNNING c=20 r=1 diff --git a/lang/lang_en_cz.txt b/lang/lang_en_cz.txt index 0b3d7b14f..f8cf4bd8a 100644 --- a/lang/lang_en_cz.txt +++ b/lang/lang_en_cz.txt @@ -726,7 +726,7 @@ "Nozzle FAN" "Vent. trysky" -#MSG_PAUSE_PRINT +#MSG_PAUSE_PRINT c=18 "Pause print" "Pozastavit tisk" diff --git a/lang/lang_en_de.txt b/lang/lang_en_de.txt index 0a436a9ee..df13e1d18 100644 --- a/lang/lang_en_de.txt +++ b/lang/lang_en_de.txt @@ -726,7 +726,7 @@ "Nozzle FAN" "Duesevent." -#MSG_PAUSE_PRINT +#MSG_PAUSE_PRINT c=18 "Pause print" "Druck pausieren" diff --git a/lang/lang_en_es.txt b/lang/lang_en_es.txt index 2e29fa20a..30548327f 100644 --- a/lang/lang_en_es.txt +++ b/lang/lang_en_es.txt @@ -726,7 +726,7 @@ "Nozzle FAN" "Vent. capa" -#MSG_PAUSE_PRINT +#MSG_PAUSE_PRINT c=18 "Pause print" "Pausar impresion" diff --git a/lang/lang_en_fr.txt b/lang/lang_en_fr.txt index cc0cbb95b..8cbf3a67a 100644 --- a/lang/lang_en_fr.txt +++ b/lang/lang_en_fr.txt @@ -726,7 +726,7 @@ "Nozzle FAN" "Vent. buse" -#MSG_PAUSE_PRINT +#MSG_PAUSE_PRINT c=18 "Pause print" "Pause de l'impr." diff --git a/lang/lang_en_it.txt b/lang/lang_en_it.txt index 8cd939082..919c2e561 100644 --- a/lang/lang_en_it.txt +++ b/lang/lang_en_it.txt @@ -726,7 +726,7 @@ "Nozzle FAN" "Ventola estrusore" -#MSG_PAUSE_PRINT +#MSG_PAUSE_PRINT c=18 "Pause print" "Metti in pausa" diff --git a/lang/lang_en_pl.txt b/lang/lang_en_pl.txt index 38d1421f7..31cb5a41a 100644 --- a/lang/lang_en_pl.txt +++ b/lang/lang_en_pl.txt @@ -726,7 +726,7 @@ "Nozzle FAN" "WentHotend" -#MSG_PAUSE_PRINT +#MSG_PAUSE_PRINT c=18 "Pause print" "Wstrzymanie wydruku" From 9ccda4c57f0b79bdfe2754387f25de5ab4e5c575 Mon Sep 17 00:00:00 2001 From: "D.R.racer" Date: Tue, 9 Feb 2021 09:10:23 +0100 Subject: [PATCH 03/38] Optimize code size ... looks like I've been able to reduce the code by 80B by using the clamp999() function. There are other spots this function can be used as well, I didn't touch those yet. --- Firmware/ultralcd.cpp | 41 +++++++++++++++-------------------------- 1 file changed, 15 insertions(+), 26 deletions(-) diff --git a/Firmware/ultralcd.cpp b/Firmware/ultralcd.cpp index 70b394c5f..c2b6600fb 100755 --- a/Firmware/ultralcd.cpp +++ b/Firmware/ultralcd.cpp @@ -1633,6 +1633,10 @@ void lcd_menu_extruder_info() // NOT static due to using ins menu_back_if_clicked(); } +static uint16_t __attribute__((noinline)) clamp999(uint16_t v){ + return v > 999 ? 999 : v; +} + //! @brief Show Fails Statistics MMU //! //! @code{.unparsed} @@ -1666,13 +1670,11 @@ static void lcd_menu_fails_stats_mmu() static void lcd_menu_fails_stats_mmu_print() { lcd_timeoutToStatus.stop(); //infinite timeout - uint8_t fails = eeprom_read_byte((uint8_t*)EEPROM_MMU_FAIL); - uint16_t load_fails = eeprom_read_byte((uint8_t*)EEPROM_MMU_LOAD_FAIL); lcd_home(); lcd_printf_P(PSTR("%S\n" " %-16.16S%-3d\n" " %-16.16S%-3d"), _T(MSG_LAST_PRINT_FAILURES), ////c=20 - _T(MSG_MMU_FAILS), fails, ////c=14 - _T(MSG_MMU_LOAD_FAILS), load_fails); ////c=14 + _T(MSG_MMU_FAILS), clamp999( eeprom_read_byte((uint8_t*)EEPROM_MMU_FAIL) ), ////c=14 + _T(MSG_MMU_LOAD_FAILS), clamp999( eeprom_read_byte((uint8_t*)EEPROM_MMU_LOAD_FAIL) )); ////c=14 menu_back_if_clicked_fb(); } @@ -1691,18 +1693,12 @@ static void lcd_menu_fails_stats_mmu_total() { mmu_command(MmuCmd::S3); lcd_timeoutToStatus.stop(); //infinite timeout - uint16_t fails = eeprom_read_word((uint16_t*)EEPROM_MMU_FAIL_TOT); - uint16_t load_fails = eeprom_read_word((uint16_t*)EEPROM_MMU_LOAD_FAIL_TOT); - if (fails > 999) fails = 999; - if (load_fails > 999) load_fails = 999; - uint16_t mmu_power_fails = mmu_power_failures; - if (mmu_power_fails > 999) mmu_power_fails = 999; lcd_home(); lcd_printf_P(PSTR("%S\n" " %-16.16S%-3d\n" " %-16.16S%-3d\n" " %-16.16S%-3d"), _T(MSG_TOTAL_FAILURES), ////c=20 - _T(MSG_MMU_FAILS), fails, ////c=14 - _T(MSG_MMU_LOAD_FAILS), load_fails, ////c=14 - _i("MMU power fails"), mmu_power_failures); ////c=14 r=1 + _T(MSG_MMU_FAILS), clamp999( eeprom_read_word((uint16_t*)EEPROM_MMU_FAIL_TOT) ), ////c=14 + _T(MSG_MMU_LOAD_FAILS), clamp999( eeprom_read_word((uint16_t*)EEPROM_MMU_LOAD_FAIL_TOT) ), ////c=14 + _i("MMU power fails"), clamp999( mmu_power_failures )); ////c=14 r=1 menu_back_if_clicked_fb(); } @@ -1723,20 +1719,14 @@ static const char failStatsFmt[] PROGMEM = "%S\n" " %-16.16S%-3d\n" " %-16.16S%- static void lcd_menu_fails_stats_total() { lcd_timeoutToStatus.stop(); //infinite timeout - uint16_t power = eeprom_read_word((uint16_t*)EEPROM_POWER_COUNT_TOT); - uint16_t filam = eeprom_read_word((uint16_t*)EEPROM_FERROR_COUNT_TOT); - uint16_t crashX = eeprom_read_word((uint16_t*)EEPROM_CRASH_COUNT_X_TOT); - uint16_t crashY = eeprom_read_word((uint16_t*)EEPROM_CRASH_COUNT_Y_TOT); - if (power > 999) power = 999; - if (filam > 999) filam = 999; - if (crashX > 999) crashX = 999; - if (crashY > 999) crashY = 999; lcd_home(); lcd_printf_P(failStatsFmt, _T(MSG_TOTAL_FAILURES), ////c=20 - _T(MSG_POWER_FAILURES), power, ////c=14 - _T(MSG_FIL_RUNOUTS), filam, ////c=14 - _T(MSG_CRASH), crashX, crashY); ////c=7 + _T(MSG_POWER_FAILURES), clamp999( eeprom_read_word((uint16_t*)EEPROM_POWER_COUNT_TOT) ), ////c=14 + _T(MSG_FIL_RUNOUTS), clamp999( eeprom_read_word((uint16_t*)EEPROM_FERROR_COUNT_TOT) ), ////c=14 + _T(MSG_CRASH), ////c=7 + clamp999( eeprom_read_word((uint16_t*)EEPROM_CRASH_COUNT_X_TOT) ), + clamp999( eeprom_read_word((uint16_t*)EEPROM_CRASH_COUNT_Y_TOT) )); menu_back_if_clicked_fb(); } @@ -1836,8 +1826,7 @@ static void lcd_menu_fails_stats() { lcd_timeoutToStatus.stop(); //infinite timeout uint8_t filamentLast = eeprom_read_byte((uint8_t*)EEPROM_FERROR_COUNT); - uint16_t filamentTotal = eeprom_read_word((uint16_t*)EEPROM_FERROR_COUNT_TOT); - if (filamentTotal > 999) filamentTotal = 999; + uint16_t filamentTotal = clamp999( eeprom_read_word((uint16_t*)EEPROM_FERROR_COUNT_TOT) ); lcd_home(); lcd_printf_P(failStatsFmt, _T(MSG_LAST_PRINT_FAILURES), ////c=20 From e5711ea84f8e590c8d3e490b3150318703698fb5 Mon Sep 17 00:00:00 2001 From: 3d-gussner <3d.gussner@gmail.com> Date: Wed, 10 Feb 2021 11:03:23 +0100 Subject: [PATCH 04/38] Indentation to 4 spaces for tabs --- Firmware/ultralcd.cpp | 275 +++++++++++++++++++++--------------------- 1 file changed, 136 insertions(+), 139 deletions(-) diff --git a/Firmware/ultralcd.cpp b/Firmware/ultralcd.cpp index 94fa0da44..9d2e9d0d8 100755 --- a/Firmware/ultralcd.cpp +++ b/Firmware/ultralcd.cpp @@ -6608,177 +6608,174 @@ static void lcd_sheet_menu() static void lcd_main_menu() { - MENU_BEGIN(); + MENU_BEGIN(); - // Majkl superawesome menu + // Majkl superawesome menu - MENU_ITEM_BACK_P(_T(MSG_WATCH)); + MENU_ITEM_BACK_P(_T(MSG_WATCH)); #ifdef RESUME_DEBUG - if (!saved_printing) - MENU_ITEM_FUNCTION_P(PSTR("tst - Save"), lcd_menu_test_save); - else - MENU_ITEM_FUNCTION_P(PSTR("tst - Restore"), lcd_menu_test_restore); + if (!saved_printing) + MENU_ITEM_FUNCTION_P(PSTR("tst - Save"), lcd_menu_test_save); + else + MENU_ITEM_FUNCTION_P(PSTR("tst - Restore"), lcd_menu_test_restore); #endif //RESUME_DEBUG #ifdef TMC2130_DEBUG - MENU_ITEM_FUNCTION_P(PSTR("recover print"), recover_print); - MENU_ITEM_FUNCTION_P(PSTR("power panic"), uvlo_); + MENU_ITEM_FUNCTION_P(PSTR("recover print"), recover_print); + MENU_ITEM_FUNCTION_P(PSTR("power panic"), uvlo_); #endif //TMC2130_DEBUG - - if ( ( IS_SD_PRINTING || is_usb_printing || (lcd_commands_type == LcdCommands::Layer1Cal)) && (current_position[Z_AXIS] < Z_HEIGHT_HIDE_LIVE_ADJUST_MENU) && !homing_flag && !mesh_bed_leveling_flag) - { - MENU_ITEM_SUBMENU_P(_T(MSG_BABYSTEP_Z), lcd_babystep_z);//8 - } - if (farm_mode) - MENU_ITEM_FUNCTION_P(_T(MSG_FILAMENTCHANGE), lcd_colorprint_change);//8 - - if ( moves_planned() || IS_SD_PRINTING || is_usb_printing || (lcd_commands_type == LcdCommands::Layer1Cal)) - { - MENU_ITEM_SUBMENU_P(_i("Tune"), lcd_tune_menu);////MSG_TUNE - } else - { - MENU_ITEM_SUBMENU_P(_i("Preheat"), lcd_preheat_menu);////MSG_PREHEAT - } - - if (mesh_bed_leveling_flag == false && homing_flag == false && !isPrintPaused) - { - if (IS_SD_PRINTING) - { - MENU_ITEM_FUNCTION_P(_T(MSG_PAUSE_PRINT), lcd_pause_print);////MSG_PAUSE_PRINT c=18 - } - else if (is_usb_printing) - { - MENU_ITEM_FUNCTION_P(_T(MSG_PAUSE_PRINT), lcd_pause_usb_print);////MSG_PAUSE_PRINT c=18 - } - } - if(isPrintPaused) - { - #ifdef FANCHECK - if((fan_check_error == EFCE_FIXED) || (fan_check_error == EFCE_OK)) - { - if (is_usb_printing) - { - MENU_ITEM_SUBMENU_P(_T(MSG_RESUME_PRINT), lcd_resume_usb_print);////MSG_RESUME_PRINT c=18 - } - else - { - MENU_ITEM_SUBMENU_P(_T(MSG_RESUME_PRINT), lcd_resume_print);////MSG_RESUME_PRINT c=18 - } - } - #else - if (is_usb_printing) - { - MENU_ITEM_SUBMENU_P(_T(MSG_RESUME_PRINT), lcd_resume_usb_print);////MSG_RESUME_PRINT c=18 - } - else - { - MENU_ITEM_SUBMENU_P(_T(MSG_RESUME_PRINT), lcd_resume_print);////MSG_RESUME_PRINT c=18 - } - #endif //FANCHECK - } - if(IS_SD_PRINTING || is_usb_printing || isPrintPaused) - { - MENU_ITEM_SUBMENU_P(_T(MSG_STOP_PRINT), lcd_sdcard_stop); - } -#ifdef SDSUPPORT //!@todo SDSUPPORT undefined creates several issues in source code - if (card.cardOK || lcd_commands_type == LcdCommands::Layer1Cal) - { - if (!card.isFileOpen()) - { - if (!is_usb_printing && (lcd_commands_type != LcdCommands::Layer1Cal)) - { - //if (farm_mode) MENU_ITEM_SUBMENU_P(MSG_FARM_CARD_MENU, lcd_farm_sdcard_menu); - /*else*/ { - bMain=true; // flag ('fake parameter') for 'lcd_sdcard_menu()' function - MENU_ITEM_SUBMENU_P(_T(MSG_CARD_MENU), lcd_sdcard_menu); - } - } -#if SDCARDDETECT < 1 - MENU_ITEM_GCODE_P(_i("Change SD card"), PSTR("M21")); // SD-card changed by user////MSG_CNG_SDCARD -#endif //SDCARDDETECT - } - - } else - { - bMain=true; // flag (i.e. 'fake parameter') for 'lcd_sdcard_menu()' function - MENU_ITEM_SUBMENU_P(_i("No SD card"), lcd_sdcard_menu);////MSG_NO_CARD -#if SDCARDDETECT < 1 - MENU_ITEM_GCODE_P(_i("Init. SD card"), PSTR("M21")); // Manually initialize the SD-card via user interface////MSG_INIT_SDCARD -#endif //SDCARDDETECT - } -#endif //SDSUPPORT - - if(!isPrintPaused && !IS_SD_PRINTING && !is_usb_printing && (lcd_commands_type != LcdCommands::Layer1Cal)) - { - if (!farm_mode) + if ( ( IS_SD_PRINTING || is_usb_printing || (lcd_commands_type == LcdCommands::Layer1Cal)) && (current_position[Z_AXIS] < Z_HEIGHT_HIDE_LIVE_ADJUST_MENU) && !homing_flag && !mesh_bed_leveling_flag) { - const int8_t sheet = eeprom_read_byte(&(EEPROM_Sheets_base->active_sheet)); - const int8_t nextSheet = eeprom_next_initialized_sheet(sheet); - if ((nextSheet >= 0) && (sheet != nextSheet)) // show menu only if we have 2 or more sheets initialized + MENU_ITEM_SUBMENU_P(_T(MSG_BABYSTEP_Z), lcd_babystep_z);//8 + } + + if (farm_mode) + MENU_ITEM_FUNCTION_P(_T(MSG_FILAMENTCHANGE), lcd_colorprint_change);//8 + + if ( moves_planned() || IS_SD_PRINTING || is_usb_printing || (lcd_commands_type == LcdCommands::Layer1Cal)) + { + MENU_ITEM_SUBMENU_P(_i("Tune"), lcd_tune_menu);////MSG_TUNE + } else + { + MENU_ITEM_SUBMENU_P(_i("Preheat"), lcd_preheat_menu);////MSG_PREHEAT + } + + if (mesh_bed_leveling_flag == false && homing_flag == false && !isPrintPaused) + { + if (IS_SD_PRINTING) { - MENU_ITEM_FUNCTION_E(EEPROM_Sheets_base->s[sheet], eeprom_switch_to_next_sheet); + MENU_ITEM_FUNCTION_P(_T(MSG_PAUSE_PRINT), lcd_pause_print);////MSG_PAUSE_PRINT c=18 + } + else if (is_usb_printing) + { + MENU_ITEM_FUNCTION_P(_T(MSG_PAUSE_PRINT), lcd_pause_usb_print);////MSG_PAUSE_PRINT c=18 } } - } + if(isPrintPaused) + { +#ifdef FANCHECK + if((fan_check_error == EFCE_FIXED) || (fan_check_error == EFCE_OK)) + { + if (is_usb_printing) + { + MENU_ITEM_SUBMENU_P(_T(MSG_RESUME_PRINT), lcd_resume_usb_print);////MSG_RESUME_PRINT c=18 + } + else + { + MENU_ITEM_SUBMENU_P(_T(MSG_RESUME_PRINT), lcd_resume_print);////MSG_RESUME_PRINT c=18 + } + } + #else + if (is_usb_printing) + { + MENU_ITEM_SUBMENU_P(_T(MSG_RESUME_PRINT), lcd_resume_usb_print);////MSG_RESUME_PRINT c=18 + } + else + { + MENU_ITEM_SUBMENU_P(_T(MSG_RESUME_PRINT), lcd_resume_print);////MSG_RESUME_PRINT c=18 + } + #endif //FANCHECK + } + if(IS_SD_PRINTING || is_usb_printing || isPrintPaused) + { + MENU_ITEM_SUBMENU_P(_T(MSG_STOP_PRINT), lcd_sdcard_stop); + } +#ifdef SDSUPPORT //!@todo SDSUPPORT undefined creates several issues in source code + if (card.cardOK || lcd_commands_type == LcdCommands::Layer1Cal) + { + if (!card.isFileOpen()) + { + if (!is_usb_printing && (lcd_commands_type != LcdCommands::Layer1Cal)) + { + //if (farm_mode) MENU_ITEM_SUBMENU_P(MSG_FARM_CARD_MENU, lcd_farm_sdcard_menu); + /*else*/{ + bMain=true; // flag ('fake parameter') for 'lcd_sdcard_menu()' function + MENU_ITEM_SUBMENU_P(_T(MSG_CARD_MENU), lcd_sdcard_menu); + } + } +#if SDCARDDETECT < 1 + MENU_ITEM_GCODE_P(_i("Change SD card"), PSTR("M21")); // SD-card changed by user////MSG_CNG_SDCARD +#endif //SDCARDDETECT + } + } else + { + bMain=true; // flag (i.e. 'fake parameter') for 'lcd_sdcard_menu()' function + MENU_ITEM_SUBMENU_P(_i("No SD card"), lcd_sdcard_menu);////MSG_NO_CARD +#if SDCARDDETECT < 1 + MENU_ITEM_GCODE_P(_i("Init. SD card"), PSTR("M21")); // Manually initialize the SD-card via user interface////MSG_INIT_SDCARD +#endif //SDCARDDETECT + } +#endif //SDSUPPORT + if(!isPrintPaused && !IS_SD_PRINTING && !is_usb_printing && (lcd_commands_type != LcdCommands::Layer1Cal)) + { + if (!farm_mode) + { + const int8_t sheet = eeprom_read_byte(&(EEPROM_Sheets_base->active_sheet)); + const int8_t nextSheet = eeprom_next_initialized_sheet(sheet); + if ((nextSheet >= 0) && (sheet != nextSheet)) // show menu only if we have 2 or more sheets initialized + { + MENU_ITEM_FUNCTION_E(EEPROM_Sheets_base->s[sheet], eeprom_switch_to_next_sheet); + } + } + } - if ( ! ( IS_SD_PRINTING || is_usb_printing || (lcd_commands_type == LcdCommands::Layer1Cal) ) ) - { - if (mmu_enabled) - { - MENU_ITEM_SUBMENU_P(_T(MSG_LOAD_FILAMENT), fil_load_menu); - MENU_ITEM_SUBMENU_P(_i("Load to nozzle"), mmu_load_to_nozzle_menu); + if ( ! ( IS_SD_PRINTING || is_usb_printing || (lcd_commands_type == LcdCommands::Layer1Cal) ) ) + { + if (mmu_enabled) + { + MENU_ITEM_SUBMENU_P(_T(MSG_LOAD_FILAMENT), fil_load_menu); + MENU_ITEM_SUBMENU_P(_i("Load to nozzle"), mmu_load_to_nozzle_menu); //-// MENU_ITEM_FUNCTION_P(_T(MSG_UNLOAD_FILAMENT), extr_unload); //bFilamentFirstRun=true; - MENU_ITEM_SUBMENU_P(_T(MSG_UNLOAD_FILAMENT), mmu_unload_filament); - MENU_ITEM_SUBMENU_P(_T(MSG_EJECT_FILAMENT), mmu_fil_eject_menu); + MENU_ITEM_SUBMENU_P(_T(MSG_UNLOAD_FILAMENT), mmu_unload_filament); + MENU_ITEM_SUBMENU_P(_T(MSG_EJECT_FILAMENT), mmu_fil_eject_menu); #ifdef MMU_HAS_CUTTER - MENU_ITEM_SUBMENU_P(_T(MSG_CUT_FILAMENT), mmu_cut_filament_menu); + MENU_ITEM_SUBMENU_P(_T(MSG_CUT_FILAMENT), mmu_cut_filament_menu); #endif //MMU_HAS_CUTTER - } - else - { + } + else + { #ifdef SNMM - MENU_ITEM_SUBMENU_P(_T(MSG_UNLOAD_FILAMENT), fil_unload_menu); - MENU_ITEM_SUBMENU_P(_i("Change extruder"), change_extr_menu);////MSG_CHANGE_EXTR c=20 r=1 + MENU_ITEM_SUBMENU_P(_T(MSG_UNLOAD_FILAMENT), fil_unload_menu); + MENU_ITEM_SUBMENU_P(_i("Change extruder"), change_extr_menu);////MSG_CHANGE_EXTR c=20 r=1 #endif #ifdef FILAMENT_SENSOR - if ((fsensor_autoload_enabled == true) && (fsensor_enabled == true) && (mmu_enabled == false)) - MENU_ITEM_SUBMENU_P(_i("AutoLoad filament"), lcd_menu_AutoLoadFilament);////MSG_AUTOLOAD_FILAMENT c=18 - else + if ((fsensor_autoload_enabled == true) && (fsensor_enabled == true) && (mmu_enabled == false)) + MENU_ITEM_SUBMENU_P(_i("AutoLoad filament"), lcd_menu_AutoLoadFilament);////MSG_AUTOLOAD_FILAMENT c=18 + else #endif //FILAMENT_SENSOR - { - bFilamentFirstRun=true; - MENU_ITEM_SUBMENU_P(_T(MSG_LOAD_FILAMENT), lcd_LoadFilament); - } - bFilamentFirstRun=true; - MENU_ITEM_SUBMENU_P(_T(MSG_UNLOAD_FILAMENT), lcd_unLoadFilament); - } - MENU_ITEM_SUBMENU_P(_T(MSG_SETTINGS), lcd_settings_menu); + { + bFilamentFirstRun=true; + MENU_ITEM_SUBMENU_P(_T(MSG_LOAD_FILAMENT), lcd_LoadFilament); + } + bFilamentFirstRun=true; + MENU_ITEM_SUBMENU_P(_T(MSG_UNLOAD_FILAMENT), lcd_unLoadFilament); + } + MENU_ITEM_SUBMENU_P(_T(MSG_SETTINGS), lcd_settings_menu); if(!isPrintPaused) MENU_ITEM_SUBMENU_P(_T(MSG_MENU_CALIBRATION), lcd_calibration_menu); + } + + if (!is_usb_printing && (lcd_commands_type != LcdCommands::Layer1Cal)) + { + MENU_ITEM_SUBMENU_P(_i("Statistics "), lcd_menu_statistics);////MSG_STATISTICS + } - } - - if (!is_usb_printing && (lcd_commands_type != LcdCommands::Layer1Cal)) - { - MENU_ITEM_SUBMENU_P(_i("Statistics "), lcd_menu_statistics);////MSG_STATISTICS - } - #if defined(TMC2130) || defined(FILAMENT_SENSOR) - MENU_ITEM_SUBMENU_P(_i("Fail stats"), lcd_menu_fails_stats); + MENU_ITEM_SUBMENU_P(_i("Fail stats"), lcd_menu_fails_stats); #endif - if (mmu_enabled) { - MENU_ITEM_SUBMENU_P(_i("Fail stats MMU"), lcd_menu_fails_stats_mmu); - } - MENU_ITEM_SUBMENU_P(_i("Support"), lcd_support_menu);////MSG_SUPPORT + if (mmu_enabled) { + MENU_ITEM_SUBMENU_P(_i("Fail stats MMU"), lcd_menu_fails_stats_mmu); + } + MENU_ITEM_SUBMENU_P(_i("Support"), lcd_support_menu);////MSG_SUPPORT #ifdef LCD_TEST MENU_ITEM_SUBMENU_P(_i("W25x20CL init"), lcd_test_menu);////MSG_SUPPORT #endif //LCD_TEST - MENU_END(); + MENU_END(); } From 8bc46248f6e35ed61cce93719bf4683866dfb970 Mon Sep 17 00:00:00 2001 From: 3d-gussner <3d.gussner@gmail.com> Date: Wed, 10 Feb 2021 11:09:29 +0100 Subject: [PATCH 05/38] avoid having the block body twice in the code. Thanks to @DRracer --- Firmware/ultralcd.cpp | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/Firmware/ultralcd.cpp b/Firmware/ultralcd.cpp index 9d2e9d0d8..4a257fd71 100755 --- a/Firmware/ultralcd.cpp +++ b/Firmware/ultralcd.cpp @@ -6658,6 +6658,7 @@ static void lcd_main_menu() { #ifdef FANCHECK if((fan_check_error == EFCE_FIXED) || (fan_check_error == EFCE_OK)) +#endif //FANCHECK { if (is_usb_printing) { @@ -6668,16 +6669,6 @@ static void lcd_main_menu() MENU_ITEM_SUBMENU_P(_T(MSG_RESUME_PRINT), lcd_resume_print);////MSG_RESUME_PRINT c=18 } } - #else - if (is_usb_printing) - { - MENU_ITEM_SUBMENU_P(_T(MSG_RESUME_PRINT), lcd_resume_usb_print);////MSG_RESUME_PRINT c=18 - } - else - { - MENU_ITEM_SUBMENU_P(_T(MSG_RESUME_PRINT), lcd_resume_print);////MSG_RESUME_PRINT c=18 - } - #endif //FANCHECK } if(IS_SD_PRINTING || is_usb_printing || isPrintPaused) { From c07bcd172a8a8da0d63c2ad638f8a799d569299d Mon Sep 17 00:00:00 2001 From: 3d-gussner <3d.gussner@gmail.com> Date: Mon, 15 Feb 2021 18:34:08 +0100 Subject: [PATCH 06/38] Fix NO Stop print during MBL --- Firmware/ultralcd.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Firmware/ultralcd.cpp b/Firmware/ultralcd.cpp index 4a257fd71..8eed038a7 100755 --- a/Firmware/ultralcd.cpp +++ b/Firmware/ultralcd.cpp @@ -6670,7 +6670,7 @@ static void lcd_main_menu() } } } - if(IS_SD_PRINTING || is_usb_printing || isPrintPaused) + if((IS_SD_PRINTING || is_usb_printing || isPrintPaused) && (custom_message_type != CustomMsg::MeshBedLeveling)) { MENU_ITEM_SUBMENU_P(_T(MSG_STOP_PRINT), lcd_sdcard_stop); } From c2637d9430178537dfdceb6049f5958ceabb7e96 Mon Sep 17 00:00:00 2001 From: 3d-gussner <3d.gussner@gmail.com> Date: Mon, 15 Feb 2021 18:35:04 +0100 Subject: [PATCH 07/38] Documentation Show Main Menu --- Firmware/ultralcd.cpp | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/Firmware/ultralcd.cpp b/Firmware/ultralcd.cpp index 8eed038a7..0cb12f54e 100755 --- a/Firmware/ultralcd.cpp +++ b/Firmware/ultralcd.cpp @@ -6605,6 +6605,44 @@ static void lcd_sheet_menu() MENU_END(); } +//! @brief Show Main Menu +//! +//! @code{.unparsed} +//! |01234567890123456789| +//! | Info screen | allways +//! +//! | tst - Save | ifdef RESUME_DEBUG +//! | tst - Restore | ifdef RESUME_DEBUG +//! +//! | recover print | TMC2130_DEBUG +//! | power panic | TMC2130_DEBUG +//! +//! | Live adjust Z | printing + Z low +//! +//! | Change filament | farm mode +//! +//! | Tune | printing +//! | Pause print | printing + not paused +//! | Resume print | printing + paused +//! | Stop print | printing +//! | Preheat | not printing or paused +//! | Print from SD | not printing or paused +//! +//! | Switch sheet | farm mode +//! +//! | AutoLoad filament | not printing + not mmu or paused +//! | Load filament | not printing + mmu or paused +//! | Load to nozzle | not printing + mmu or paused +//! | Unload filament | not printing or paused +//! | Eject filament | not printing + mmu or paused +//! | Cut filament | not printing + mmu or paused + cut atctive +//! | Settings | not printing or paused +//! | Calibration | not printing +//! | Statistics | not printing +//! | Fail stats | allways +//! | Fail stats MMU | mmu +//! | Support | allways +//! @endcode static void lcd_main_menu() { From 59c2b7e79543f81089c32ca8db3aff0bb86b16bd Mon Sep 17 00:00:00 2001 From: 3d-gussner <3d.gussner@gmail.com> Date: Wed, 17 Feb 2021 07:42:12 +0100 Subject: [PATCH 08/38] Fix Fan error issues. --- Firmware/Marlin_main.cpp | 32 ++++++++++++++++++++------------ Firmware/ultralcd.cpp | 32 ++++++++++++++++---------------- Firmware/ultralcd.h | 1 + 3 files changed, 37 insertions(+), 28 deletions(-) diff --git a/Firmware/Marlin_main.cpp b/Firmware/Marlin_main.cpp index 4e0511c19..da0cf7376 100755 --- a/Firmware/Marlin_main.cpp +++ b/Firmware/Marlin_main.cpp @@ -1857,7 +1857,7 @@ void loop() } #ifdef FANCHECK - if (fan_check_error && isPrintPaused) + if (fan_check_error && isPrintPaused && !IS_SD_PRINTING) { KEEPALIVE_STATE(PAUSED_FOR_USER); host_keepalive(); //prevent timeouts since usb processing is disabled until print is resumed. This is for a crude way of pausing a print on all hosts. @@ -3763,12 +3763,14 @@ There are reasons why some G Codes aren't in numerical order. void process_commands() { #ifdef FANCHECK - if(fan_check_error == EFCE_DETECTED){ - fan_check_error = EFCE_REPORTED; - // SERIAL_PROTOCOLLNRPGM(MSG_OCTOPRINT_PAUSED); - lcd_pause_print(); - cmdqueue_serial_disabled = true; - } + if(fan_check_error == EFCE_DETECTED) + { + fan_check_error = EFCE_REPORTED; + if (is_usb_printing) + lcd_pause_usb_print(); + else + lcd_pause_print(); + } #endif if (!buflen) return; //empty command @@ -8154,11 +8156,17 @@ Sigma_Exit: /*! ### M602 - Resume print M602: Resume print */ - case 602: { - if (isPrintPaused) - lcd_resume_print(); - } - break; + case 602: + { + if (isPrintPaused) + { + if((fan_check_error == EFCE_FIXED) || (fan_check_error == EFCE_OK)) + lcd_resume_print(); + else + SERIAL_PROTOCOLLNRPGM(MSG_OCTOPRINT_PAUSED); //inform octoprint of pause + } + } + break; /*! ### M603 - Stop print M603: Stop print diff --git a/Firmware/ultralcd.cpp b/Firmware/ultralcd.cpp index 0cb12f54e..1fbeb83b7 100755 --- a/Firmware/ultralcd.cpp +++ b/Firmware/ultralcd.cpp @@ -1526,10 +1526,9 @@ void lcd_return_to_status() eFilamentAction = FilamentAction::None; // i.e. non-autoLoad } -//! @brief Pause print, disable nozzle heater, move to park position +//! @brief Pause print, disable nozzle heater, move to park position, send host action "paused" void lcd_pause_print() { - SERIAL_PROTOCOLLNRPGM(MSG_OCTOPRINT_PAUSED); //pause for octoprint stop_and_save_print_to_ram(0.0, -default_retraction); lcd_return_to_status(); isPrintPaused = true; @@ -1537,12 +1536,13 @@ void lcd_pause_print() { lcd_commands_type = LcdCommands::LongPause; } + SERIAL_PROTOCOLLNRPGM(MSG_OCTOPRINT_PAUSED); } -//! @brief Pause USB/host print, disable nozzle heater, move to park position +//! @brief Send host action "pause" void lcd_pause_usb_print() { - SERIAL_PROTOCOLLNRPGM(MSG_OCTOPRINT_PAUSE); //pause for octoprint + SERIAL_PROTOCOLLNRPGM(MSG_OCTOPRINT_PAUSE); } @@ -6482,7 +6482,7 @@ static bool fan_error_selftest() return 0; } -//! @brief Resume paused print +//! @brief Resume paused print, send host action "resumed" //! @todo It is not good to call restore_print_from_ram_and_continue() from function called by lcd_update(), //! as restore_print_from_ram_and_continue() calls lcd_update() internally. void lcd_resume_print() @@ -6490,23 +6490,23 @@ void lcd_resume_print() lcd_return_to_status(); lcd_reset_alert_level(); //for fan speed error if (fan_error_selftest()) return; //abort if error persists - cmdqueue_serial_disabled = false; + cmdqueue_serial_disabled = false; lcd_setstatuspgm(_T(MSG_FINISHING_MOVEMENTS)); st_synchronize(); lcd_setstatuspgm(_T(MSG_RESUMING_PRINT)); ////MSG_RESUMING_PRINT c=20 - isPrintPaused = false; restore_print_from_ram_and_continue(default_retraction); pause_time += (_millis() - start_pause_print); //accumulate time when print is paused for correct statistics calculation refresh_cmd_timeout(); - SERIAL_PROTOCOLLNRPGM(MSG_OCTOPRINT_RESUMED); //resume octoprint + isPrintPaused = false; + SERIAL_PROTOCOLLNRPGM(MSG_OCTOPRINT_RESUMED); //trigger octoprint to resume print } -//! @brief Resume paused USB/host print +//! @brief Resume paused USB/host print, send host action "resume" void lcd_resume_usb_print() { - SERIAL_PROTOCOLLNRPGM(MSG_OCTOPRINT_RESUME); //resume octoprint + SERIAL_PROTOCOLLNRPGM(MSG_OCTOPRINT_RESUME); //resume octoprint } static void change_sheet() @@ -6673,7 +6673,7 @@ static void lcd_main_menu() if (farm_mode) MENU_ITEM_FUNCTION_P(_T(MSG_FILAMENTCHANGE), lcd_colorprint_change);//8 - if ( moves_planned() || IS_SD_PRINTING || is_usb_printing || (lcd_commands_type == LcdCommands::Layer1Cal)) + if ( moves_planned() || PRINTER_ACTIVE || isPrintPaused) { MENU_ITEM_SUBMENU_P(_i("Tune"), lcd_tune_menu);////MSG_TUNE } else @@ -6683,14 +6683,14 @@ static void lcd_main_menu() if (mesh_bed_leveling_flag == false && homing_flag == false && !isPrintPaused) { - if (IS_SD_PRINTING) - { - MENU_ITEM_FUNCTION_P(_T(MSG_PAUSE_PRINT), lcd_pause_print);////MSG_PAUSE_PRINT c=18 - } - else if (is_usb_printing) + if (is_usb_printing) { MENU_ITEM_FUNCTION_P(_T(MSG_PAUSE_PRINT), lcd_pause_usb_print);////MSG_PAUSE_PRINT c=18 } + else if (IS_SD_PRINTING) + { + MENU_ITEM_FUNCTION_P(_T(MSG_PAUSE_PRINT), lcd_pause_print);////MSG_PAUSE_PRINT c=18 + } } if(isPrintPaused) { diff --git a/Firmware/ultralcd.h b/Firmware/ultralcd.h index 62aed6dff..f262107da 100755 --- a/Firmware/ultralcd.h +++ b/Firmware/ultralcd.h @@ -44,6 +44,7 @@ void lcd_change_success(); void lcd_loading_color(); void lcd_sdcard_stop(); void lcd_pause_print(); +void lcd_pause_usb_print(); void lcd_resume_print(); void lcd_print_stop(); void prusa_statistics(int _message, uint8_t _col_nr = 0); From afc15b42bba034ce22623c6bbf8b48f3086d2483 Mon Sep 17 00:00:00 2001 From: 3d-gussner <3d.gussner@gmail.com> Date: Wed, 17 Feb 2021 08:13:32 +0100 Subject: [PATCH 09/38] Indentations --- Firmware/Marlin_main.cpp | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/Firmware/Marlin_main.cpp b/Firmware/Marlin_main.cpp index da0cf7376..2d456c767 100755 --- a/Firmware/Marlin_main.cpp +++ b/Firmware/Marlin_main.cpp @@ -8140,9 +8140,9 @@ Sigma_Exit: /*! ### M25 - Pause SD print M25: Pause SD print */ - case 25: - case 601: - { + case 25: + case 601: + { if (!isPrintPaused) { st_synchronize(); @@ -8150,11 +8150,11 @@ Sigma_Exit: cmdqueue_pop_front(); //trick because we want skip this command (M601) after restore lcd_pause_print(); } - } - break; + } + break; /*! - ### M602 - Resume print M602: Resume print + ### M602 - Resume print M602: Resume print */ case 602: { @@ -8171,10 +8171,10 @@ Sigma_Exit: /*! ### M603 - Stop print M603: Stop print */ - case 603: { - lcd_print_stop(); - } - break; + case 603: { + lcd_print_stop(); + } + break; #ifdef PINDA_THERMISTOR /*! From c79bce010dd0e0951d177aef86b3acacab8b107d Mon Sep 17 00:00:00 2001 From: 3d-gussner <3d.gussner@gmail.com> Date: Wed, 17 Feb 2021 12:18:30 +0100 Subject: [PATCH 10/38] Don't show Settings during pause --- Firmware/ultralcd.cpp | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/Firmware/ultralcd.cpp b/Firmware/ultralcd.cpp index 1fbeb83b7..ed113a27e 100755 --- a/Firmware/ultralcd.cpp +++ b/Firmware/ultralcd.cpp @@ -6614,18 +6614,18 @@ static void lcd_sheet_menu() //! | tst - Save | ifdef RESUME_DEBUG //! | tst - Restore | ifdef RESUME_DEBUG //! -//! | recover print | TMC2130_DEBUG -//! | power panic | TMC2130_DEBUG +//! | recover print | ifdef TMC2130_DEBUG +//! | power panic | ifdef TMC2130_DEBUG //! //! | Live adjust Z | printing + Z low //! //! | Change filament | farm mode //! -//! | Tune | printing +//! | Tune | printing + paused //! | Pause print | printing + not paused //! | Resume print | printing + paused -//! | Stop print | printing -//! | Preheat | not printing or paused +//! | Stop print | printing or paused + NOT MBL +//! | Preheat | not printing + not paused //! | Print from SD | not printing or paused //! //! | Switch sheet | farm mode @@ -6673,7 +6673,7 @@ static void lcd_main_menu() if (farm_mode) MENU_ITEM_FUNCTION_P(_T(MSG_FILAMENTCHANGE), lcd_colorprint_change);//8 - if ( moves_planned() || PRINTER_ACTIVE || isPrintPaused) + if ( moves_planned() || PRINTER_ACTIVE || isPrintPaused ) { MENU_ITEM_SUBMENU_P(_i("Tune"), lcd_tune_menu);////MSG_TUNE } else @@ -6784,8 +6784,11 @@ static void lcd_main_menu() bFilamentFirstRun=true; MENU_ITEM_SUBMENU_P(_T(MSG_UNLOAD_FILAMENT), lcd_unLoadFilament); } - MENU_ITEM_SUBMENU_P(_T(MSG_SETTINGS), lcd_settings_menu); - if(!isPrintPaused) MENU_ITEM_SUBMENU_P(_T(MSG_MENU_CALIBRATION), lcd_calibration_menu); + if(!isPrintPaused) + { + MENU_ITEM_SUBMENU_P(_T(MSG_SETTINGS), lcd_settings_menu); + MENU_ITEM_SUBMENU_P(_T(MSG_MENU_CALIBRATION), lcd_calibration_menu); + } } if (!is_usb_printing && (lcd_commands_type != LcdCommands::Layer1Cal)) From c3bea4d71ca73255883e260d29356ba51f5a4c35 Mon Sep 17 00:00:00 2001 From: "D.R.racer" Date: Wed, 17 Feb 2021 12:53:56 +0100 Subject: [PATCH 11/38] Make a special welcome message for shipping/service prep Another request from our Service dept. - the user shall be prevented from skipping the intro wizard, because otherwise some preset/calibrated features will look like not done - especially live-z calibration. And since there are users, who send a machine to service to perform 1st layer calibration only, they must not omit the Z-calibration at the start after shipping. --- Firmware/Marlin_main.cpp | 4 ++-- Firmware/eeprom.h | 2 +- Firmware/ultralcd.cpp | 9 +++++++-- 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/Firmware/Marlin_main.cpp b/Firmware/Marlin_main.cpp index cdde3e351..07a0c76d5 100755 --- a/Firmware/Marlin_main.cpp +++ b/Firmware/Marlin_main.cpp @@ -756,7 +756,7 @@ static void factory_reset(char level) lang_reset(); // Force the "Follow calibration flow" message at the next boot up. calibration_status_store(CALIBRATION_STATUS_Z_CALIBRATION); - eeprom_write_byte((uint8_t*)EEPROM_WIZARD_ACTIVE, 1); //run wizard + eeprom_write_byte((uint8_t*)EEPROM_WIZARD_ACTIVE, 2); //run wizard farm_mode = false; eeprom_update_byte((uint8_t*)EEPROM_FARM_MODE, farm_mode); @@ -1564,7 +1564,7 @@ void setup() lcd_show_fullscreen_message_and_wait_P(_i("Old settings found. Default PID, Esteps etc. will be set.")); //if EEPROM version or printer type was changed, inform user that default setting were loaded////MSG_DEFAULT_SETTINGS_LOADED c=20 r=5 Config_StoreSettings(); } - if (eeprom_read_byte((uint8_t*)EEPROM_WIZARD_ACTIVE) == 1) { + if (eeprom_read_byte((uint8_t*)EEPROM_WIZARD_ACTIVE) >= 1) { lcd_wizard(WizState::Run); } if (eeprom_read_byte((uint8_t*)EEPROM_WIZARD_ACTIVE) == 0) { //dont show calibration status messages if wizard is currently active diff --git a/Firmware/eeprom.h b/Firmware/eeprom.h index f9f93b7d8..6fa80aa4c 100644 --- a/Firmware/eeprom.h +++ b/Firmware/eeprom.h @@ -408,7 +408,7 @@ static_assert(sizeof(Sheets) == EEPROM_SHEETS_SIZEOF, "Sizeof(Sheets) is not EEP #define EEPROM_POWER_COUNT (EEPROM_FERROR_COUNT - 1) // uint8 (orig EEPROM_UVLO_MESH_BED_LEVELING-17) #define EEPROM_XYZ_CAL_SKEW (EEPROM_POWER_COUNT - 4) // float for skew backup -#define EEPROM_WIZARD_ACTIVE (EEPROM_XYZ_CAL_SKEW - 1) +#define EEPROM_WIZARD_ACTIVE (EEPROM_XYZ_CAL_SKEW - 1) // 0: wizard not active, 1: wizard active, 2: wizard active without yes/no = forced calibrate Z after shipping/service prep. #define EEPROM_BELTSTATUS_X (EEPROM_WIZARD_ACTIVE - 2) // uint16 #define EEPROM_BELTSTATUS_Y (EEPROM_BELTSTATUS_X - 2) // uint16 diff --git a/Firmware/ultralcd.cpp b/Firmware/ultralcd.cpp index d5c026cbe..610334e58 100755 --- a/Firmware/ultralcd.cpp +++ b/Firmware/ultralcd.cpp @@ -4962,7 +4962,7 @@ void lcd_wizard(WizState state) { using S = WizState; bool end = false; - int wizard_event; + int8_t wizard_event; const char *msg = NULL; // Make sure EEPROM_WIZARD_ACTIVE is true if entering using different entry point // other than WizState::Run - it is useful for debugging wizard. @@ -4986,7 +4986,12 @@ void lcd_wizard(WizState state) // Btw. the flag may even trigger the viper situation on normal start this way and the user won't be able to find out why. saved_printing = false; - wizard_event = lcd_show_multiscreen_message_yes_no_and_wait_P(_i("Hi, I am your Original Prusa i3 printer. Would you like me to guide you through the setup process?"), false, true);////MSG_WIZARD_WELCOME c=20 r=7 + if( eeprom_read_byte((uint8_t*)EEPROM_WIZARD_ACTIVE)==2){ + lcd_show_fullscreen_message_and_wait_P(_i("Hi, I am your Original Prusa i3 printer. I will guide you through a short setup process, in which the Z-axis will be calibrated. Then, you will be ready to print."));////MSG_WIZARD_WELCOME_SHIPPING c=20 r=7 + wizard_event = 1; + } else { + wizard_event = lcd_show_multiscreen_message_yes_no_and_wait_P(_i("Hi, I am your Original Prusa i3 printer. Would you like me to guide you through the setup process?"), false, true);////MSG_WIZARD_WELCOME c=20 r=7 + } if (wizard_event) { state = S::Restore; eeprom_update_byte((uint8_t*)EEPROM_WIZARD_ACTIVE, 1); From a456c4a52df5b78fac43455888f2c7708cc372ca Mon Sep 17 00:00:00 2001 From: "D.R.racer" Date: Wed, 17 Feb 2021 13:04:46 +0100 Subject: [PATCH 12/38] Make watchdogReset() force_inline It makes no sense keeping watchdogReset as a separate function which must be called, since it only contains one instruction: "wdr". Not only was the code larger by 32 bytes in total, but also much slower (call+ret take 4 cycles together for no reason in this case). Surprisingly, doing just this on FW 3.9.3 solves issue #2954 on the one affected EINSY board, even though it makes not much sense (there must be some other timing issue). --- Firmware/optiboot_w25x20cl.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Firmware/optiboot_w25x20cl.cpp b/Firmware/optiboot_w25x20cl.cpp index dce4074e1..2d3a76c72 100644 --- a/Firmware/optiboot_w25x20cl.cpp +++ b/Firmware/optiboot_w25x20cl.cpp @@ -43,7 +43,7 @@ static void watchdogConfig(uint8_t x) { WDTCSR = x; } -static void watchdogReset() { +static FORCE_INLINE void watchdogReset() { __asm__ __volatile__ ( "wdr\n" ); From 2b4cf8d56e964dce43164b41dab2e2fcac0685df Mon Sep 17 00:00:00 2001 From: 3d-gussner <3d.gussner@gmail.com> Date: Wed, 17 Feb 2021 13:52:31 +0100 Subject: [PATCH 13/38] Fix FANCHECK build error --- Firmware/Marlin_main.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Firmware/Marlin_main.cpp b/Firmware/Marlin_main.cpp index 2d456c767..d7fc8f7d0 100755 --- a/Firmware/Marlin_main.cpp +++ b/Firmware/Marlin_main.cpp @@ -8160,9 +8160,11 @@ Sigma_Exit: { if (isPrintPaused) { +#ifdef FANCHECK if((fan_check_error == EFCE_FIXED) || (fan_check_error == EFCE_OK)) lcd_resume_print(); else +#endif //FANCHECK SERIAL_PROTOCOLLNRPGM(MSG_OCTOPRINT_PAUSED); //inform octoprint of pause } } From 4e768057e7cc5449677220b5bddd41acb6ee073b Mon Sep 17 00:00:00 2001 From: "D.R.racer" Date: Wed, 17 Feb 2021 15:59:52 +0100 Subject: [PATCH 14/38] Use standard wdt_reset() from AVR lib which translates to the one `wdr` instruction like before + wrap configuration of watchdog into cli/sei --- Firmware/optiboot_w25x20cl.cpp | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-) diff --git a/Firmware/optiboot_w25x20cl.cpp b/Firmware/optiboot_w25x20cl.cpp index 2d3a76c72..a18c8832d 100644 --- a/Firmware/optiboot_w25x20cl.cpp +++ b/Firmware/optiboot_w25x20cl.cpp @@ -7,6 +7,7 @@ #include "w25x20cl.h" #include "stk500.h" #include "bootapp.h" +#include #define OPTIBOOT_MAJVER 6 #define OPTIBOOT_CUSTOMVER 0 @@ -39,14 +40,10 @@ static unsigned const int __attribute__((section(".version"))) #endif static void watchdogConfig(uint8_t x) { + CRITICAL_SECTION_START WDTCSR = _BV(WDCE) | _BV(WDE); WDTCSR = x; -} - -static FORCE_INLINE void watchdogReset() { - __asm__ __volatile__ ( - "wdr\n" - ); + CRITICAL_SECTION_END } #define RECV_READY ((UCSR0A & _BV(RXC0)) != 0) @@ -63,7 +60,7 @@ static uint8_t getch(void) { * the application "soon", if it keeps happening. (Note that we * don't care that an invalid char is returned...) */ - watchdogReset(); + wdt_reset(); } ch = UDR0; return ch; @@ -117,7 +114,7 @@ uint8_t optiboot_w25x20cl_enter() // Handshake sequence: Initialize the serial line, flush serial line, send magic, receive magic. // If the magic is not received on time, or it is not received correctly, continue to the application. { - watchdogReset(); + wdt_reset(); unsigned long boot_timeout = 2000000; unsigned long boot_timer = 0; const char *ptr = entry_magic_send; @@ -125,7 +122,7 @@ uint8_t optiboot_w25x20cl_enter() const uint8_t selectedSerialPort_bak = selectedSerialPort; // Flush the serial line. while (RECV_READY) { - watchdogReset(); + wdt_reset(); // Dummy register read (discard) (void)(*(char *)UDR0); } @@ -135,14 +132,14 @@ uint8_t optiboot_w25x20cl_enter() // Send the initial magic string. while (ptr != end) putch(pgm_read_byte(ptr ++)); - watchdogReset(); + wdt_reset(); // Wait for two seconds until a magic string (constant entry_magic) is received // from the serial line. ptr = entry_magic_receive; end = strlen_P(entry_magic_receive) + ptr; while (ptr != end) { while (rx_buffer.head == SerialHead) { - watchdogReset(); + wdt_reset(); delayMicroseconds(1); if (++ boot_timer > boot_timeout) { @@ -159,7 +156,7 @@ uint8_t optiboot_w25x20cl_enter() selectedSerialPort = selectedSerialPort_bak; //revert Serial setting return 0; } - watchdogReset(); + wdt_reset(); } cbi(UCSR0B, RXCIE0); //disable the MarlinSerial0 interrupt // Send the cfm magic string. From c1d8e6660b9224d39ab0aaa00ad58d5be65e0970 Mon Sep 17 00:00:00 2001 From: 3d-gussner <3d.gussner@gmail.com> Date: Thu, 18 Feb 2021 10:07:40 +0100 Subject: [PATCH 15/38] Indentations --- Firmware/Marlin_main.cpp | 6 ++-- Firmware/ultralcd.cpp | 71 +++++++++++++--------------------------- 2 files changed, 25 insertions(+), 52 deletions(-) diff --git a/Firmware/Marlin_main.cpp b/Firmware/Marlin_main.cpp index d7fc8f7d0..fd52a2027 100755 --- a/Firmware/Marlin_main.cpp +++ b/Firmware/Marlin_main.cpp @@ -1857,8 +1857,7 @@ void loop() } #ifdef FANCHECK - if (fan_check_error && isPrintPaused && !IS_SD_PRINTING) - { + if (fan_check_error && isPrintPaused && !IS_SD_PRINTING) { KEEPALIVE_STATE(PAUSED_FOR_USER); host_keepalive(); //prevent timeouts since usb processing is disabled until print is resumed. This is for a crude way of pausing a print on all hosts. } @@ -3763,8 +3762,7 @@ There are reasons why some G Codes aren't in numerical order. void process_commands() { #ifdef FANCHECK - if(fan_check_error == EFCE_DETECTED) - { + if(fan_check_error == EFCE_DETECTED) { fan_check_error = EFCE_REPORTED; if (is_usb_printing) lcd_pause_usb_print(); diff --git a/Firmware/ultralcd.cpp b/Firmware/ultralcd.cpp index ed113a27e..bba881c7b 100755 --- a/Firmware/ultralcd.cpp +++ b/Firmware/ultralcd.cpp @@ -1532,8 +1532,7 @@ void lcd_pause_print() stop_and_save_print_to_ram(0.0, -default_retraction); lcd_return_to_status(); isPrintPaused = true; - if (LcdCommands::Idle == lcd_commands_type) - { + if (LcdCommands::Idle == lcd_commands_type) { lcd_commands_type = LcdCommands::LongPause; } SERIAL_PROTOCOLLNRPGM(MSG_OCTOPRINT_PAUSED); @@ -1542,7 +1541,7 @@ void lcd_pause_print() //! @brief Send host action "pause" void lcd_pause_usb_print() { - SERIAL_PROTOCOLLNRPGM(MSG_OCTOPRINT_PAUSE); + SERIAL_PROTOCOLLNRPGM(MSG_OCTOPRINT_PAUSE); } @@ -6665,30 +6664,23 @@ static void lcd_main_menu() MENU_ITEM_FUNCTION_P(PSTR("power panic"), uvlo_); #endif //TMC2130_DEBUG - if ( ( IS_SD_PRINTING || is_usb_printing || (lcd_commands_type == LcdCommands::Layer1Cal)) && (current_position[Z_AXIS] < Z_HEIGHT_HIDE_LIVE_ADJUST_MENU) && !homing_flag && !mesh_bed_leveling_flag) - { + if ( ( IS_SD_PRINTING || is_usb_printing || (lcd_commands_type == LcdCommands::Layer1Cal)) && (current_position[Z_AXIS] < Z_HEIGHT_HIDE_LIVE_ADJUST_MENU) && !homing_flag && !mesh_bed_leveling_flag) { MENU_ITEM_SUBMENU_P(_T(MSG_BABYSTEP_Z), lcd_babystep_z);//8 } if (farm_mode) MENU_ITEM_FUNCTION_P(_T(MSG_FILAMENTCHANGE), lcd_colorprint_change);//8 - if ( moves_planned() || PRINTER_ACTIVE || isPrintPaused ) - { + if ( moves_planned() || PRINTER_ACTIVE || isPrintPaused ) { MENU_ITEM_SUBMENU_P(_i("Tune"), lcd_tune_menu);////MSG_TUNE - } else - { + } else { MENU_ITEM_SUBMENU_P(_i("Preheat"), lcd_preheat_menu);////MSG_PREHEAT } - if (mesh_bed_leveling_flag == false && homing_flag == false && !isPrintPaused) - { - if (is_usb_printing) - { + if (mesh_bed_leveling_flag == false && homing_flag == false && !isPrintPaused) { + if (is_usb_printing) { MENU_ITEM_FUNCTION_P(_T(MSG_PAUSE_PRINT), lcd_pause_usb_print);////MSG_PAUSE_PRINT c=18 - } - else if (IS_SD_PRINTING) - { + } else if (IS_SD_PRINTING) { MENU_ITEM_FUNCTION_P(_T(MSG_PAUSE_PRINT), lcd_pause_print);////MSG_PAUSE_PRINT c=18 } } @@ -6698,27 +6690,20 @@ static void lcd_main_menu() if((fan_check_error == EFCE_FIXED) || (fan_check_error == EFCE_OK)) #endif //FANCHECK { - if (is_usb_printing) - { + if (is_usb_printing) { MENU_ITEM_SUBMENU_P(_T(MSG_RESUME_PRINT), lcd_resume_usb_print);////MSG_RESUME_PRINT c=18 - } - else - { + } else { MENU_ITEM_SUBMENU_P(_T(MSG_RESUME_PRINT), lcd_resume_print);////MSG_RESUME_PRINT c=18 } } } - if((IS_SD_PRINTING || is_usb_printing || isPrintPaused) && (custom_message_type != CustomMsg::MeshBedLeveling)) - { + if((IS_SD_PRINTING || is_usb_printing || isPrintPaused) && (custom_message_type != CustomMsg::MeshBedLeveling)) { MENU_ITEM_SUBMENU_P(_T(MSG_STOP_PRINT), lcd_sdcard_stop); } #ifdef SDSUPPORT //!@todo SDSUPPORT undefined creates several issues in source code - if (card.cardOK || lcd_commands_type == LcdCommands::Layer1Cal) - { - if (!card.isFileOpen()) - { - if (!is_usb_printing && (lcd_commands_type != LcdCommands::Layer1Cal)) - { + if (card.cardOK || lcd_commands_type == LcdCommands::Layer1Cal) { + if (!card.isFileOpen()) { + if (!is_usb_printing && (lcd_commands_type != LcdCommands::Layer1Cal)) { //if (farm_mode) MENU_ITEM_SUBMENU_P(MSG_FARM_CARD_MENU, lcd_farm_sdcard_menu); /*else*/{ bMain=true; // flag ('fake parameter') for 'lcd_sdcard_menu()' function @@ -6729,8 +6714,7 @@ static void lcd_main_menu() MENU_ITEM_GCODE_P(_i("Change SD card"), PSTR("M21")); // SD-card changed by user////MSG_CNG_SDCARD #endif //SDCARDDETECT } - } else - { + } else { bMain=true; // flag (i.e. 'fake parameter') for 'lcd_sdcard_menu()' function MENU_ITEM_SUBMENU_P(_i("No SD card"), lcd_sdcard_menu);////MSG_NO_CARD #if SDCARDDETECT < 1 @@ -6739,23 +6723,18 @@ static void lcd_main_menu() } #endif //SDSUPPORT - if(!isPrintPaused && !IS_SD_PRINTING && !is_usb_printing && (lcd_commands_type != LcdCommands::Layer1Cal)) - { - if (!farm_mode) - { + if(!isPrintPaused && !IS_SD_PRINTING && !is_usb_printing && (lcd_commands_type != LcdCommands::Layer1Cal)) { + if (!farm_mode) { const int8_t sheet = eeprom_read_byte(&(EEPROM_Sheets_base->active_sheet)); const int8_t nextSheet = eeprom_next_initialized_sheet(sheet); - if ((nextSheet >= 0) && (sheet != nextSheet)) // show menu only if we have 2 or more sheets initialized - { + if ((nextSheet >= 0) && (sheet != nextSheet)) { // show menu only if we have 2 or more sheets initialized MENU_ITEM_FUNCTION_E(EEPROM_Sheets_base->s[sheet], eeprom_switch_to_next_sheet); } } } - if ( ! ( IS_SD_PRINTING || is_usb_printing || (lcd_commands_type == LcdCommands::Layer1Cal) ) ) - { - if (mmu_enabled) - { + if ( ! ( IS_SD_PRINTING || is_usb_printing || (lcd_commands_type == LcdCommands::Layer1Cal) ) ) { + if (mmu_enabled) { MENU_ITEM_SUBMENU_P(_T(MSG_LOAD_FILAMENT), fil_load_menu); MENU_ITEM_SUBMENU_P(_i("Load to nozzle"), mmu_load_to_nozzle_menu); //-// MENU_ITEM_FUNCTION_P(_T(MSG_UNLOAD_FILAMENT), extr_unload); @@ -6765,9 +6744,7 @@ static void lcd_main_menu() #ifdef MMU_HAS_CUTTER MENU_ITEM_SUBMENU_P(_T(MSG_CUT_FILAMENT), mmu_cut_filament_menu); #endif //MMU_HAS_CUTTER - } - else - { + } else { #ifdef SNMM MENU_ITEM_SUBMENU_P(_T(MSG_UNLOAD_FILAMENT), fil_unload_menu); MENU_ITEM_SUBMENU_P(_i("Change extruder"), change_extr_menu);////MSG_CHANGE_EXTR c=20 r=1 @@ -6784,15 +6761,13 @@ static void lcd_main_menu() bFilamentFirstRun=true; MENU_ITEM_SUBMENU_P(_T(MSG_UNLOAD_FILAMENT), lcd_unLoadFilament); } - if(!isPrintPaused) - { + if(!isPrintPaused) { MENU_ITEM_SUBMENU_P(_T(MSG_SETTINGS), lcd_settings_menu); MENU_ITEM_SUBMENU_P(_T(MSG_MENU_CALIBRATION), lcd_calibration_menu); } } - if (!is_usb_printing && (lcd_commands_type != LcdCommands::Layer1Cal)) - { + if (!is_usb_printing && (lcd_commands_type != LcdCommands::Layer1Cal)) { MENU_ITEM_SUBMENU_P(_i("Statistics "), lcd_menu_statistics);////MSG_STATISTICS } From 495dcee066966d9ce501917ebbd3c8d962cd14fc Mon Sep 17 00:00:00 2001 From: 3d-gussner <3d.gussner@gmail.com> Date: Thu, 18 Feb 2021 12:09:43 +0100 Subject: [PATCH 16/38] Show LCD Settings during pause --- Firmware/ultralcd.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Firmware/ultralcd.cpp b/Firmware/ultralcd.cpp index 5a96bfc96..32433a695 100755 --- a/Firmware/ultralcd.cpp +++ b/Firmware/ultralcd.cpp @@ -6786,8 +6786,8 @@ static void lcd_main_menu() bFilamentFirstRun=true; MENU_ITEM_SUBMENU_P(_T(MSG_UNLOAD_FILAMENT), lcd_unLoadFilament); } + MENU_ITEM_SUBMENU_P(_T(MSG_SETTINGS), lcd_settings_menu); if(!isPrintPaused) { - MENU_ITEM_SUBMENU_P(_T(MSG_SETTINGS), lcd_settings_menu); MENU_ITEM_SUBMENU_P(_T(MSG_MENU_CALIBRATION), lcd_calibration_menu); } } From 87f416f3034969a9099b4185c68258ad4806a917 Mon Sep 17 00:00:00 2001 From: "D.R.racer" Date: Thu, 18 Feb 2021 15:39:29 +0100 Subject: [PATCH 17/38] Keep wizard flag==2 even when a user restarts during Z-calibration i.e. prevent jumping into the standard wizard if reset during Z- calibration --- Firmware/ultralcd.cpp | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/Firmware/ultralcd.cpp b/Firmware/ultralcd.cpp index 610334e58..09414c1bb 100755 --- a/Firmware/ultralcd.cpp +++ b/Firmware/ultralcd.cpp @@ -4988,17 +4988,16 @@ void lcd_wizard(WizState state) if( eeprom_read_byte((uint8_t*)EEPROM_WIZARD_ACTIVE)==2){ lcd_show_fullscreen_message_and_wait_P(_i("Hi, I am your Original Prusa i3 printer. I will guide you through a short setup process, in which the Z-axis will be calibrated. Then, you will be ready to print."));////MSG_WIZARD_WELCOME_SHIPPING c=20 r=7 - wizard_event = 1; + state = S::Restore; } else { wizard_event = lcd_show_multiscreen_message_yes_no_and_wait_P(_i("Hi, I am your Original Prusa i3 printer. Would you like me to guide you through the setup process?"), false, true);////MSG_WIZARD_WELCOME c=20 r=7 - } - if (wizard_event) { - state = S::Restore; - eeprom_update_byte((uint8_t*)EEPROM_WIZARD_ACTIVE, 1); - } - else { - eeprom_update_byte((uint8_t*)EEPROM_WIZARD_ACTIVE, 0); - end = true; + if (wizard_event) { + state = S::Restore; + eeprom_update_byte((uint8_t*)EEPROM_WIZARD_ACTIVE, 1); + } else { + eeprom_update_byte((uint8_t*)EEPROM_WIZARD_ACTIVE, 0); + end = true; + } } break; case S::Restore: From cbe207eb59ac685ce43a76654feda5d6c3640459 Mon Sep 17 00:00:00 2001 From: 3d-gussner <3d.gussner@gmail.com> Date: Sat, 20 Feb 2021 13:18:53 +0100 Subject: [PATCH 18/38] Fix issue #3037 `starttime` is only set for SD prints via gcode `M24 and M32` --- Firmware/ultralcd.cpp | 40 ++++++++++------------------------------ 1 file changed, 10 insertions(+), 30 deletions(-) diff --git a/Firmware/ultralcd.cpp b/Firmware/ultralcd.cpp index 422566f18..5776e93c8 100755 --- a/Firmware/ultralcd.cpp +++ b/Firmware/ultralcd.cpp @@ -673,8 +673,7 @@ void lcdui_print_time(void) { //if remaining print time estimation is available print it else print elapsed time int chars = 0; - if ((PRINTER_ACTIVE) && (starttime != 0)) - { + if (PRINTER_ACTIVE) { uint16_t print_t = 0; uint16_t print_tr = 0; uint16_t print_tc = 0; @@ -682,31 +681,20 @@ void lcdui_print_time(void) char suff_doubt = ' '; #ifdef TMC2130 - if (SilentModeMenu != SILENT_MODE_OFF) - { + if (SilentModeMenu != SILENT_MODE_OFF) { if (print_time_remaining_silent != PRINT_TIME_REMAINING_INIT) - { print_tr = print_time_remaining_silent; - } //#ifdef CLOCK_INTERVAL_TIME if (print_time_to_change_silent != PRINT_TIME_REMAINING_INIT) - { print_tc = print_time_to_change_silent; - } //#endif //CLOCK_INTERVAL_TIME - } - else - { + } else { #endif //TMC2130 if (print_time_remaining_normal != PRINT_TIME_REMAINING_INIT) - { print_tr = print_time_remaining_normal; - } //#ifdef CLOCK_INTERVAL_TIME if (print_time_to_change_normal != PRINT_TIME_REMAINING_INIT) - { print_tc = print_time_to_change_normal; - } //#endif //CLOCK_INTERVAL_TIME #ifdef TMC2130 } @@ -714,30 +702,22 @@ void lcdui_print_time(void) //#ifdef CLOCK_INTERVAL_TIME if (clock_interval == CLOCK_INTERVAL_TIME*2) - { clock_interval = 0; - } + clock_interval++; - if (print_tc != 0 && clock_interval > CLOCK_INTERVAL_TIME) - { + if (print_tc != 0 && clock_interval > CLOCK_INTERVAL_TIME) { print_t = print_tc; suff = 'C'; - } - else + } else //#endif //CLOCK_INTERVAL_TIME - if (print_tr != 0) - { + if (print_tr != 0) { print_t = print_tr; suff = 'R'; - } - else - { - print_t = _millis() / 60000 - starttime / 60000; - } + } else + print_t = _millis() / 60000 - starttime / 60000; - if (feedmultiply != 100 && (print_t == print_tr || print_t == print_tc)) - { + if (feedmultiply != 100 && (print_t == print_tr || print_t == print_tc)) { suff_doubt = '?'; print_t = 100ul * print_t / feedmultiply; } From 9110ffd4aed47915a6198d71725ac26dc9fa1f99 Mon Sep 17 00:00:00 2001 From: 3d-gussner <3d.gussner@gmail.com> Date: Mon, 22 Feb 2021 16:36:21 +0100 Subject: [PATCH 19/38] Revert `M602` --- Firmware/Marlin_main.cpp | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/Firmware/Marlin_main.cpp b/Firmware/Marlin_main.cpp index ee3dffde6..3beb63410 100755 --- a/Firmware/Marlin_main.cpp +++ b/Firmware/Marlin_main.cpp @@ -8136,14 +8136,7 @@ Sigma_Exit: */ case 602: { - if (isPrintPaused) { -#ifdef FANCHECK - if((fan_check_error == EFCE_FIXED) || (fan_check_error == EFCE_OK)) - lcd_resume_print(); - else -#endif //FANCHECK - SERIAL_PROTOCOLLNRPGM(MSG_OCTOPRINT_PAUSED); //inform octoprint of pause - } + if (isPrintPaused) lcd_resume_print(); } break; From 5894883324a0c51d21da32033b8d2ead41cc9582 Mon Sep 17 00:00:00 2001 From: 3d-gussner <3d.gussner@gmail.com> Date: Mon, 22 Feb 2021 16:37:01 +0100 Subject: [PATCH 20/38] Fix USB/host FAN Error resume Show Settings during Pause also for USB/host prints --- Firmware/ultralcd.cpp | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/Firmware/ultralcd.cpp b/Firmware/ultralcd.cpp index 32433a695..43f32294e 100755 --- a/Firmware/ultralcd.cpp +++ b/Firmware/ultralcd.cpp @@ -6514,8 +6514,11 @@ void lcd_resume_print() { lcd_return_to_status(); lcd_reset_alert_level(); //for fan speed error - if (fan_error_selftest()) return; //abort if error persists - cmdqueue_serial_disabled = false; + if (fan_error_selftest()) { + if (is_usb_printing) SERIAL_PROTOCOLLNRPGM(MSG_OCTOPRINT_PAUSED); + return; //abort if error persists + } + cmdqueue_serial_disabled = false; lcd_setstatuspgm(_T(MSG_FINISHING_MOVEMENTS)); st_synchronize(); custom_message_type = CustomMsg::Resuming; @@ -6786,12 +6789,11 @@ static void lcd_main_menu() bFilamentFirstRun=true; MENU_ITEM_SUBMENU_P(_T(MSG_UNLOAD_FILAMENT), lcd_unLoadFilament); } - MENU_ITEM_SUBMENU_P(_T(MSG_SETTINGS), lcd_settings_menu); - if(!isPrintPaused) { - MENU_ITEM_SUBMENU_P(_T(MSG_MENU_CALIBRATION), lcd_calibration_menu); - } } - + MENU_ITEM_SUBMENU_P(_T(MSG_SETTINGS), lcd_settings_menu); + if(!isPrintPaused && (!(IS_SD_PRINTING || is_usb_printing || (lcd_commands_type == LcdCommands::Layer1Cal)))) { + MENU_ITEM_SUBMENU_P(_T(MSG_MENU_CALIBRATION), lcd_calibration_menu); + } if (!is_usb_printing && (lcd_commands_type != LcdCommands::Layer1Cal)) { MENU_ITEM_SUBMENU_P(_i("Statistics "), lcd_menu_statistics);////MSG_STATISTICS } From fd154e4b69a06e8752da5494a03030e9131170f4 Mon Sep 17 00:00:00 2001 From: 3d-gussner <3d.gussner@gmail.com> Date: Mon, 22 Feb 2021 18:10:43 +0100 Subject: [PATCH 21/38] Again revert Settings --- Firmware/ultralcd.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/Firmware/ultralcd.cpp b/Firmware/ultralcd.cpp index 43f32294e..f9c6199ce 100755 --- a/Firmware/ultralcd.cpp +++ b/Firmware/ultralcd.cpp @@ -6789,11 +6789,10 @@ static void lcd_main_menu() bFilamentFirstRun=true; MENU_ITEM_SUBMENU_P(_T(MSG_UNLOAD_FILAMENT), lcd_unLoadFilament); } - } MENU_ITEM_SUBMENU_P(_T(MSG_SETTINGS), lcd_settings_menu); - if(!isPrintPaused && (!(IS_SD_PRINTING || is_usb_printing || (lcd_commands_type == LcdCommands::Layer1Cal)))) { - MENU_ITEM_SUBMENU_P(_T(MSG_MENU_CALIBRATION), lcd_calibration_menu); + if(!isPrintPaused) MENU_ITEM_SUBMENU_P(_T(MSG_MENU_CALIBRATION), lcd_calibration_menu); } + if (!is_usb_printing && (lcd_commands_type != LcdCommands::Layer1Cal)) { MENU_ITEM_SUBMENU_P(_i("Statistics "), lcd_menu_statistics);////MSG_STATISTICS } From 30b60e44d2e431671e60b5ad156ae3ad1b052380 Mon Sep 17 00:00:00 2001 From: 3d-gussner <3d.gussner@gmail.com> Date: Mon, 22 Feb 2021 18:21:20 +0100 Subject: [PATCH 22/38] `|| isPrintPaused` is already in `PRINTER_ACTIVE` --- Firmware/ultralcd.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Firmware/ultralcd.cpp b/Firmware/ultralcd.cpp index f9c6199ce..9960b0f7f 100755 --- a/Firmware/ultralcd.cpp +++ b/Firmware/ultralcd.cpp @@ -6699,7 +6699,7 @@ static void lcd_main_menu() if (farm_mode) MENU_ITEM_FUNCTION_P(_T(MSG_FILAMENTCHANGE), lcd_colorprint_change);//8 - if ( moves_planned() || PRINTER_ACTIVE || isPrintPaused ) { + if ( moves_planned() || PRINTER_ACTIVE ) { MENU_ITEM_SUBMENU_P(_i("Tune"), lcd_tune_menu);////MSG_TUNE } else { MENU_ITEM_SUBMENU_P(_i("Preheat"), lcd_preheat_menu);////MSG_PREHEAT From 8d4176a5309eb27e39e272820598d968fc4abe9f Mon Sep 17 00:00:00 2001 From: 3d-gussner <3d.gussner@gmail.com> Date: Tue, 23 Feb 2021 07:24:33 +0100 Subject: [PATCH 23/38] Add "Fan check [On|Off]" menu to tune User can en/disable the fan check during print. This is very useful in case of false positive fan errors to let the user to decide to finish print with "faulty" fan. --- Firmware/ultralcd.cpp | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/Firmware/ultralcd.cpp b/Firmware/ultralcd.cpp index 9960b0f7f..5e5bb0389 100755 --- a/Firmware/ultralcd.cpp +++ b/Firmware/ultralcd.cpp @@ -6973,10 +6973,8 @@ static void lcd_tune_menu() SETTINGS_CUTTER; - if(farm_mode) - { - MENU_ITEM_TOGGLE_P(_T(MSG_FANS_CHECK), fans_check_enabled ? _T(MSG_ON) : _T(MSG_OFF), lcd_set_fan_check); - } + MENU_ITEM_TOGGLE_P(_T(MSG_FANS_CHECK), fans_check_enabled ? _T(MSG_ON) : _T(MSG_OFF), lcd_set_fan_check); + #ifdef TMC2130 if(!farm_mode) From fdff5d84b2b77ea896262089a00a197d7a029bec Mon Sep 17 00:00:00 2001 From: 3d-gussner <3d.gussner@gmail.com> Date: Mon, 8 Feb 2021 14:01:35 +0100 Subject: [PATCH 24/38] Move Filament sensors to Support -> Sensor Info --- Firmware/ultralcd.cpp | 97 +++++++++++++++++++++++++------------------ 1 file changed, 56 insertions(+), 41 deletions(-) diff --git a/Firmware/ultralcd.cpp b/Firmware/ultralcd.cpp index 5b7b8f59d..97b80fbb7 100755 --- a/Firmware/ultralcd.cpp +++ b/Firmware/ultralcd.cpp @@ -1613,8 +1613,8 @@ static void pgmtext_with_colon(const char *ipgmLabel, char *dst, uint8_t dstSize //! |01234567890123456789| //! |Nozzle FAN: 0000 RPM| FAN c=10 r=1 SPEED c=3 r=1 //! |Print FAN: 0000 RPM| FAN c=10 r=1 SPEED c=3 r=1 -//! |Fil. Xd:000 Yd:000 | Fil. c=4 r=1 -//! |Int: 000 Shut: 000 | Int: c=4 r=1 Shut: c=4 r=1 +//! | | +//! | | //! ---------------------- //! @endcode //! @todo Positioning of the messages and values on LCD aren't fixed to their exact place. This causes issues with translations. @@ -1628,37 +1628,7 @@ void lcd_menu_extruder_info() // NOT static due to using ins char nozzle[maxChars], print[maxChars]; pgmtext_with_colon(_i("Nozzle FAN"), nozzle, maxChars); ////c=10 r=1 pgmtext_with_colon(_i("Print FAN"), print, maxChars); ////c=10 r=1 - lcd_printf_P(_N("%s %4d RPM\n" "%s %4d RPM\n"), nozzle, 60*fan_speed[0], print, 60*fan_speed[1] ); - -#ifdef PAT9125 - // Display X and Y difference from Filament sensor - // Display Light intensity from Filament sensor - // Frame_Avg register represents the average brightness of all pixels within a frame (324 pixels). This - // value ranges from 0(darkest) to 255(brightest). - // Display LASER shutter time from Filament sensor - // Shutter register is an index of LASER shutter time. It is automatically controlled by the chip's internal - // auto-exposure algorithm. When the chip is tracking on a good reflection surface, the Shutter is small. - // When the chip is tracking on a poor reflection surface, the Shutter is large. Value ranges from 0 to 46. - if (mmu_enabled == false) - { - if (!fsensor_enabled) - lcd_puts_P(_N("Filament sensor\n" "is disabled.")); - else - { - if (!moves_planned() && !IS_SD_PRINTING && !is_usb_printing && (lcd_commands_type != LcdCommands::Layer1Cal)) - pat9125_update(); - lcd_printf_P(_N( - "Fil. Xd:%3d Yd:%3d\n" ////c=4 r=1 - "Int: %3d " ////c=4 r=1 - "Shut: %3d" ////c=4 r=1 - ), - pat9125_x, pat9125_y, - pat9125_b, pat9125_s - ); - } - } -#endif //PAT9125 - + lcd_printf_P(_N("%s %4d RPM\n" "%s %4d RPM\n"), nozzle, 60*fan_speed[0], print, 60*fan_speed[1] ); menu_back_if_clicked(); } @@ -3940,6 +3910,16 @@ static void lcd_print_state(uint8_t state) } } +//! @brief Show sensor state +//! +//! @code{.unparsed} +//! |01234567890123456789| +//! |PINDA N/A FINDA N/A| MSG_PINDA c=6 MSG_FINDA c=6 +//! |Fil. sensor N/A| MSG_FSENSOR +//! |Xd 000 Yd 000| MSG_XD +//! |Int 000 Shut 000| +//! ---------------------- +//! @endcode static void lcd_show_sensors_state() { //0: N/A; 1: OFF; 2: ON @@ -3955,18 +3935,53 @@ static void lcd_show_sensors_state() if (ir_sensor_detected) { idler_state = !READ(IR_SENSOR_PIN); } - lcd_puts_at_P(0, 0, _i("Sensor state")); - lcd_puts_at_P(1, 1, _i("PINDA:")); - lcd_set_cursor(LCD_WIDTH - 4, 1); + //lcd_puts_at_P(0, 0, _i("Sensor state")); + lcd_puts_at_P(0, 0, _i("PINDA")); + lcd_set_cursor(LCD_WIDTH - 14, 0); lcd_print_state(pinda_state); - lcd_puts_at_P(1, 2, _i("FINDA:")); - lcd_set_cursor(LCD_WIDTH - 4, 2); - lcd_print_state(finda_state); + if (mmu_enabled == true) + { + lcd_puts_at_P(10, 0, _i("FINDA")); + lcd_set_cursor(LCD_WIDTH - 3, 0); + lcd_print_state(finda_state); + } - lcd_puts_at_P(1, 3, _i("IR:")); - lcd_set_cursor(LCD_WIDTH - 4, 3); + lcd_puts_at_P(0, 1, _i("Fil. sensor")); + lcd_set_cursor(LCD_WIDTH - 3, 1); lcd_print_state(idler_state); + + +#ifdef PAT9125 + // Display X and Y difference from Filament sensor + // Display Light intensity from Filament sensor + // Frame_Avg register represents the average brightness of all pixels within a frame (324 pixels). This + // value ranges from 0(darkest) to 255(brightest). + // Display LASER shutter time from Filament sensor + // Shutter register is an index of LASER shutter time. It is automatically controlled by the chip's internal + // auto-exposure algorithm. When the chip is tracking on a good reflection surface, the Shutter is small. + // When the chip is tracking on a poor reflection surface, the Shutter is large. Value ranges from 0 to 46. + if (mmu_enabled == false) + { + //if (!fsensor_enabled) + // lcd_puts_P(_N("Filament sensor\n" "is disabled.")); + //else + //{ + if (!moves_planned() && !IS_SD_PRINTING && !is_usb_printing && (lcd_commands_type != LcdCommands::Layer1Cal)) + pat9125_update(); + lcd_set_cursor(0, 2); + lcd_printf_P(_N( + "Xd: %3d " + "Yd: %3d\n" ////c=4 r=1 + "Int: %3d " ////c=4 r=1 + "Shut: %3d" ////c=4 r=1 + ), + pat9125_x, pat9125_y, + pat9125_b, pat9125_s + ); + //} + } +#endif //PAT9125 } void lcd_menu_show_sensors_state() // NOT static due to using inside "Marlin_main" module ("manage_inactivity()") From 95567b807237d304cb4fcb078a68435164296230 Mon Sep 17 00:00:00 2001 From: "D.R.racer" Date: Tue, 23 Feb 2021 11:10:18 +0100 Subject: [PATCH 25/38] Update translations of the Shipping/Service prep welcome msg --- lang/lang_en.txt | 9 +++++++++ lang/lang_en_cz.txt | 12 ++++++++++++ lang/lang_en_de.txt | 12 ++++++++++++ lang/lang_en_es.txt | 12 ++++++++++++ lang/lang_en_fr.txt | 12 ++++++++++++ lang/lang_en_it.txt | 12 ++++++++++++ lang/lang_en_pl.txt | 12 ++++++++++++ 7 files changed, 81 insertions(+) diff --git a/lang/lang_en.txt b/lang/lang_en.txt index 79848fe87..295f8c8df 100644 --- a/lang/lang_en.txt +++ b/lang/lang_en.txt @@ -142,6 +142,9 @@ #MSG_SD_REMOVED "Card removed" +# +"Checking file" + #MSG_NOT_COLOR "Color not correct" @@ -382,6 +385,9 @@ #MSG_LAST_PRINT_FAILURES c=20 "Last print failures" +# +"Hi, I am your Original Prusa i3 printer. I will guide you through a short setup process, in which the Z-axis will be calibrated. Then, you will be ready to print." + # "If you have additional steel sheets, calibrate their presets in Settings - HW Setup - Steel sheets." @@ -871,6 +877,9 @@ # "Unload" +# +"Sheet %.7s\x0aZ offset: %+1.3f mm\x0a%cContinue\x0a%cStart from zero" + #MSG_TOTAL_FAILURES c=20 "Total failures" diff --git a/lang/lang_en_cz.txt b/lang/lang_en_cz.txt index ea2dbc83d..7bc1e6bbe 100644 --- a/lang/lang_en_cz.txt +++ b/lang/lang_en_cz.txt @@ -190,6 +190,10 @@ "Card removed" "Karta vyjmuta" +# +"Checking file" +"\x00" + #MSG_NOT_COLOR "Color not correct" "Barva neni cista" @@ -510,6 +514,10 @@ "Last print failures" "Selhani posl. tisku" +# +"Hi, I am your Original Prusa i3 printer. I will guide you through a short setup process, in which the Z-axis will be calibrated. Then, you will be ready to print." +"Ahoj, jsem vase tiskarna Original Prusa i3. Provedu vas kratkym procesem nastaveni, ve kterem zkalibrujeme osu Z. Pak budete moct zacit tisknout." + # "If you have additional steel sheets, calibrate their presets in Settings - HW Setup - Steel sheets." "Mate-li vice tiskovych platu, kalibrujte je v menu Nastaveni - HW nastaveni - Tiskove platy" @@ -1162,6 +1170,10 @@ "Unload" "Vysunout" +# +"Sheet %.7s\x0aZ offset: %+1.3f mm\x0a%cContinue\x0a%cStart from zero" +"\x00" + #MSG_TOTAL_FAILURES c=20 "Total failures" "Celkem selhani" diff --git a/lang/lang_en_de.txt b/lang/lang_en_de.txt index ffc35678e..402ed9816 100644 --- a/lang/lang_en_de.txt +++ b/lang/lang_en_de.txt @@ -190,6 +190,10 @@ "Card removed" "SD Karte entfernt" +# +"Checking file" +"\x00" + #MSG_NOT_COLOR "Color not correct" "Falsche Farbe" @@ -510,6 +514,10 @@ "Last print failures" "Letzte Druckfehler" +# +"Hi, I am your Original Prusa i3 printer. I will guide you through a short setup process, in which the Z-axis will be calibrated. Then, you will be ready to print." +"Hallo, ich bin Ihr Original Prusa i3 Drucker. Ich werde Sie durch einen kurzen Einrichtungsprozess fuehren, bei dem die Z-Achse kalibriert wird. Danach sind Sie bereit fuer den Druck." + # "If you have additional steel sheets, calibrate their presets in Settings - HW Setup - Steel sheets." "Wenn Sie zusaetzliche Stahlbleche haben, kalibrieren Sie deren Voreinstellungen unter Einstellungen - HW Setup - Stahlbleche." @@ -1162,6 +1170,10 @@ "Unload" "Entladen" +# +"Sheet %.7s\x0aZ offset: %+1.3f mm\x0a%cContinue\x0a%cStart from zero" +"\x00" + #MSG_TOTAL_FAILURES c=20 "Total failures" "Gesamte Fehler" diff --git a/lang/lang_en_es.txt b/lang/lang_en_es.txt index b5bca7656..800bf52da 100644 --- a/lang/lang_en_es.txt +++ b/lang/lang_en_es.txt @@ -190,6 +190,10 @@ "Card removed" "Tarjeta retirada" +# +"Checking file" +"\x00" + #MSG_NOT_COLOR "Color not correct" "Color no homogeneo" @@ -510,6 +514,10 @@ "Last print failures" "Ultimos imp. fallos" +# +"Hi, I am your Original Prusa i3 printer. I will guide you through a short setup process, in which the Z-axis will be calibrated. Then, you will be ready to print." +"Hola, soy tu impresora Original Prusa i3. Te guiare a traves de un breve proceso de configuracion, en el que se calibrara el eje Z. Despues, estaras listo para imprimir." + # "If you have additional steel sheets, calibrate their presets in Settings - HW Setup - Steel sheets." "Si tienes planchas de acero adicionales, calibra sus ajustes en Ajustes - Ajustes HW - Planchas acero." @@ -1162,6 +1170,10 @@ "Unload" "Descargar" +# +"Sheet %.7s\x0aZ offset: %+1.3f mm\x0a%cContinue\x0a%cStart from zero" +"\x00" + #MSG_TOTAL_FAILURES c=20 "Total failures" "Fallos totales" diff --git a/lang/lang_en_fr.txt b/lang/lang_en_fr.txt index 7bd47294e..398083268 100644 --- a/lang/lang_en_fr.txt +++ b/lang/lang_en_fr.txt @@ -190,6 +190,10 @@ "Card removed" "Carte retiree" +# +"Checking file" +"\x00" + #MSG_NOT_COLOR "Color not correct" "Couleur incorrecte" @@ -510,6 +514,10 @@ "Last print failures" "Echecs derniere imp." +# +"Hi, I am your Original Prusa i3 printer. I will guide you through a short setup process, in which the Z-axis will be calibrated. Then, you will be ready to print." +"Bonjour, je suis votre imprimante Original Prusa i3. Je vais vous accompagner au cours d'un bref processus de reglage, qui permettra de calibrer le Z-axis. Apres cela, tout sera pret pour imprimer." + # "If you have additional steel sheets, calibrate their presets in Settings - HW Setup - Steel sheets." "Si vous avez d'autres feuilles d'acier, calibrez leurs pre-reglages dans Reglages - Config HW - Plaque en acier." @@ -1162,6 +1170,10 @@ "Unload" "Decharger" +# +"Sheet %.7s\x0aZ offset: %+1.3f mm\x0a%cContinue\x0a%cStart from zero" +"\x00" + #MSG_TOTAL_FAILURES c=20 "Total failures" "Total des echecs" diff --git a/lang/lang_en_it.txt b/lang/lang_en_it.txt index d4cac7620..6fae68a1b 100644 --- a/lang/lang_en_it.txt +++ b/lang/lang_en_it.txt @@ -190,6 +190,10 @@ "Card removed" "SD rimossa" +# +"Checking file" +"\x00" + #MSG_NOT_COLOR "Color not correct" "Colore non puro" @@ -510,6 +514,10 @@ "Last print failures" "Errori ultima stampa" +# +"Hi, I am your Original Prusa i3 printer. I will guide you through a short setup process, in which the Z-axis will be calibrated. Then, you will be ready to print." +"Ciao, sono la tua stampante Original Prusa i3. Ti guidero attraverso un rapido processo in cui verra calibrato l'asse Z. Poi, sarai pronto a stampare." + # "If you have additional steel sheets, calibrate their presets in Settings - HW Setup - Steel sheets." "Se hai piastre d'acciaio aggiuntive, calibra i preset in Impostazioni - Setup HW - Piastre in Acciaio." @@ -1162,6 +1170,10 @@ "Unload" "Scarica" +# +"Sheet %.7s\x0aZ offset: %+1.3f mm\x0a%cContinue\x0a%cStart from zero" +"\x00" + #MSG_TOTAL_FAILURES c=20 "Total failures" "Totale fallimenti" diff --git a/lang/lang_en_pl.txt b/lang/lang_en_pl.txt index bbdf0aca1..65f25dcd5 100644 --- a/lang/lang_en_pl.txt +++ b/lang/lang_en_pl.txt @@ -190,6 +190,10 @@ "Card removed" "Karta wyjeta" +# +"Checking file" +"\x00" + #MSG_NOT_COLOR "Color not correct" "Kolor zanieczysz." @@ -510,6 +514,10 @@ "Last print failures" "Ostatnie bledy druku" +# +"Hi, I am your Original Prusa i3 printer. I will guide you through a short setup process, in which the Z-axis will be calibrated. Then, you will be ready to print." +"Czesc, jestem Twoja drukarka Original Prusa i3. Przeprowadze Cie przez krotka kalibracje osi Z, po ktorej mozesz rozpoczac drukowanie." + # "If you have additional steel sheets, calibrate their presets in Settings - HW Setup - Steel sheets." "Jesli masz dodatkowe plyty stalowe, to skalibruj ich ustawienia w menu Ustawienia - Ustawienia HW - Plyty stalowe." @@ -1162,6 +1170,10 @@ "Unload" "Rozladuj" +# +"Sheet %.7s\x0aZ offset: %+1.3f mm\x0a%cContinue\x0a%cStart from zero" +"\x00" + #MSG_TOTAL_FAILURES c=20 "Total failures" "Suma bledow" From 734e497cd001ba364221fb97b939125d9c4eb300 Mon Sep 17 00:00:00 2001 From: "D.R.racer" Date: Tue, 23 Feb 2021 15:09:19 +0100 Subject: [PATCH 26/38] Move wizard msgs into messages.h/c + add more translation markers --- Firmware/messages.c | 2 ++ Firmware/messages.h | 2 ++ Firmware/ultralcd.cpp | 4 ++-- lang/lang_en.txt | 2 +- lang/lang_en_cz.txt | 2 +- lang/lang_en_de.txt | 2 +- lang/lang_en_es.txt | 2 +- lang/lang_en_fr.txt | 2 +- lang/lang_en_it.txt | 2 +- lang/lang_en_pl.txt | 2 +- 10 files changed, 13 insertions(+), 9 deletions(-) diff --git a/Firmware/messages.c b/Firmware/messages.c index aa05ad990..8aaa90ec7 100644 --- a/Firmware/messages.c +++ b/Firmware/messages.c @@ -116,6 +116,8 @@ const char MSG_WIZARD_CALIBRATION_FAILED[] PROGMEM_I1 = ISTR("Please check our h const char MSG_WIZARD_DONE[] PROGMEM_I1 = ISTR("All is done. Happy printing!"); ////c=20 r=8 const char MSG_WIZARD_HEATING[] PROGMEM_I1 = ISTR("Preheating nozzle. Please wait."); ////c=20 r=3 const char MSG_WIZARD_QUIT[] PROGMEM_I1 = ISTR("You can always resume the Wizard from Calibration -> Wizard."); ////c=20 r=8 +const char MSG_WIZARD_WELCOME[] PROGMEM_I1 = ISTR("Hi, I am your Original Prusa i3 printer. Would you like me to guide you through the setup process?"); //// c=20 r=7 +const char MSG_WIZARD_WELCOME_SHIPPING[] PROGMEM_I1 = ISTR("Hi, I am your Original Prusa i3 printer. I will guide you through a short setup process, in which the Z-axis will be calibrated. Then, you will be ready to print."); ////c=20 r=16 const char MSG_YES[] PROGMEM_I1 = ISTR("Yes"); //// const char MSG_V2_CALIBRATION[] PROGMEM_I1 = ISTR("First layer cal."); ////c=18 const char WELCOME_MSG[] PROGMEM_I1 = ISTR(CUSTOM_MENDEL_NAME " OK."); ////c=20 diff --git a/Firmware/messages.h b/Firmware/messages.h index a5b672fa2..9fe6da4d3 100644 --- a/Firmware/messages.h +++ b/Firmware/messages.h @@ -116,6 +116,8 @@ extern const char MSG_WIZARD_CALIBRATION_FAILED[]; extern const char MSG_WIZARD_DONE[]; extern const char MSG_WIZARD_HEATING[]; extern const char MSG_WIZARD_QUIT[]; +extern const char MSG_WIZARD_WELCOME[]; +extern const char MSG_WIZARD_WELCOME_SHIPPING[]; extern const char MSG_YES[]; extern const char MSG_V2_CALIBRATION[]; extern const char WELCOME_MSG[]; diff --git a/Firmware/ultralcd.cpp b/Firmware/ultralcd.cpp index 09414c1bb..155640296 100755 --- a/Firmware/ultralcd.cpp +++ b/Firmware/ultralcd.cpp @@ -4987,10 +4987,10 @@ void lcd_wizard(WizState state) saved_printing = false; if( eeprom_read_byte((uint8_t*)EEPROM_WIZARD_ACTIVE)==2){ - lcd_show_fullscreen_message_and_wait_P(_i("Hi, I am your Original Prusa i3 printer. I will guide you through a short setup process, in which the Z-axis will be calibrated. Then, you will be ready to print."));////MSG_WIZARD_WELCOME_SHIPPING c=20 r=7 + lcd_show_fullscreen_message_and_wait_P(MSG_WIZARD_WELCOME_SHIPPING); state = S::Restore; } else { - wizard_event = lcd_show_multiscreen_message_yes_no_and_wait_P(_i("Hi, I am your Original Prusa i3 printer. Would you like me to guide you through the setup process?"), false, true);////MSG_WIZARD_WELCOME c=20 r=7 + wizard_event = lcd_show_multiscreen_message_yes_no_and_wait_P(MSG_WIZARD_WELCOME, false, true); if (wizard_event) { state = S::Restore; eeprom_update_byte((uint8_t*)EEPROM_WIZARD_ACTIVE, 1); diff --git a/lang/lang_en.txt b/lang/lang_en.txt index 295f8c8df..e7e2a2818 100644 --- a/lang/lang_en.txt +++ b/lang/lang_en.txt @@ -385,7 +385,7 @@ #MSG_LAST_PRINT_FAILURES c=20 "Last print failures" -# +#MSG_WIZARD_WELCOME_SHIPPING c=20 r=16 "Hi, I am your Original Prusa i3 printer. I will guide you through a short setup process, in which the Z-axis will be calibrated. Then, you will be ready to print." # diff --git a/lang/lang_en_cz.txt b/lang/lang_en_cz.txt index 7bc1e6bbe..7fbdaf4b2 100644 --- a/lang/lang_en_cz.txt +++ b/lang/lang_en_cz.txt @@ -514,7 +514,7 @@ "Last print failures" "Selhani posl. tisku" -# +#MSG_WIZARD_WELCOME_SHIPPING c=20 r=16 "Hi, I am your Original Prusa i3 printer. I will guide you through a short setup process, in which the Z-axis will be calibrated. Then, you will be ready to print." "Ahoj, jsem vase tiskarna Original Prusa i3. Provedu vas kratkym procesem nastaveni, ve kterem zkalibrujeme osu Z. Pak budete moct zacit tisknout." diff --git a/lang/lang_en_de.txt b/lang/lang_en_de.txt index 402ed9816..3a92a2724 100644 --- a/lang/lang_en_de.txt +++ b/lang/lang_en_de.txt @@ -514,7 +514,7 @@ "Last print failures" "Letzte Druckfehler" -# +#MSG_WIZARD_WELCOME_SHIPPING c=20 r=16 "Hi, I am your Original Prusa i3 printer. I will guide you through a short setup process, in which the Z-axis will be calibrated. Then, you will be ready to print." "Hallo, ich bin Ihr Original Prusa i3 Drucker. Ich werde Sie durch einen kurzen Einrichtungsprozess fuehren, bei dem die Z-Achse kalibriert wird. Danach sind Sie bereit fuer den Druck." diff --git a/lang/lang_en_es.txt b/lang/lang_en_es.txt index 800bf52da..967c6d107 100644 --- a/lang/lang_en_es.txt +++ b/lang/lang_en_es.txt @@ -514,7 +514,7 @@ "Last print failures" "Ultimos imp. fallos" -# +#MSG_WIZARD_WELCOME_SHIPPING c=20 r=16 "Hi, I am your Original Prusa i3 printer. I will guide you through a short setup process, in which the Z-axis will be calibrated. Then, you will be ready to print." "Hola, soy tu impresora Original Prusa i3. Te guiare a traves de un breve proceso de configuracion, en el que se calibrara el eje Z. Despues, estaras listo para imprimir." diff --git a/lang/lang_en_fr.txt b/lang/lang_en_fr.txt index 398083268..9c96b3b1b 100644 --- a/lang/lang_en_fr.txt +++ b/lang/lang_en_fr.txt @@ -514,7 +514,7 @@ "Last print failures" "Echecs derniere imp." -# +#MSG_WIZARD_WELCOME_SHIPPING c=20 r=16 "Hi, I am your Original Prusa i3 printer. I will guide you through a short setup process, in which the Z-axis will be calibrated. Then, you will be ready to print." "Bonjour, je suis votre imprimante Original Prusa i3. Je vais vous accompagner au cours d'un bref processus de reglage, qui permettra de calibrer le Z-axis. Apres cela, tout sera pret pour imprimer." diff --git a/lang/lang_en_it.txt b/lang/lang_en_it.txt index 6fae68a1b..904714889 100644 --- a/lang/lang_en_it.txt +++ b/lang/lang_en_it.txt @@ -514,7 +514,7 @@ "Last print failures" "Errori ultima stampa" -# +#MSG_WIZARD_WELCOME_SHIPPING c=20 r=16 "Hi, I am your Original Prusa i3 printer. I will guide you through a short setup process, in which the Z-axis will be calibrated. Then, you will be ready to print." "Ciao, sono la tua stampante Original Prusa i3. Ti guidero attraverso un rapido processo in cui verra calibrato l'asse Z. Poi, sarai pronto a stampare." diff --git a/lang/lang_en_pl.txt b/lang/lang_en_pl.txt index 65f25dcd5..3b2d9e882 100644 --- a/lang/lang_en_pl.txt +++ b/lang/lang_en_pl.txt @@ -514,7 +514,7 @@ "Last print failures" "Ostatnie bledy druku" -# +#MSG_WIZARD_WELCOME_SHIPPING c=20 r=16 "Hi, I am your Original Prusa i3 printer. I will guide you through a short setup process, in which the Z-axis will be calibrated. Then, you will be ready to print." "Czesc, jestem Twoja drukarka Original Prusa i3. Przeprowadze Cie przez krotka kalibracje osi Z, po ktorej mozesz rozpoczac drukowanie." From 08a6a4b25e02a450ae0cb3432f8395d2031ddc1f Mon Sep 17 00:00:00 2001 From: 3d-gussner <3d.gussner@gmail.com> Date: Tue, 23 Feb 2021 15:19:03 +0100 Subject: [PATCH 27/38] Enable Filament sensor action during print even if in Support::Sensor info --- Firmware/Marlin_main.cpp | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/Firmware/Marlin_main.cpp b/Firmware/Marlin_main.cpp index 2db85d01a..e43501994 100755 --- a/Firmware/Marlin_main.cpp +++ b/Firmware/Marlin_main.cpp @@ -9690,7 +9690,7 @@ void manage_inactivity_IR_ANALOG_Check(uint16_t &nFSCheckCount, ClFsensorPCB isV void manage_inactivity(bool ignore_stepper_queue/*=false*/) //default argument set in Marlin.h { #ifdef FILAMENT_SENSOR -bool bInhibitFlag; +bool bInhibitFlag = false; #ifdef IR_SENSOR_ANALOG static uint16_t nFSCheckCount=0; #endif // IR_SENSOR_ANALOG @@ -9698,16 +9698,11 @@ static uint16_t nFSCheckCount=0; if (mmu_enabled == false) { //-// if (mcode_in_progress != 600) //M600 not in progress -#ifdef PAT9125 - bInhibitFlag=(menu_menu==lcd_menu_extruder_info); // Support::ExtruderInfo menu active -#endif // PAT9125 -#ifdef IR_SENSOR - bInhibitFlag=(menu_menu==lcd_menu_show_sensors_state); // Support::SensorInfo menu active + if (!PRINTER_ACTIVE) bInhibitFlag=(menu_menu==lcd_menu_show_sensors_state); //Block Filament sensor actions if PRINTER is not active and Support::SensorInfo menu active #ifdef IR_SENSOR_ANALOG - bInhibitFlag=bInhibitFlag||bMenuFSDetect; // Settings::HWsetup::FSdetect menu active + bInhibitFlag=bInhibitFlag||bMenuFSDetect; // Block Filament sensor actions if Settings::HWsetup::FSdetect menu active #endif // IR_SENSOR_ANALOG -#endif // IR_SENSOR - if ((mcode_in_progress != 600) && (eFilamentAction != FilamentAction::AutoLoad) && (!bInhibitFlag) && (menu_menu != lcd_move_e)) //M600 not in progress, preHeat @ autoLoad menu not active, Support::ExtruderInfo/SensorInfo menu not active + if ((mcode_in_progress != 600) && (eFilamentAction != FilamentAction::AutoLoad) && (!bInhibitFlag) && (menu_menu != lcd_move_e)) //M600 not in progress, preHeat @ autoLoad menu not active { if (!moves_planned() && !IS_SD_PRINTING && !is_usb_printing && (lcd_commands_type != LcdCommands::Layer1Cal) && ! eeprom_read_byte((uint8_t*)EEPROM_WIZARD_ACTIVE)) { From 076613fd979b554cd2315424a7a06047ea1da0e0 Mon Sep 17 00:00:00 2001 From: 3d-gussner <3d.gussner@gmail.com> Date: Tue, 23 Feb 2021 15:20:08 +0100 Subject: [PATCH 28/38] Show `Fil. sensor` in Support::Sensor info only if IR Sensor detected --- Firmware/ultralcd.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/Firmware/ultralcd.cpp b/Firmware/ultralcd.cpp index 97b80fbb7..4e70910f7 100755 --- a/Firmware/ultralcd.cpp +++ b/Firmware/ultralcd.cpp @@ -3932,9 +3932,6 @@ static void lcd_show_sensors_state() { finda_state = mmu_finda; } - if (ir_sensor_detected) { - idler_state = !READ(IR_SENSOR_PIN); - } //lcd_puts_at_P(0, 0, _i("Sensor state")); lcd_puts_at_P(0, 0, _i("PINDA")); lcd_set_cursor(LCD_WIDTH - 14, 0); @@ -3947,9 +3944,12 @@ static void lcd_show_sensors_state() lcd_print_state(finda_state); } - lcd_puts_at_P(0, 1, _i("Fil. sensor")); - lcd_set_cursor(LCD_WIDTH - 3, 1); - lcd_print_state(idler_state); + if (ir_sensor_detected) { + idler_state = !READ(IR_SENSOR_PIN); + lcd_puts_at_P(0, 1, _i("Fil. sensor")); + lcd_set_cursor(LCD_WIDTH - 3, 1); + lcd_print_state(idler_state); + } #ifdef PAT9125 From fbca8cbe280e90f82daef9bd9bd87c7f0a6b7139 Mon Sep 17 00:00:00 2001 From: "D.R.racer" Date: Tue, 23 Feb 2021 15:31:36 +0100 Subject: [PATCH 29/38] Remove unrelated (but still missing) translations This needs to be fixed in 3.10 final. Rumors say some of the translation scripts even fail on a message containing both % and a backslash --- lang/lang_en_cz.txt | 4 ---- lang/lang_en_de.txt | 4 ---- lang/lang_en_es.txt | 4 ---- lang/lang_en_fr.txt | 4 ---- lang/lang_en_it.txt | 4 ---- lang/lang_en_pl.txt | 4 ---- 6 files changed, 24 deletions(-) diff --git a/lang/lang_en_cz.txt b/lang/lang_en_cz.txt index 7fbdaf4b2..c17e7a25e 100644 --- a/lang/lang_en_cz.txt +++ b/lang/lang_en_cz.txt @@ -1170,10 +1170,6 @@ "Unload" "Vysunout" -# -"Sheet %.7s\x0aZ offset: %+1.3f mm\x0a%cContinue\x0a%cStart from zero" -"\x00" - #MSG_TOTAL_FAILURES c=20 "Total failures" "Celkem selhani" diff --git a/lang/lang_en_de.txt b/lang/lang_en_de.txt index 3a92a2724..546d8c508 100644 --- a/lang/lang_en_de.txt +++ b/lang/lang_en_de.txt @@ -1170,10 +1170,6 @@ "Unload" "Entladen" -# -"Sheet %.7s\x0aZ offset: %+1.3f mm\x0a%cContinue\x0a%cStart from zero" -"\x00" - #MSG_TOTAL_FAILURES c=20 "Total failures" "Gesamte Fehler" diff --git a/lang/lang_en_es.txt b/lang/lang_en_es.txt index 967c6d107..0876416e9 100644 --- a/lang/lang_en_es.txt +++ b/lang/lang_en_es.txt @@ -1170,10 +1170,6 @@ "Unload" "Descargar" -# -"Sheet %.7s\x0aZ offset: %+1.3f mm\x0a%cContinue\x0a%cStart from zero" -"\x00" - #MSG_TOTAL_FAILURES c=20 "Total failures" "Fallos totales" diff --git a/lang/lang_en_fr.txt b/lang/lang_en_fr.txt index 9c96b3b1b..a5bb4852e 100644 --- a/lang/lang_en_fr.txt +++ b/lang/lang_en_fr.txt @@ -1170,10 +1170,6 @@ "Unload" "Decharger" -# -"Sheet %.7s\x0aZ offset: %+1.3f mm\x0a%cContinue\x0a%cStart from zero" -"\x00" - #MSG_TOTAL_FAILURES c=20 "Total failures" "Total des echecs" diff --git a/lang/lang_en_it.txt b/lang/lang_en_it.txt index 904714889..e57d56e90 100644 --- a/lang/lang_en_it.txt +++ b/lang/lang_en_it.txt @@ -1170,10 +1170,6 @@ "Unload" "Scarica" -# -"Sheet %.7s\x0aZ offset: %+1.3f mm\x0a%cContinue\x0a%cStart from zero" -"\x00" - #MSG_TOTAL_FAILURES c=20 "Total failures" "Totale fallimenti" diff --git a/lang/lang_en_pl.txt b/lang/lang_en_pl.txt index 3b2d9e882..35f6215f6 100644 --- a/lang/lang_en_pl.txt +++ b/lang/lang_en_pl.txt @@ -1170,10 +1170,6 @@ "Unload" "Rozladuj" -# -"Sheet %.7s\x0aZ offset: %+1.3f mm\x0a%cContinue\x0a%cStart from zero" -"\x00" - #MSG_TOTAL_FAILURES c=20 "Total failures" "Suma bledow" From 03bd9276e2cee8ef498fcec840753ba6badbd924 Mon Sep 17 00:00:00 2001 From: "D.R.racer" Date: Tue, 23 Feb 2021 15:33:15 +0100 Subject: [PATCH 30/38] Remove unrelated translations from master lang_en.txt as well --- lang/lang_en.txt | 3 --- 1 file changed, 3 deletions(-) diff --git a/lang/lang_en.txt b/lang/lang_en.txt index e7e2a2818..4225db76e 100644 --- a/lang/lang_en.txt +++ b/lang/lang_en.txt @@ -877,9 +877,6 @@ # "Unload" -# -"Sheet %.7s\x0aZ offset: %+1.3f mm\x0a%cContinue\x0a%cStart from zero" - #MSG_TOTAL_FAILURES c=20 "Total failures" From c241adec5f732a6592f3899dbd8fc5c871dec426 Mon Sep 17 00:00:00 2001 From: Yuri D'Elia Date: Tue, 16 Jul 2019 16:17:52 +0200 Subject: [PATCH 31/38] Ensure babystep_apply|undo always uses the planner The code around these calls _requires_ that the steps are immediately processed and/or added to the subsequent planner moves. The only part that doesn't care about immediate insertion is the direct user-insertion though the lcd encoder. --- Firmware/Marlin_main.cpp | 6 ++---- Firmware/mesh_bed_calibration.cpp | 10 ---------- 2 files changed, 2 insertions(+), 14 deletions(-) diff --git a/Firmware/Marlin_main.cpp b/Firmware/Marlin_main.cpp index d5b4ff106..fc470f604 100755 --- a/Firmware/Marlin_main.cpp +++ b/Firmware/Marlin_main.cpp @@ -2722,8 +2722,7 @@ static void gcode_G28(bool home_x_axis, long home_x_value, bool home_y_axis, lon current_position[Z_AXIS] = st_get_position_mm(Z_AXIS); #endif - // Reset baby stepping to zero, if the babystepping has already been loaded before. The babystepsTodo value will be - // consumed during the first movements following this statement. + // Reset baby stepping to zero, if the babystepping has already been loaded before. if (home_z) babystep_undo(); @@ -5161,8 +5160,7 @@ if(eSoundMode!=e_SOUND_MODE_SILENT) mbl.reset(); //reset mesh bed leveling - // Reset baby stepping to zero, if the babystepping has already been loaded before. The babystepsTodo value will be - // consumed during the first movements following this statement. + // Reset baby stepping to zero, if the babystepping has already been loaded before. babystep_undo(); // Cycle through all points and probe them diff --git a/Firmware/mesh_bed_calibration.cpp b/Firmware/mesh_bed_calibration.cpp index fb79022ff..b4490e93f 100644 --- a/Firmware/mesh_bed_calibration.cpp +++ b/Firmware/mesh_bed_calibration.cpp @@ -3030,8 +3030,6 @@ static void shift_z(float delta) plan_set_z_position(current_position[Z_AXIS]); } -#define BABYSTEP_LOADZ_BY_PLANNER - // Number of baby steps applied static int babystepLoadZ = 0; @@ -3062,20 +3060,12 @@ void babystep_load() void babystep_apply() { babystep_load(); -#ifdef BABYSTEP_LOADZ_BY_PLANNER shift_z(- float(babystepLoadZ) / float(cs.axis_steps_per_unit[Z_AXIS])); -#else - babystepsTodoZadd(babystepLoadZ); -#endif /* BABYSTEP_LOADZ_BY_PLANNER */ } void babystep_undo() { -#ifdef BABYSTEP_LOADZ_BY_PLANNER shift_z(float(babystepLoadZ) / float(cs.axis_steps_per_unit[Z_AXIS])); -#else - babystepsTodoZsubtract(babystepLoadZ); -#endif /* BABYSTEP_LOADZ_BY_PLANNER */ babystepLoadZ = 0; } From ff4e53d2d11a614045e111f10d8fcba900c311dc Mon Sep 17 00:00:00 2001 From: Yuri D'Elia Date: Tue, 16 Jul 2019 17:28:28 +0200 Subject: [PATCH 32/38] Prevent babysteps in more unsafe situations through homing_flag Further restrict babystep insertion when the lcd_update is enabled by toggling homing_flag when probing Z (where Z shouldn't be touched anyway as it would disrupt the measurement) Also reset the encoder value during mesh leveling. --- Firmware/Marlin_main.cpp | 7 ++++++- Firmware/ultralcd.cpp | 2 +- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/Firmware/Marlin_main.cpp b/Firmware/Marlin_main.cpp index fc470f604..23a734d77 100755 --- a/Firmware/Marlin_main.cpp +++ b/Firmware/Marlin_main.cpp @@ -4753,6 +4753,7 @@ if(eSoundMode!=e_SOUND_MODE_SILENT) */ case 30: { + homing_flag = true; st_synchronize(); // TODO: make sure the bed_level_rotation_matrix is identity or the planner will get set incorectly int l_feedmultiply = setup_for_endstop_move(); @@ -4764,6 +4765,7 @@ if(eSoundMode!=e_SOUND_MODE_SILENT) printf_P(_N("%S X: %.5f Y: %.5f Z: %.5f\n"), _T(MSG_BED), _x, _y, _z); clean_up_after_endstop_move(l_feedmultiply); + homing_flag = false; } break; @@ -4854,6 +4856,8 @@ if(eSoundMode!=e_SOUND_MODE_SILENT) break; } } + + homing_flag = true; // keep homing on to avoid babystepping while the LCD is enabled lcd_update_enable(true); KEEPALIVE_STATE(NOT_BUSY); //no need to print busy messages as we print current temperatures periodicaly SERIAL_ECHOLNPGM("PINDA probe calibration start"); @@ -4898,6 +4902,7 @@ if(eSoundMode!=e_SOUND_MODE_SILENT) bool find_z_result = find_bed_induction_sensor_point_z(-1.f); if (find_z_result == false) { lcd_temp_cal_show_result(find_z_result); + homing_flag = false; break; } zero_z = current_position[Z_AXIS]; @@ -4948,9 +4953,9 @@ if(eSoundMode!=e_SOUND_MODE_SILENT) printf_P(_N("\nPINDA temperature: %.1f Z shift (mm): %.3f"), current_temperature_pinda, current_position[Z_AXIS] - zero_z); EEPROM_save_B(EEPROM_PROBE_TEMP_SHIFT + i * 2, &z_shift); - } lcd_temp_cal_show_result(true); + homing_flag = false; #else //PINDA_THERMISTOR diff --git a/Firmware/ultralcd.cpp b/Firmware/ultralcd.cpp index 7f4cfa648..684ec5178 100755 --- a/Firmware/ultralcd.cpp +++ b/Firmware/ultralcd.cpp @@ -3108,7 +3108,7 @@ static void lcd_babystep_z() if (lcd_encoder != 0) { - if (homing_flag) lcd_encoder = 0; + if (homing_flag || mesh_bed_leveling_flag) lcd_encoder = 0; _md->babystepMemZ += (int)lcd_encoder; if (_md->babystepMemZ < Z_BABYSTEP_MIN) _md->babystepMemZ = Z_BABYSTEP_MIN; //-3999 -> -9.99 mm From f5e419530b9bbce689eb2aa7320d85360eb019dd Mon Sep 17 00:00:00 2001 From: Yuri D'Elia Date: Tue, 16 Jul 2019 21:17:37 +0200 Subject: [PATCH 33/38] Inhibit LiveZ from the settings menu during mesh bed leveling --- Firmware/ultralcd.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Firmware/ultralcd.cpp b/Firmware/ultralcd.cpp index 684ec5178..25cd55d93 100755 --- a/Firmware/ultralcd.cpp +++ b/Firmware/ultralcd.cpp @@ -5789,7 +5789,7 @@ static void lcd_settings_menu() MENU_ITEM_TOGGLE_P(_T(MSG_RPI_PORT), (selectedSerialPort == 0) ? _T(MSG_OFF) : _T(MSG_ON), lcd_second_serial_set); #endif //HAS_SECOND_SERIAL - if (!isPrintPaused && !homing_flag) + if (!isPrintPaused && !homing_flag && !mesh_bed_leveling_flag) MENU_ITEM_SUBMENU_P(_T(MSG_BABYSTEP_Z), lcd_babystep_z); #if (LANG_MODE != 0) From 019c818c05466ea9d8ce66bbd5e1d8cc660cc650 Mon Sep 17 00:00:00 2001 From: Yuri D'Elia Date: Sun, 2 Aug 2020 01:36:24 +0200 Subject: [PATCH 34/38] Insert babysteps using CRITICAL_SECTION instead of cli/sei --- Firmware/temperature.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Firmware/temperature.cpp b/Firmware/temperature.cpp index 3a70da21a..35b05f0e8 100755 --- a/Firmware/temperature.cpp +++ b/Firmware/temperature.cpp @@ -2047,18 +2047,18 @@ FORCE_INLINE static void temperature_isr() if(curTodo>0) { - asm("cli"); + CRITICAL_SECTION_START; babystep(axis,/*fwd*/true); babystepsTodo[axis]--; //less to do next time - asm("sei"); + CRITICAL_SECTION_END; } else if(curTodo<0) { - asm("cli"); + CRITICAL_SECTION_START; babystep(axis,/*fwd*/false); babystepsTodo[axis]++; //less to do next time - asm("sei"); + CRITICAL_SECTION_END; } } #endif //BABYSTEPPING From 28e9c814fc4392a2a99a32ecd84e66b3c98f4656 Mon Sep 17 00:00:00 2001 From: Yuri D'Elia Date: Fri, 29 Jan 2021 19:05:32 +0100 Subject: [PATCH 35/38] Remove code duplication for babystep insertion --- Firmware/temperature.h | 19 +++++-------------- Firmware/ultralcd.cpp | 7 +------ 2 files changed, 6 insertions(+), 20 deletions(-) diff --git a/Firmware/temperature.h b/Firmware/temperature.h index da88a53c0..0bf944724 100755 --- a/Firmware/temperature.h +++ b/Firmware/temperature.h @@ -99,13 +99,10 @@ extern bool bedPWMDisabled; float unscalePID_d(float d); #endif - - -#ifdef BABYSTEPPING - extern volatile int babystepsTodo[3]; -#endif -void resetPID(uint8_t extruder); + +#ifdef BABYSTEPPING +extern volatile int babystepsTodo[3]; inline void babystepsTodoZadd(int n) { @@ -115,15 +112,9 @@ inline void babystepsTodoZadd(int n) CRITICAL_SECTION_END } } +#endif -inline void babystepsTodoZsubtract(int n) -{ - if (n != 0) { - CRITICAL_SECTION_START - babystepsTodo[Z_AXIS] -= n; - CRITICAL_SECTION_END - } -} +void resetPID(uint8_t extruder); //high level conversion routines, for use outside of temperature.cpp //inline so that there is no performance decrease. diff --git a/Firmware/ultralcd.cpp b/Firmware/ultralcd.cpp index 25cd55d93..d7c7a25d9 100755 --- a/Firmware/ultralcd.cpp +++ b/Firmware/ultralcd.cpp @@ -3113,12 +3113,7 @@ static void lcd_babystep_z() if (_md->babystepMemZ < Z_BABYSTEP_MIN) _md->babystepMemZ = Z_BABYSTEP_MIN; //-3999 -> -9.99 mm else if (_md->babystepMemZ > Z_BABYSTEP_MAX) _md->babystepMemZ = Z_BABYSTEP_MAX; //0 - else - { - CRITICAL_SECTION_START - babystepsTodo[Z_AXIS] += (int)lcd_encoder; - CRITICAL_SECTION_END - } + else babystepsTodoZadd(lcd_encoder); _md->babystepMemMMZ = _md->babystepMemZ/cs.axis_steps_per_unit[Z_AXIS]; _delay(50); From 14a1a93bc84fcccf5aa7ee793f809b10c54006c5 Mon Sep 17 00:00:00 2001 From: Yuri D'Elia Date: Wed, 24 Feb 2021 16:57:33 +0100 Subject: [PATCH 36/38] Include probing/MBL in the PRINTER_ACTIVE check This prevents to perform disruptive actions during homing or between MBL probes, which would result in a failure. --- Firmware/Marlin.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Firmware/Marlin.h b/Firmware/Marlin.h index a1b6fe4eb..cc2766b44 100755 --- a/Firmware/Marlin.h +++ b/Firmware/Marlin.h @@ -377,7 +377,7 @@ extern uint16_t gcode_in_progress; extern LongTimer safetyTimer; #define PRINT_PERCENT_DONE_INIT 0xff -#define PRINTER_ACTIVE (IS_SD_PRINTING || is_usb_printing || isPrintPaused || (custom_message_type == CustomMsg::TempCal) || saved_printing || (lcd_commands_type == LcdCommands::Layer1Cal) || mmu_print_saved) +#define PRINTER_ACTIVE (IS_SD_PRINTING || is_usb_printing || isPrintPaused || (custom_message_type == CustomMsg::TempCal) || saved_printing || (lcd_commands_type == LcdCommands::Layer1Cal) || mmu_print_saved || homing_flag || mesh_bed_leveling_flag) //! Beware - mcode_in_progress is set as soon as the command gets really processed, //! which is not the same as posting the M600 command into the command queue From b4f5633bde4d73105bc9ad9dba746353afc81b59 Mon Sep 17 00:00:00 2001 From: Yuri D'Elia Date: Wed, 24 Feb 2021 16:59:22 +0100 Subject: [PATCH 37/38] Enable "Move axis" and "Disable steppers" only when idle Move axis queues movements, which disrupts a normal print, homing (when XY is combined) or MBL. Likewise, "Disable steppers" only makes sense when the printer is fully idle. Only allow such actions when the printer is not active and/or in the paused state. --- Firmware/ultralcd.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Firmware/ultralcd.cpp b/Firmware/ultralcd.cpp index d7c7a25d9..833eddc39 100755 --- a/Firmware/ultralcd.cpp +++ b/Firmware/ultralcd.cpp @@ -5747,10 +5747,12 @@ static void lcd_settings_menu() MENU_ITEM_BACK_P(_T(MSG_MAIN)); MENU_ITEM_SUBMENU_P(_i("Temperature"), lcd_control_temperature_menu);////MSG_TEMPERATURE - if (!homing_flag) + + if (!PRINTER_ACTIVE || isPrintPaused) + { MENU_ITEM_SUBMENU_P(_i("Move axis"), lcd_move_menu_1mm);////MSG_MOVE_AXIS - if (!isPrintPaused) MENU_ITEM_GCODE_P(_i("Disable steppers"), PSTR("M84"));////MSG_DISABLE_STEPPERS + } SETTINGS_FILAMENT_SENSOR; From e8f6c9fac91f0ad808ef8a8ee62f5b5466f5aeab Mon Sep 17 00:00:00 2001 From: Yuri D'Elia Date: Wed, 24 Feb 2021 17:01:45 +0100 Subject: [PATCH 38/38] Exit the _lcd_move* menus when homing/leveling Instead of resetting the encoder status when homing or leveling, simply exit the move/liveZ menu. When transitioning from idle->printing, axis move shouldn't be allowed as it would insert moves during a print. This is always wrong. The menu must be always dismissed. Instead of checking all places where the menu could be active, automatically dimiss the menu from within _lcd_move when homing/MBL is happening. The long-push function and the settings menu checks if "axis move" is possible, and thus prevent the user to re-enter the menu already. When doing the first layer calibration, the _lcd_babystep_z is automatically brought back after MBL has completed. Technically we should do the same when entering/exiting the paused state in _lcd_move. However, it's better to dismiss _any_ menu in stop_and_save_print_to_ram/restore_print_from_ram_and_continue instead. To be done later... --- Firmware/ultralcd.cpp | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/Firmware/ultralcd.cpp b/Firmware/ultralcd.cpp index 833eddc39..0117cca8a 100755 --- a/Firmware/ultralcd.cpp +++ b/Firmware/ultralcd.cpp @@ -2850,6 +2850,13 @@ void lcd_menu_statistics() static void _lcd_move(const char *name, int axis, int min, int max) { + if (homing_flag || mesh_bed_leveling_flag) + { + // printer entered a new state where axis move is forbidden + menu_back(); + return; + } + typedef struct { // 2bytes total bool initialized; // 1byte @@ -3071,6 +3078,13 @@ static void lcd_move_z() { */ static void lcd_babystep_z() { + if (homing_flag || mesh_bed_leveling_flag) + { + // printer changed to a new state where live Z is forbidden + menu_back(); + return; + } + typedef struct { int8_t status; @@ -3106,9 +3120,8 @@ static void lcd_babystep_z() lcd_timeoutToStatus.start(); } - if (lcd_encoder != 0) + if (lcd_encoder != 0) { - if (homing_flag || mesh_bed_leveling_flag) lcd_encoder = 0; _md->babystepMemZ += (int)lcd_encoder; if (_md->babystepMemZ < Z_BABYSTEP_MIN) _md->babystepMemZ = Z_BABYSTEP_MIN; //-3999 -> -9.99 mm