diff --git a/Marlin/src/feature/leds/printer_event_leds.h b/Marlin/src/feature/leds/printer_event_leds.h index 3a037eba96e5..856826b969e3 100644 --- a/Marlin/src/feature/leds/printer_event_leds.h +++ b/Marlin/src/feature/leds/printer_event_leds.h @@ -56,7 +56,7 @@ class PrinterEventLEDs { #if HAS_TEMP_HOTEND || HAS_HEATED_BED || HAS_HEATED_CHAMBER static void onHeatingDone() { leds.set_white(); } - static void onPidTuningDone(LEDColor c) { leds.set_color(c); } + static void onPIDTuningDone(LEDColor c) { leds.set_color(c); } #endif #if HAS_MEDIA diff --git a/Marlin/src/feature/pause.h b/Marlin/src/feature/pause.h index 304c8a611d13..b86f86b633a9 100644 --- a/Marlin/src/feature/pause.h +++ b/Marlin/src/feature/pause.h @@ -52,10 +52,14 @@ enum PauseMessage : char { PAUSE_MESSAGE_RESUME, PAUSE_MESSAGE_HEAT, PAUSE_MESSAGE_HEATING, - PAUSE_MESSAGE_STATUS + PAUSE_MESSAGE_STATUS, + PAUSE_MESSAGE_COUNT }; #if M600_PURGE_MORE_RESUMABLE + /** + * Input methods can Purge More, Resume, or request input + */ enum PauseMenuResponse : char { PAUSE_RESPONSE_WAIT_FOR, PAUSE_RESPONSE_EXTRUDE_MORE, diff --git a/Marlin/src/gcode/temp/M303.cpp b/Marlin/src/gcode/temp/M303.cpp index f9f3abc5bd4e..24702d65f099 100644 --- a/Marlin/src/gcode/temp/M303.cpp +++ b/Marlin/src/gcode/temp/M303.cpp @@ -68,7 +68,7 @@ void GcodeSuite::M303() { default: SERIAL_ECHOPGM(STR_PID_AUTOTUNE); SERIAL_ECHOLNPGM(STR_PID_BAD_HEATER_ID); - TERN_(EXTENSIBLE_UI, ExtUI::onPidTuning(ExtUI::result_t::PID_BAD_HEATER_ID)); + TERN_(EXTENSIBLE_UI, ExtUI::onPIDTuning(ExtUI::result_t::PID_BAD_HEATER_ID)); TERN_(PROUI_PID_TUNE, dwinPidTuning(PID_BAD_HEATER_ID)); return; } diff --git a/Marlin/src/lcd/dogm/status_screen_lite_ST7920.cpp b/Marlin/src/lcd/dogm/status_screen_lite_ST7920.cpp index 4eb031e5385a..a9e8bb564600 100644 --- a/Marlin/src/lcd/dogm/status_screen_lite_ST7920.cpp +++ b/Marlin/src/lcd/dogm/status_screen_lite_ST7920.cpp @@ -886,7 +886,7 @@ void ST7920_Lite_Status_Screen::update_status_or_position(bool forceUpdate) { * If STATUS_EXPIRE_SECONDS is zero, only the status is shown. */ if (forceUpdate || status_changed()) { - TERN_(STATUS_MESSAGE_SCROLLING, ui.status_scroll_offset = 0); + TERN_(STATUS_MESSAGE_SCROLLING, ui.reset_status_scroll()); #if STATUS_EXPIRE_SECONDS countdown = !ui.status_message.empty() ? STATUS_EXPIRE_SECONDS : 0; #endif diff --git a/Marlin/src/lcd/e3v2/common/dwin_api.h b/Marlin/src/lcd/e3v2/common/dwin_api.h index fe2105baea07..dd4fccbcc5ff 100644 --- a/Marlin/src/lcd/e3v2/common/dwin_api.h +++ b/Marlin/src/lcd/e3v2/common/dwin_api.h @@ -23,6 +23,12 @@ #include "../../../inc/MarlinConfig.h" +// +// e3v2/common/dwin_api.h +// +// Included by: e3v2/*/dwin_lcd.h +// + #if ENABLED(DWIN_MARLINUI_LANDSCAPE) #define DWIN_WIDTH 480 #define DWIN_HEIGHT 272 diff --git a/Marlin/src/lcd/e3v2/common/dwin_font.h b/Marlin/src/lcd/e3v2/common/dwin_font.h index b92bfcf99c9f..a0becfc32522 100644 --- a/Marlin/src/lcd/e3v2/common/dwin_font.h +++ b/Marlin/src/lcd/e3v2/common/dwin_font.h @@ -21,6 +21,8 @@ */ #pragma once +#include + typedef uint8_t fontid_t; /** diff --git a/Marlin/src/lcd/e3v2/creality/dwin.cpp b/Marlin/src/lcd/e3v2/creality/dwin.cpp index b2c08861d7d7..08161dffaf9b 100644 --- a/Marlin/src/lcd/e3v2/creality/dwin.cpp +++ b/Marlin/src/lcd/e3v2/creality/dwin.cpp @@ -1822,8 +1822,6 @@ void MarlinUI::update() { dwinHandleScreen(); // Rotary encoder update } -void MarlinUI::refresh() { /* Nothing to see here */ } - #if HAS_LCD_BRIGHTNESS void MarlinUI::_set_brightness() { dwinLCDBrightness(backlight ? brightness : 0); } #endif diff --git a/Marlin/src/lcd/e3v2/jyersui/dwin.cpp b/Marlin/src/lcd/e3v2/jyersui/dwin.cpp index 856229b0d845..a29f5fc42fb5 100644 --- a/Marlin/src/lcd/e3v2/jyersui/dwin.cpp +++ b/Marlin/src/lcd/e3v2/jyersui/dwin.cpp @@ -5158,6 +5158,7 @@ void MarlinUI::init_lcd() { #if ENABLED(ADVANCED_PAUSE_FEATURE) void MarlinUI::pause_show_message(const PauseMessage message, const PauseMode mode/*=PAUSE_MODE_SAME*/, const uint8_t extruder/*=active_extruder*/) { + if (mode != PAUSE_MODE_SAME) pause_mode = mode; switch (message) { case PAUSE_MESSAGE_INSERT: jyersDWIN.confirmHandler(Popup_FilInsert); break; case PAUSE_MESSAGE_PURGE: diff --git a/Marlin/src/lcd/e3v2/marlinui/dwin_lcd.h b/Marlin/src/lcd/e3v2/marlinui/dwin_lcd.h index dc6c79bd2d0e..ef81a7df77c9 100644 --- a/Marlin/src/lcd/e3v2/marlinui/dwin_lcd.h +++ b/Marlin/src/lcd/e3v2/marlinui/dwin_lcd.h @@ -76,7 +76,3 @@ #include "../common/dwin_color.h" #define Color_Bg_Heading 0x3344 // Static Heading - -// Character matrix width x height -//#define LCD_WIDTH ((DWIN_WIDTH) / 8) -//#define LCD_HEIGHT ((DWIN_HEIGHT) / 12) diff --git a/Marlin/src/lcd/e3v2/marlinui/marlinui_dwin.h b/Marlin/src/lcd/e3v2/marlinui/marlinui_dwin.h index a91cd19f6e8f..b8913914dd74 100644 --- a/Marlin/src/lcd/e3v2/marlinui/marlinui_dwin.h +++ b/Marlin/src/lcd/e3v2/marlinui/marlinui_dwin.h @@ -72,6 +72,12 @@ extern dwin_font_t dwin_font; #define EXTRA_ROW_HEIGHT 8 #define MENU_LINE_HEIGHT (MENU_FONT_HEIGHT + EXTRA_ROW_HEIGHT) +// Character matrix width x height based on menu font +#define LCD_PIXEL_WIDTH DWIN_WIDTH +#define LCD_PIXEL_HEIGHT DWIN_HEIGHT +#define LCD_WIDTH ((LCD_PIXEL_WIDTH) / (MENU_FONT_WIDTH)) +#define LCD_HEIGHT ((LCD_PIXEL_HEIGHT) / (MENU_LINE_HEIGHT)) + #if DWIN_FONT_EDIT == font6x12 #define EDIT_FONT_WIDTH 6 #define EDIT_FONT_ASCENT 10 diff --git a/Marlin/src/lcd/e3v2/marlinui/ui_common.cpp b/Marlin/src/lcd/e3v2/marlinui/ui_common.cpp index 6a4cb6afde5e..4a60f77c9dab 100644 --- a/Marlin/src/lcd/e3v2/marlinui/ui_common.cpp +++ b/Marlin/src/lcd/e3v2/marlinui/ui_common.cpp @@ -219,7 +219,7 @@ void MarlinUI::draw_status_message(const bool blink) { const char *stat = status_and_len(rlen); lcd_put_u8str_max(stat, max_status_chars); - // If the string doesn't completely fill the line... + // If the remaining string doesn't completely fill the line... if (rlen < max_status_chars) { lcd_put_u8str(F(".")); // Always at 1+ spaces left, draw a dot uint8_t chars = max_status_chars - rlen; // Amount of space left in characters diff --git a/Marlin/src/lcd/e3v2/proui/dwin.cpp b/Marlin/src/lcd/e3v2/proui/dwin.cpp index 888d1f74928e..b65adbb78043 100644 --- a/Marlin/src/lcd/e3v2/proui/dwin.cpp +++ b/Marlin/src/lcd/e3v2/proui/dwin.cpp @@ -1890,8 +1890,6 @@ void MarlinUI::update() { dwinHandleScreen(); // Rotary encoder update } -void MarlinUI::refresh() { /* Nothing to see here */ } - #if HAS_LCD_BRIGHTNESS void MarlinUI::_set_brightness() { dwinLCDBrightness(backlight ? brightness : 0); } #endif @@ -1928,8 +1926,7 @@ void dwinRedrawScreen() { } void MarlinUI::pause_show_message(const PauseMessage message, const PauseMode mode/*=PAUSE_MODE_SAME*/, const uint8_t extruder/*=active_extruder*/) { - //if (mode == PAUSE_MODE_SAME) return; - pause_mode = mode; + if (mode != PAUSE_MODE_SAME) pause_mode = mode; switch (message) { case PAUSE_MESSAGE_PARKING: dwinPopupPause(GET_TEXT_F(MSG_PAUSE_PRINT_PARKING)); break; // M125 case PAUSE_MESSAGE_CHANGING: dwinPopupPause(GET_TEXT_F(MSG_FILAMENT_CHANGE_INIT)); break; // pause_print (M125, M600) diff --git a/Marlin/src/lcd/e3v2/proui/dwin_defines.h b/Marlin/src/lcd/e3v2/proui/dwin_defines.h index 87cb50b8183a..f7026ebc7dda 100644 --- a/Marlin/src/lcd/e3v2/proui/dwin_defines.h +++ b/Marlin/src/lcd/e3v2/proui/dwin_defines.h @@ -79,13 +79,23 @@ #if CASELIGHT_USES_BRIGHTNESS #define defCaseLightBrightness 255 #endif + #ifdef Z_AFTER_HOMING #define DEF_Z_AFTER_HOMING Z_AFTER_HOMING #else #define DEF_Z_AFTER_HOMING 0 #endif -#define DEF_HOTENDPIDT TERN(PREHEAT_1_TEMP_BED, PREHEAT_1_TEMP_HOTEND, 195) -#define DEF_BEDPIDT TERN(PREHEAT_1_TEMP_BED, PREHEAT_1_TEMP_HOTEND, 60) + +#ifdef PREHEAT_1_TEMP_HOTEND + #define DEF_HOTENDPIDT PREHEAT_1_TEMP_HOTEND +#else + #define DEF_HOTENDPIDT 195 +#endif +#ifdef PREHEAT_1_TEMP_BED + #define DEF_BEDPIDT PREHEAT_1_TEMP_BED +#else + #define DEF_BEDPIDT 60 +#endif #define DEF_PIDCYCLES 5 /** diff --git a/Marlin/src/lcd/extui/anycubic_chiron/chiron_extui.cpp b/Marlin/src/lcd/extui/anycubic_chiron/chiron_extui.cpp index c29f165d2423..268111b6cb05 100644 --- a/Marlin/src/lcd/extui/anycubic_chiron/chiron_extui.cpp +++ b/Marlin/src/lcd/extui/anycubic_chiron/chiron_extui.cpp @@ -58,12 +58,14 @@ namespace ExtUI { void onPrintTimerStarted() { chiron.timerEvent(AC_timer_started); } void onPrintTimerPaused() { chiron.timerEvent(AC_timer_paused); } void onPrintTimerStopped() { chiron.timerEvent(AC_timer_stopped); } + void onPrintDone() {} - void onFilamentRunout(const extruder_t) { chiron.filamentRunout(); } + void onFilamentRunout(const extruder_t) { chiron.filamentRunout(); } + + void onUserConfirmRequired(const char * const msg) { chiron.confirmationRequest(msg); } - void onUserConfirmRequired(const char * const msg) { chiron.confirmationRequest(msg); } - void onStatusChanged(const char * const msg) { chiron.statusChange(msg); } + void onStatusChanged(const char * const msg) { chiron.statusChange(msg); } void onHomingStart() {} void onHomingDone() {} @@ -133,13 +135,13 @@ namespace ExtUI { #endif #if HAS_PID_HEATING - void onPidTuning(const result_t rst) { + void onPIDTuning(const result_t rst) { // Called for temperature PID tuning result } #endif void onSteppersDisabled() {} - void onSteppersEnabled() {} + void onSteppersEnabled() {} } #endif // ANYCUBIC_LCD_CHIRON diff --git a/Marlin/src/lcd/extui/anycubic_i3mega/anycubic_extui.cpp b/Marlin/src/lcd/extui/anycubic_i3mega/anycubic_extui.cpp index 0006091cda2b..ef02664dacf1 100644 --- a/Marlin/src/lcd/extui/anycubic_i3mega/anycubic_extui.cpp +++ b/Marlin/src/lcd/extui/anycubic_i3mega/anycubic_extui.cpp @@ -38,21 +38,26 @@ namespace ExtUI { void onStartup() { anycubicTFT.onSetup(); } void onIdle() { anycubicTFT.onCommandScan(); } void onPrinterKilled(FSTR_P const error, FSTR_P const component) { anycubicTFT.onKillTFT(); } + void onMediaInserted() { anycubicTFT.onSDCardStateChange(true); } void onMediaError() { anycubicTFT.onSDCardError(); } void onMediaRemoved() { anycubicTFT.onSDCardStateChange(false); } + void onPlayTone(const uint16_t frequency, const uint16_t duration/*=0*/) { TERN_(SPEAKER, ::tone(BEEPER_PIN, frequency, duration)); } void onPrintTimerStarted() { anycubicTFT.onPrintTimerStarted(); } void onPrintTimerPaused() { anycubicTFT.onPrintTimerPaused(); } void onPrintTimerStopped() { anycubicTFT.onPrintTimerStopped(); } + void onFilamentRunout(const extruder_t extruder) { anycubicTFT.onFilamentRunout(); } void onUserConfirmRequired(const char * const msg) { anycubicTFT.onUserConfirmRequired(msg); } + void onStatusChanged(const char * const msg) {} void onHomingStart() {} void onHomingDone() {} + void onPrintDone() {} void onFactoryReset() {} @@ -119,13 +124,13 @@ namespace ExtUI { #endif #if HAS_PID_HEATING - void onPidTuning(const result_t rst) { + void onPIDTuning(const result_t rst) { // Called for temperature PID tuning result } #endif void onSteppersDisabled() {} - void onSteppersEnabled() {} + void onSteppersEnabled() {} } #endif // ANYCUBIC_LCD_I3MEGA diff --git a/Marlin/src/lcd/extui/anycubic_i3mega/anycubic_i3mega_lcd.cpp b/Marlin/src/lcd/extui/anycubic_i3mega/anycubic_i3mega_lcd.cpp index 709b54a6d76a..abd32aa88c8a 100644 --- a/Marlin/src/lcd/extui/anycubic_i3mega/anycubic_i3mega_lcd.cpp +++ b/Marlin/src/lcd/extui/anycubic_i3mega/anycubic_i3mega_lcd.cpp @@ -283,7 +283,7 @@ void AnycubicTFT::handleSpecialMenu() { break; case '9': // "<09HtBedPID>" - SERIAL_ECHOLNPGM("Special Menu: ", F("Auto Tune Hotbed Pid")); + SERIAL_ECHOLNPGM("Special Menu: ", F("Auto Tune Hotbed PID")); injectCommands(F("M303 E-1 S65 C6 U1")); break; } @@ -328,7 +328,7 @@ void AnycubicTFT::handleSpecialMenu() { break; case '4': // "<04HtbedPID>" - SERIAL_ECHOLNPGM("Special Menu: ", F("Auto Tune Hotbed Pid")); + SERIAL_ECHOLNPGM("Special Menu: ", F("Auto Tune Hotbed PID")); injectCommands(F("M303 E-1 S65 C6 U1")); break; @@ -822,8 +822,8 @@ void AnycubicTFT::getCommandFromTFT() { case 25: // A25 cool down if (!isPrinting()) { - setTargetTemp_celsius(0, (heater_t) BED); - setTargetTemp_celsius(0, (extruder_t) E0); + setTargetTemp_celsius(0, (heater_t)BED); + setTargetTemp_celsius(0, (extruder_t)E0); SENDLINE_DBG_PGM("J12", "TFT Serial Debug: Cooling down... J12"); // J12 cool down } diff --git a/Marlin/src/lcd/extui/anycubic_vyper/vyper_extui.cpp b/Marlin/src/lcd/extui/anycubic_vyper/vyper_extui.cpp index d4351a4dab6f..85e7b280790d 100644 --- a/Marlin/src/lcd/extui/anycubic_vyper/vyper_extui.cpp +++ b/Marlin/src/lcd/extui/anycubic_vyper/vyper_extui.cpp @@ -58,12 +58,14 @@ namespace ExtUI { void onPrintTimerStarted() { dgus.timerEvent(AC_timer_started); } void onPrintTimerPaused() { dgus.timerEvent(AC_timer_paused); } void onPrintTimerStopped() { dgus.timerEvent(AC_timer_stopped); } + void onPrintDone() {} - void onFilamentRunout(const extruder_t) { dgus.filamentRunout(); } + void onFilamentRunout(const extruder_t) { dgus.filamentRunout(); } void onUserConfirmRequired(const char * const msg) { dgus.confirmationRequest(msg); } - void onStatusChanged(const char * const msg) { dgus.statusChange(msg); } + + void onStatusChanged(const char * const msg) { dgus.statusChange(msg); } void onHomingStart() { dgus.homingStart(); } void onHomingDone() { dgus.homingComplete(); } @@ -135,7 +137,7 @@ namespace ExtUI { #endif #if HAS_PID_HEATING - void onPidTuning(const result_t rst) { + void onPIDTuning(const result_t rst) { // Called for temperature PID tuning result switch (rst) { case PID_STARTED: break; @@ -148,7 +150,7 @@ namespace ExtUI { #endif void onSteppersDisabled() {} - void onSteppersEnabled() {} + void onSteppersEnabled() {} } #endif // ANYCUBIC_LCD_VYPER diff --git a/Marlin/src/lcd/extui/dgus/DGUSScreenHandler.cpp b/Marlin/src/lcd/extui/dgus/DGUSScreenHandler.cpp index 4403716fff65..6b1632bfec9f 100644 --- a/Marlin/src/lcd/extui/dgus/DGUSScreenHandler.cpp +++ b/Marlin/src/lcd/extui/dgus/DGUSScreenHandler.cpp @@ -62,7 +62,7 @@ void (*DGUSScreenHandler::confirm_action_cb)() = nullptr; filament_data_t filament_data; #endif -void DGUSScreenHandler::sendInfoScreen(PGM_P const line1, PGM_P const line2, PGM_P const line3, PGM_P const line4, bool l1inflash, bool l2inflash, bool l3inflash, bool l4inflash) { +void DGUSScreenHandler::sendInfoScreen_P(PGM_P const line1, PGM_P const line2, PGM_P const line3, PGM_P const line4, bool l1inflash, bool l2inflash, bool l3inflash, bool l4inflash) { DGUS_VP_Variable ramcopy; if (populate_VPVar(VP_MSGSTR1, &ramcopy)) { ramcopy.memadr = (void*) line1; @@ -89,7 +89,7 @@ void DGUSScreenHandler::handleUserConfirmationPopUp(uint16_t VP, PGM_P const lin popToOldScreen(); confirmVP = VP; - sendInfoScreen(line1, line2, line3, line4, l1, l2, l3, l4); + sendInfoScreen_P(line1, line2, line3, line4, l1, l2, l3, l4); gotoScreen(DGUS_SCREEN_CONFIRM); } diff --git a/Marlin/src/lcd/extui/dgus/DGUSScreenHandlerBase.h b/Marlin/src/lcd/extui/dgus/DGUSScreenHandlerBase.h index 3764920be1d0..8ee0fa68c8d5 100644 --- a/Marlin/src/lcd/extui/dgus/DGUSScreenHandlerBase.h +++ b/Marlin/src/lcd/extui/dgus/DGUSScreenHandlerBase.h @@ -37,12 +37,12 @@ class DGUSScreenHandler { // Send all 4 strings that are displayed on the infoscreen, confirmation screen and kill screen // The bools specifying whether the strings are in RAM or FLASH. - static void sendInfoScreen(PGM_P const line1, PGM_P const line2, PGM_P const line3, PGM_P const line4, bool l1inflash, bool l2inflash, bool l3inflash, bool liinflash); + static void sendInfoScreen_P(PGM_P const line1, PGM_P const line2, PGM_P const line3, PGM_P const line4, bool l1inflash, bool l2inflash, bool l3inflash, bool liinflash); static void sendInfoScreen(FSTR_P const line1, FSTR_P const line2, PGM_P const line3, PGM_P const line4, bool l1inflash, bool l2inflash, bool l3inflash, bool liinflash) { - sendInfoScreen(FTOP(line1), FTOP(line2), line3, line4, l1inflash, l2inflash, l3inflash, liinflash); + sendInfoScreen_P(FTOP(line1), FTOP(line2), line3, line4, l1inflash, l2inflash, l3inflash, liinflash); } static void sendInfoScreen(FSTR_P const line1, FSTR_P const line2, FSTR_P const line3, FSTR_P const line4, bool l1inflash, bool l2inflash, bool l3inflash, bool liinflash) { - sendInfoScreen(FTOP(line1), FTOP(line2), FTOP(line3), FTOP(line4), l1inflash, l2inflash, l3inflash, liinflash); + sendInfoScreen_P(FTOP(line1), FTOP(line2), FTOP(line3), FTOP(line4), l1inflash, l2inflash, l3inflash, liinflash); } static void handleUserConfirmationPopUp(uint16_t confirmVP, PGM_P const line1, PGM_P const line2, PGM_P const line3, PGM_P const line4, bool l1inflash, bool l2inflash, bool l3inflash, bool liinflash); diff --git a/Marlin/src/lcd/extui/dgus/dgus_extui.cpp b/Marlin/src/lcd/extui/dgus/dgus_extui.cpp index b956d62b36fb..58aead69845d 100644 --- a/Marlin/src/lcd/extui/dgus/dgus_extui.cpp +++ b/Marlin/src/lcd/extui/dgus/dgus_extui.cpp @@ -74,6 +74,7 @@ namespace ExtUI { void onHomingStart() {} void onHomingDone() {} + void onPrintDone() {} void onFactoryReset() {} @@ -141,10 +142,11 @@ namespace ExtUI { #endif #if HAS_PID_HEATING - void onPidTuning(const result_t rst) { + void onPIDTuning(const result_t rst) { // Called for temperature PID tuning result switch (rst) { case PID_STARTED: + case PID_BED_STARTED: screen.setStatusMessage(GET_TEXT_F(MSG_PID_AUTOTUNE)); break; case PID_BAD_HEATER_ID: @@ -165,7 +167,7 @@ namespace ExtUI { #endif void onSteppersDisabled() {} - void onSteppersEnabled() {} + void onSteppersEnabled() {} } #endif // HAS_DGUS_LCD_CLASSIC diff --git a/Marlin/src/lcd/extui/dgus_e3s1pro/dgus_e3s1pro_extui.cpp b/Marlin/src/lcd/extui/dgus_e3s1pro/dgus_e3s1pro_extui.cpp index fbd8c994c7f8..41f5b41d4982 100644 --- a/Marlin/src/lcd/extui/dgus_e3s1pro/dgus_e3s1pro_extui.cpp +++ b/Marlin/src/lcd/extui/dgus_e3s1pro/dgus_e3s1pro_extui.cpp @@ -117,19 +117,15 @@ namespace ExtUI { screen.configurationStoreRead(success); } - #if HAS_MESH - void onLevelingStart() { - screen.levelingStart(); - } - - void onLevelingDone() { - screen.levelingEnd(); - } + #if HAS_LEVELING + void onLevelingStart() { screen.levelingStart(); } + void onLevelingDone() { screen.levelingEnd(); } + #endif + #if HAS_MESH void onMeshUpdate(const int8_t xpos, const int8_t ypos, const_float_t zval) { screen.meshUpdate(xpos, ypos); } - void onMeshUpdate(const int8_t xpos, const int8_t ypos, const probe_state_t state) { } #endif @@ -147,7 +143,7 @@ namespace ExtUI { #endif #if HAS_PID_HEATING - void onPidTuning(const result_t rst) { + void onPIDTuning(const result_t rst) { // Called for temperature PID tuning result screen.pidTuning(rst); } diff --git a/Marlin/src/lcd/extui/dgus_reloaded/DGUSScreenHandler.cpp b/Marlin/src/lcd/extui/dgus_reloaded/DGUSScreenHandler.cpp index 87a0f6ce1228..aaef68632ac0 100644 --- a/Marlin/src/lcd/extui/dgus_reloaded/DGUSScreenHandler.cpp +++ b/Marlin/src/lcd/extui/dgus_reloaded/DGUSScreenHandler.cpp @@ -308,6 +308,7 @@ void DGUSScreenHandler::filamentRunout(const ExtUI::extruder_t extruder) { void DGUSScreenHandler::pidTuning(const ExtUI::result_t rst) { switch (rst) { case ExtUI::PID_STARTED: + case ExtUI::PID_BED_STARTED: setStatusMessage(GET_TEXT_F(MSG_PID_AUTOTUNE)); break; case ExtUI::PID_BAD_HEATER_ID: diff --git a/Marlin/src/lcd/extui/dgus_reloaded/dgus_reloaded_extui.cpp b/Marlin/src/lcd/extui/dgus_reloaded/dgus_reloaded_extui.cpp index 3e4911f765ca..1c62bee9d5af 100644 --- a/Marlin/src/lcd/extui/dgus_reloaded/dgus_reloaded_extui.cpp +++ b/Marlin/src/lcd/extui/dgus_reloaded/dgus_reloaded_extui.cpp @@ -84,6 +84,7 @@ namespace ExtUI { void onHomingStart() {} void onHomingDone() {} + void onPrintDone() {} void onFactoryReset() { @@ -138,14 +139,14 @@ namespace ExtUI { #endif #if HAS_PID_HEATING - void onPidTuning(const result_t rst) { + void onPIDTuning(const result_t rst) { // Called for temperature PID tuning result screen.pidTuning(rst); } #endif void onSteppersDisabled() {} - void onSteppersEnabled() {} + void onSteppersEnabled() {} } #endif // DGUS_LCD_UI_RELOADED diff --git a/Marlin/src/lcd/extui/example/example.cpp b/Marlin/src/lcd/extui/example/example.cpp index 46faa49868f5..7f9ff62de43d 100644 --- a/Marlin/src/lcd/extui/example/example.cpp +++ b/Marlin/src/lcd/extui/example/example.cpp @@ -47,19 +47,26 @@ namespace ExtUI { } void onIdle() {} void onPrinterKilled(FSTR_P const error, FSTR_P const component) {} + void onMediaInserted() {} void onMediaError() {} void onMediaRemoved() {} + void onPlayTone(const uint16_t frequency, const uint16_t duration/*=0*/) {} + void onPrintTimerStarted() {} void onPrintTimerPaused() {} void onPrintTimerStopped() {} + void onFilamentRunout(const extruder_t extruder) {} + void onUserConfirmRequired(const char * const msg) {} + void onStatusChanged(const char * const msg) {} void onHomingStart() {} void onHomingDone() {} + void onPrintDone() {} void onFactoryReset() {} @@ -126,20 +133,21 @@ namespace ExtUI { #endif #if HAS_PID_HEATING - void onPidTuning(const result_t rst) { + void onPIDTuning(const result_t rst) { // Called for temperature PID tuning result switch (rst) { - case PID_STARTED: break; - case PID_BAD_HEATER_ID: break; - case PID_TEMP_TOO_HIGH: break; - case PID_TUNING_TIMEOUT: break; - case PID_DONE: break; + case PID_STARTED: + case PID_BED_STARTED: + case PID_BAD_HEATER_ID: break; + case PID_TEMP_TOO_HIGH: break; + case PID_TUNING_TIMEOUT: break; + case PID_DONE: break; } } #endif void onSteppersDisabled() {} - void onSteppersEnabled() {} + void onSteppersEnabled() {} } #endif // EXTUI_EXAMPLE && EXTENSIBLE_UI diff --git a/Marlin/src/lcd/extui/ftdi_eve_touch_ui/ftdi_eve_extui.cpp b/Marlin/src/lcd/extui/ftdi_eve_touch_ui/ftdi_eve_extui.cpp index d89e90ece1ea..0dda4a977d1e 100644 --- a/Marlin/src/lcd/extui/ftdi_eve_touch_ui/ftdi_eve_extui.cpp +++ b/Marlin/src/lcd/extui/ftdi_eve_touch_ui/ftdi_eve_extui.cpp @@ -51,6 +51,11 @@ namespace ExtUI { #endif } + void onMediaError() { + sound.play(sad_trombone, PLAY_ASYNCHRONOUS); + AlertDialogBox::showError(F("Unable to read media.")); + } + void onMediaRemoved() { #if HAS_MEDIA if (isPrintingFromMedia()) { @@ -65,11 +70,6 @@ namespace ExtUI { #endif } - void onMediaError() { - sound.play(sad_trombone, PLAY_ASYNCHRONOUS); - AlertDialogBox::showError(F("Unable to read media.")); - } - void onStatusChanged(const char *lcd_msg) { StatusScreen::setStatusMessage(lcd_msg); } void onPrintTimerStarted() { @@ -78,8 +78,8 @@ namespace ExtUI { void onPrintTimerStopped() { InterfaceSoundsScreen::playEventSound(InterfaceSoundsScreen::PRINTING_FINISHED); } - void onPrintTimerPaused() {} + void onPrintDone() {} void onFilamentRunout(const extruder_t extruder) { @@ -123,8 +123,12 @@ namespace ExtUI { #endif #if HAS_MESH - void onMeshUpdate(const int8_t x, const int8_t y, const_float_t val) { BedMeshViewScreen::onMeshUpdate(x, y, val); } - void onMeshUpdate(const int8_t x, const int8_t y, const ExtUI::probe_state_t state) { BedMeshViewScreen::onMeshUpdate(x, y, state); } + void onMeshUpdate(const int8_t x, const int8_t y, const_float_t val) { + BedMeshViewScreen::onMeshUpdate(x, y, val); + } + void onMeshUpdate(const int8_t x, const int8_t y, const ExtUI::probe_state_t state) { + BedMeshViewScreen::onMeshUpdate(x, y, state); + } #endif #if ENABLED(POWER_LOSS_RECOVERY) @@ -140,11 +144,12 @@ namespace ExtUI { #endif #if HAS_PID_HEATING - void onPidTuning(const result_t rst) { + void onPIDTuning(const result_t rst) { // Called for temperature PID tuning result //SERIAL_ECHOLNPGM("OnPidTuning:", rst); switch (rst) { case PID_STARTED: + case PID_BED_STARTED: StatusScreen::setStatusMessage(GET_TEXT_F(MSG_PID_AUTOTUNE)); break; case PID_BAD_HEATER_ID: @@ -165,7 +170,7 @@ namespace ExtUI { #endif // HAS_PID_HEATING void onSteppersDisabled() {} - void onSteppersEnabled() {} + void onSteppersEnabled() {} } #endif // TOUCH_UI_FTDI_EVE diff --git a/Marlin/src/lcd/extui/ia_creality/ia_creality_extui.cpp b/Marlin/src/lcd/extui/ia_creality/ia_creality_extui.cpp index 1c64df500f58..af5d1c7ace7c 100644 --- a/Marlin/src/lcd/extui/ia_creality/ia_creality_extui.cpp +++ b/Marlin/src/lcd/extui/ia_creality/ia_creality_extui.cpp @@ -249,41 +249,14 @@ void onFactoryReset() { show_status = true; } -void onMeshUpdate(const int8_t xpos, const int8_t ypos, probe_state_t state) {} - -void onMeshUpdate(const int8_t xpos, const int8_t ypos, const_float_t zval) { - if (waitway == 3) - if (isPositionKnown() && (getActualTemp_celsius(BED) >= (getTargetTemp_celsius(BED) - 1))) - rts.sendData(ExchangePageBase + 64, ExchangepageAddr); - #if HAS_MESH - uint8_t abl_probe_index = 0; - for (uint8_t outer = 0; outer < GRID_MAX_POINTS_Y; outer++) - for (uint8_t inner = 0; inner < GRID_MAX_POINTS_X; inner++) { - const bool zig = outer & 1; // != ((PR_OUTER_END) & 1); - const xy_uint8_t point = { uint8_t(zig ? (GRID_MAX_POINTS_X - 1) - inner : inner), outer }; - if (point.x == xpos && outer == ypos) - rts.sendData(ExtUI::getMeshPoint(point) * 1000, AutolevelVal + (abl_probe_index * 2)); - ++abl_probe_index; - } - #endif -} +static_assert(eeprom_data_size >= sizeof(creality_dwin_settings_t), "Insufficient space in EEPROM for UI parameters"); void onStoreSettings(char *buff) { - static_assert( - ExtUI::eeprom_data_size >= sizeof(creality_dwin_settings_t), - "Insufficient space in EEPROM for UI parameters" - ); - // Write to buffer memcpy(buff, &dwin_settings, sizeof(creality_dwin_settings_t)); } void onLoadSettings(const char *buff) { - static_assert( - ExtUI::eeprom_data_size >= sizeof(creality_dwin_settings_t), - "Insufficient space in EEPROM for UI parameters" - ); - creality_dwin_settings_t eepromSettings; memcpy(&eepromSettings, buff, sizeof(creality_dwin_settings_t)); @@ -305,7 +278,7 @@ void onLoadSettings(const char *buff) { } void onSettingsStored(const bool success) { - // This is called after the entire EEPROM has been written, + // Called after the entire EEPROM has been written, // whether successful or not. } @@ -334,6 +307,55 @@ void onSettingsLoaded(const bool success) { rts.setTouchScreenConfiguration(); } +void onPostprocessSettings() {} + +#if HAS_LEVELING + void onLevelingStart() {} + + void onLevelingDone() { + #if HAS_MESH + if (ExtUI::getLevelingIsValid()) { + uint8_t abl_probe_index = 0; + for (uint8_t outer = 0; outer < GRID_MAX_POINTS_Y; outer++) + for (uint8_t inner = 0; inner < GRID_MAX_POINTS_X; inner++) { + const bool zig = outer & 1; + const xy_uint8_t point = { uint8_t(zig ? (GRID_MAX_POINTS_X - 1) - inner : inner), outer }; + rts.sendData(ExtUI::getMeshPoint(point) * 1000, AutolevelVal + abl_probe_index * 2); + ++abl_probe_index; + } + + rts.sendData(3, AutoLevelIcon); // 2=On, 3=Off + setLevelingActive(true); + } + else { + rts.sendData(2, AutoLevelIcon); /*Off*/ + setLevelingActive(false); + } + #endif + } +#endif + +#if HAS_MESH + void onMeshUpdate(const int8_t xpos, const int8_t ypos, probe_state_t state) {} + + void onMeshUpdate(const int8_t xpos, const int8_t ypos, const_float_t zval) { + if (waitway == 3) + if (isPositionKnown() && (getActualTemp_celsius(BED) >= (getTargetTemp_celsius(BED) - 1))) + rts.sendData(ExchangePageBase + 64, ExchangepageAddr); + #if HAS_MESH + uint8_t abl_probe_index = 0; + for (uint8_t outer = 0; outer < GRID_MAX_POINTS_Y; outer++) + for (uint8_t inner = 0; inner < GRID_MAX_POINTS_X; inner++) { + const bool zig = outer & 1; // != ((PR_OUTER_END) & 1); + const xy_uint8_t point = { uint8_t(zig ? (GRID_MAX_POINTS_X - 1) - inner : inner), outer }; + if (point.x == xpos && outer == ypos) + rts.sendData(ExtUI::getMeshPoint(point) * 1000, AutolevelVal + (abl_probe_index * 2)); + ++abl_probe_index; + } + #endif + } +#endif + #if ENABLED(POWER_LOSS_RECOVERY) void onSetPowerLoss(const bool onoff) { // Called when power-loss is enabled/disabled @@ -351,7 +373,7 @@ void onSettingsLoaded(const bool success) { #endif #if HAS_PID_HEATING - void onPidTuning(const result_t rst) { + void onPIDTuning(const result_t rst) { // Called for temperature PID tuning result rts.sendData(pid_hotendAutoTemp, HotendPID_AutoTmp); rts.sendData(pid_bedAutoTemp, BedPID_AutoTmp); @@ -367,37 +389,14 @@ void onSettingsLoaded(const bool success) { } #endif -void onLevelingStart() {} - -void onLevelingDone() { - #if HAS_MESH - if (ExtUI::getLevelingIsValid()) { - uint8_t abl_probe_index = 0; - for (uint8_t outer = 0; outer < GRID_MAX_POINTS_Y; outer++) - for (uint8_t inner = 0; inner < GRID_MAX_POINTS_X; inner++) { - const bool zig = outer & 1; - const xy_uint8_t point = { uint8_t(zig ? (GRID_MAX_POINTS_X - 1) - inner : inner), outer }; - rts.sendData(ExtUI::getMeshPoint(point) * 1000, AutolevelVal + abl_probe_index * 2); - ++abl_probe_index; - } - - rts.sendData(3, AutoLevelIcon); // 2=On, 3=Off - setLevelingActive(true); - } - else { - rts.sendData(2, AutoLevelIcon); /*Off*/ - setLevelingActive(false); - } - #endif -} - -void onSteppersEnabled() {} -void onPrintDone() {} void onHomingStart() {} void onHomingDone() {} + +void onPrintDone() {} + void onSteppersDisabled() {} -void onPostprocessSettings() {} +void onSteppersEnabled() {} -} // namespace ExtUI +} // ExtUI #endif // DGUS_LCD_UI_IA_CREALITY diff --git a/Marlin/src/lcd/extui/malyan/malyan_extui.cpp b/Marlin/src/lcd/extui/malyan/malyan_extui.cpp index 4865f42354e0..00bc173fb3f2 100644 --- a/Marlin/src/lcd/extui/malyan/malyan_extui.cpp +++ b/Marlin/src/lcd/extui/malyan/malyan_extui.cpp @@ -104,11 +104,12 @@ namespace ExtUI { #if HAS_PID_HEATING - void onPidTuning(const result_t rst) { + void onPIDTuning(const result_t rst) { // Called for temperature PID tuning result //SERIAL_ECHOLNPGM("OnPidTuning:", rst); switch (rst) { case PID_STARTED: + case PID_BED_STARTED: set_lcd_error(GET_TEXT_F(MSG_PID_AUTOTUNE)); break; case PID_BAD_HEATER_ID: @@ -134,16 +135,22 @@ namespace ExtUI { // Not needed for Malyan LCD void onStatusChanged(const char * const) {} + void onMediaInserted() {} void onMediaError() {} void onMediaRemoved() {} + void onPlayTone(const uint16_t, const uint16_t/*=0*/) {} + void onFilamentRunout(const extruder_t extruder) {} void onUserConfirmRequired(const char * const) {} + void onHomingStart() {} void onHomingDone() {} + void onPrintDone() {} void onFactoryReset() {} + void onStoreSettings(char*) {} void onLoadSettings(const char*) {} void onPostprocessSettings() {} @@ -173,7 +180,7 @@ namespace ExtUI { #endif void onSteppersDisabled() {} - void onSteppersEnabled() {} + void onSteppersEnabled() {} } #endif // MALYAN_LCD diff --git a/Marlin/src/lcd/extui/nextion/nextion_extui.cpp b/Marlin/src/lcd/extui/nextion/nextion_extui.cpp index e33268f3a375..fc864320971c 100644 --- a/Marlin/src/lcd/extui/nextion/nextion_extui.cpp +++ b/Marlin/src/lcd/extui/nextion/nextion_extui.cpp @@ -38,19 +38,24 @@ namespace ExtUI { void onStartup() { nextion.startup(); } void onIdle() { nextion.idleLoop(); } void onPrinterKilled(FSTR_P const error, FSTR_P const component) { nextion.printerKilled(error, component); } + void onMediaInserted() {} void onMediaError() {} void onMediaRemoved() {} + void onPlayTone(const uint16_t frequency, const uint16_t duration/*=0*/) {} void onPrintTimerStarted() {} void onPrintTimerPaused() {} void onPrintTimerStopped() {} void onFilamentRunout(const extruder_t) {} + void onUserConfirmRequired(const char * const msg) { nextion.confirmationRequest(msg); } + void onStatusChanged(const char * const msg) { nextion.statusChange(msg); } void onHomingStart() {} void onHomingDone() {} + void onPrintDone() { nextion.PrintFinished(); } void onFactoryReset() {} @@ -117,14 +122,14 @@ namespace ExtUI { #endif #if HAS_PID_HEATING - void onPidTuning(const result_t rst) { + void onPIDTuning(const result_t rst) { // Called for temperature PID tuning result nextion.panelInfo(37); } #endif void onSteppersDisabled() {} - void onSteppersEnabled() {} + void onSteppersEnabled() {} } diff --git a/Marlin/src/lcd/extui/ui_api.cpp b/Marlin/src/lcd/extui/ui_api.cpp index 2ba01a694d0e..9d0b7e2723de 100644 --- a/Marlin/src/lcd/extui/ui_api.cpp +++ b/Marlin/src/lcd/extui/ui_api.cpp @@ -20,9 +20,9 @@ * */ -/************** - * ui_api.cpp * - **************/ +/************************************* + * ui_api.cpp - Shared ExtUI methods * + *************************************/ /**************************************************************************** * Written By Marcio Teixeira 2018 - Aleph Objects, Inc. * @@ -1119,7 +1119,7 @@ namespace ExtUI { #if M600_PURGE_MORE_RESUMABLE void setPauseMenuResponse(PauseMenuResponse response) { pause_menu_response = response; } PauseMessage pauseModeStatus = PAUSE_MESSAGE_STATUS; - PauseMode getPauseMode() { return pause_mode;} + PauseMode getPauseMode() { return pause_mode; } #endif void printFile(const char *filename) { @@ -1225,7 +1225,9 @@ namespace ExtUI { } // namespace ExtUI -// At the moment we hook into MarlinUI methods, but this could be cleaned up in the future +// +// MarlinUI passthroughs to ExtUI +// void MarlinUI::init_lcd() { ExtUI::onStartup(); } diff --git a/Marlin/src/lcd/extui/ui_api.h b/Marlin/src/lcd/extui/ui_api.h index 50ecd13d7553..b7d670de13d6 100644 --- a/Marlin/src/lcd/extui/ui_api.h +++ b/Marlin/src/lcd/extui/ui_api.h @@ -57,18 +57,43 @@ namespace ExtUI { // in the EEPROM when the methods onStoreSettings and // onLoadSettings are called. - static constexpr size_t eeprom_data_size = 48; + #ifndef EXTUI_EEPROM_DATA_SIZE + #define EXTUI_EEPROM_DATA_SIZE 48 + #endif + static constexpr size_t eeprom_data_size = EXTUI_EEPROM_DATA_SIZE; enum axis_t : uint8_t { X, Y, Z, I, J, K, U, V, W, X2, Y2, Z2, Z3, Z4 }; enum extruder_t : uint8_t { E0, E1, E2, E3, E4, E5, E6, E7 }; enum heater_t : uint8_t { H0, H1, H2, H3, H4, H5, BED, CHAMBER, COOLER }; enum fan_t : uint8_t { FAN0, FAN1, FAN2, FAN3, FAN4, FAN5, FAN6, FAN7 }; - enum result_t : uint8_t { PID_STARTED, PID_BAD_HEATER_ID, PID_TEMP_TOO_HIGH, PID_TUNING_TIMEOUT, PID_DONE }; + enum result_t : uint8_t { + OPTITEM(HAS_PID_HEATING, PID_STARTED) + OPTITEM(HAS_PID_HEATING, PID_BED_STARTED) + OPTITEM(HAS_PID_HEATING, PID_BAD_HEATER_ID) + OPTITEM(HAS_PID_HEATING, PID_TEMP_TOO_HIGH) + OPTITEM(HAS_PID_HEATING, PID_TUNING_TIMEOUT) + OPTITEM(HAS_PID_HEATING, PID_DONE) + }; constexpr uint8_t extruderCount = EXTRUDERS; constexpr uint8_t hotendCount = HOTENDS; constexpr uint8_t fanCount = FAN_COUNT; + inline const axis_t axis_to_axis_t(const AxisEnum a) { + switch (a) { + TERN_(HAS_X_AXIS, case X_AXIS:) + default: return X; + OPTCODE(HAS_Y_AXIS, case Y_AXIS: return Y) + OPTCODE(HAS_Z_AXIS, case Z_AXIS: return Z) + OPTCODE(HAS_I_AXIS, case I_AXIS: return I) + OPTCODE(HAS_J_AXIS, case J_AXIS: return J) + OPTCODE(HAS_K_AXIS, case K_AXIS: return K) + OPTCODE(HAS_U_AXIS, case U_AXIS: return U) + OPTCODE(HAS_V_AXIS, case V_AXIS: return V) + OPTCODE(HAS_W_AXIS, case W_AXIS: return W) + } + } + #if HAS_MESH typedef float bed_mesh_t[GRID_MAX_POINTS_X][GRID_MAX_POINTS_Y]; #endif @@ -458,38 +483,49 @@ namespace ExtUI { */ void onStartup(); void onIdle(); + void onMediaInserted(); void onMediaError(); void onMediaRemoved(); + void onPlayTone(const uint16_t frequency, const uint16_t duration=0); + void onPrinterKilled(FSTR_P const error, FSTR_P const component); void onSurviveInKilled(); + void onPrintTimerStarted(); void onPrintTimerPaused(); void onPrintTimerStopped(); void onPrintDone(); + void onFilamentRunout(const extruder_t extruder); + void onUserConfirmRequired(const char * const msg); void onUserConfirmRequired(FSTR_P const fstr); + void onStatusChanged(const char * const msg); void onStatusChanged(FSTR_P const fstr); + void onHomingStart(); void onHomingDone(); + void onSteppersDisabled(); void onSteppersEnabled(); + void onFactoryReset(); void onStoreSettings(char *); void onLoadSettings(const char *); void onPostprocessSettings(); void onSettingsStored(const bool success); void onSettingsLoaded(const bool success); + #if ENABLED(POWER_LOSS_RECOVERY) void onSetPowerLoss(const bool onoff); void onPowerLoss(); void onPowerLossResume(); #endif #if HAS_PID_HEATING - void onPidTuning(const result_t rst); + void onPIDTuning(const result_t rst); #endif }; diff --git a/Marlin/src/lcd/language/language_de.h b/Marlin/src/lcd/language/language_de.h index 037beb2b3caa..6885da5ca6b3 100644 --- a/Marlin/src/lcd/language/language_de.h +++ b/Marlin/src/lcd/language/language_de.h @@ -328,7 +328,6 @@ namespace LanguageNarrow_de { LSTR MSG_PID_AUTOTUNE_FAILED = _UxGT("PID Autotune fehlge.!"); LSTR MSG_BAD_HEATER_ID = _UxGT("ungültiger Extruder."); LSTR MSG_TEMP_TOO_HIGH = _UxGT("Temperatur zu hoch."); - LSTR MSG_TIMEOUT = _UxGT("Timeout"); LSTR MSG_PID_BAD_HEATER_ID = _UxGT("Autotune fehlge.! Ungültiger Extruder"); LSTR MSG_PID_TEMP_TOO_HIGH = _UxGT("Autotune fehlge.! Temperatur zu hoch."); LSTR MSG_PID_TIMEOUT = _UxGT("Autotune fehlge.! Timeout."); diff --git a/Marlin/src/lcd/language/language_en.h b/Marlin/src/lcd/language/language_en.h index 82fd637aa124..2ea52c2ccf5d 100644 --- a/Marlin/src/lcd/language/language_en.h +++ b/Marlin/src/lcd/language/language_en.h @@ -350,19 +350,23 @@ namespace LanguageNarrow_en { LSTR MSG_MAX = " " LCD_STR_THERMOMETER _UxGT(" Max"); LSTR MSG_FACTOR = " " LCD_STR_THERMOMETER _UxGT(" Fact"); LSTR MSG_AUTOTEMP = _UxGT("Autotemp"); + LSTR MSG_TIMEOUT = _UxGT("Timeout"); LSTR MSG_LCD_ON = _UxGT("On"); LSTR MSG_LCD_OFF = _UxGT("Off"); + LSTR MSG_PID_AUTOTUNE = _UxGT("PID Autotune"); LSTR MSG_PID_AUTOTUNE_E = _UxGT("Autotune * PID"); LSTR MSG_PID_CYCLE = _UxGT("PID Cycles"); LSTR MSG_PID_AUTOTUNE_DONE = _UxGT("PID tuning done"); LSTR MSG_PID_AUTOTUNE_FAILED = _UxGT("Autotune failed!"); + LSTR MSG_BAD_HEATER_ID = _UxGT("Bad extruder."); LSTR MSG_TEMP_TOO_HIGH = _UxGT("Temperature too high."); - LSTR MSG_TIMEOUT = _UxGT("Timeout"); + LSTR MSG_PID_BAD_HEATER_ID = _UxGT("Autotune failed! Bad extruder."); LSTR MSG_PID_TEMP_TOO_HIGH = _UxGT("Autotune failed! Temperature too high."); LSTR MSG_PID_TIMEOUT = _UxGT("Autotune failed! Timeout."); + LSTR MSG_MPC_MEASURING_AMBIENT = _UxGT("Testing heat loss"); LSTR MSG_MPC_HEATING_PAST_200 = _UxGT("Heating to >200C"); LSTR MSG_MPC_COOLING_TO_AMBIENT = _UxGT("Cooling to ambient"); @@ -378,6 +382,7 @@ namespace LanguageNarrow_en { LSTR MSG_MPC_AMBIENT_XFER_COEFF_E = _UxGT("Ambient Co. *"); LSTR MSG_MPC_AMBIENT_XFER_COEFF_FAN = _UxGT("Fan coeff."); LSTR MSG_MPC_AMBIENT_XFER_COEFF_FAN_E = _UxGT("Fan coeff. *"); + LSTR MSG_SELECT_E = _UxGT("Select *"); LSTR MSG_ACC = _UxGT("Accel"); LSTR MSG_JERK = _UxGT("Jerk"); diff --git a/Marlin/src/lcd/language/language_fr.h b/Marlin/src/lcd/language/language_fr.h index 0ac8f71d5874..52bbd7fac3c6 100644 --- a/Marlin/src/lcd/language/language_fr.h +++ b/Marlin/src/lcd/language/language_fr.h @@ -255,12 +255,14 @@ namespace LanguageNarrow_fr { LSTR MSG_AUTOTEMP = _UxGT("Temp. Auto."); LSTR MSG_LCD_ON = _UxGT("Marche"); LSTR MSG_LCD_OFF = _UxGT("Arrêt"); + LSTR MSG_PID_AUTOTUNE = _UxGT("PID Autotune"); LSTR MSG_PID_AUTOTUNE_E = _UxGT("PID Autotune *"); LSTR MSG_PID_AUTOTUNE_DONE = _UxGT("Tuning PID terminé"); LSTR MSG_PID_BAD_HEATER_ID = _UxGT("Echec Autotune! E incorrect"); LSTR MSG_PID_TEMP_TOO_HIGH = _UxGT("Echec Autotune! Temp. trop haute"); LSTR MSG_PID_TIMEOUT = _UxGT("Echec Autotune! Opér. expirée"); + LSTR MSG_SELECT_E = _UxGT("Sélectionner *"); LSTR MSG_ACC = _UxGT("Accélération"); LSTR MSG_JERK = _UxGT("Jerk"); diff --git a/Marlin/src/lcd/language/language_fr_na.h b/Marlin/src/lcd/language/language_fr_na.h index 55737555030a..98302af61c70 100644 --- a/Marlin/src/lcd/language/language_fr_na.h +++ b/Marlin/src/lcd/language/language_fr_na.h @@ -255,12 +255,14 @@ namespace LanguageNarrow_fr_na { LSTR MSG_AUTOTEMP = _UxGT("Temp. Auto."); LSTR MSG_LCD_ON = _UxGT("Marche"); LSTR MSG_LCD_OFF = _UxGT("Arret"); + LSTR MSG_PID_AUTOTUNE = _UxGT("PID Autotune"); LSTR MSG_PID_AUTOTUNE_E = _UxGT("PID Autotune *"); LSTR MSG_PID_AUTOTUNE_DONE = _UxGT("Tuning PID termine"); LSTR MSG_PID_BAD_HEATER_ID = _UxGT("Echec Autotune! E incorrect"); LSTR MSG_PID_TEMP_TOO_HIGH = _UxGT("Echec Autotune! Temp. trop haute"); LSTR MSG_PID_TIMEOUT = _UxGT("Echec Autotune! Oper. expiree"); + LSTR MSG_SELECT_E = _UxGT("Selectionner *"); LSTR MSG_ACC = _UxGT("Acceleration"); LSTR MSG_JERK = _UxGT("Jerk"); diff --git a/Marlin/src/lcd/language/language_it.h b/Marlin/src/lcd/language/language_it.h index b7dc9d5678bf..08b048eadd4e 100644 --- a/Marlin/src/lcd/language/language_it.h +++ b/Marlin/src/lcd/language/language_it.h @@ -342,6 +342,7 @@ namespace LanguageNarrow_it { LSTR MSG_MAX = " " LCD_STR_THERMOMETER _UxGT(" Max"); LSTR MSG_FACTOR = " " LCD_STR_THERMOMETER _UxGT(" Fact"); LSTR MSG_AUTOTEMP = _UxGT("Autotemp"); + LSTR MSG_TIMEOUT = _UxGT("Tempo scaduto"); LSTR MSG_LCD_ON = _UxGT("On"); LSTR MSG_LCD_OFF = _UxGT("Off"); LSTR MSG_PID_AUTOTUNE = _UxGT("Calibrazione PID"); @@ -351,7 +352,6 @@ namespace LanguageNarrow_it { LSTR MSG_PID_AUTOTUNE_FAILED = _UxGT("Calibr.PID fallito!"); LSTR MSG_BAD_HEATER_ID = _UxGT("Estrusore invalido."); LSTR MSG_TEMP_TOO_HIGH = _UxGT("Temp.troppo alta."); - LSTR MSG_TIMEOUT = _UxGT("Tempo scaduto"); LSTR MSG_PID_BAD_HEATER_ID = _UxGT("Calibrazione fallita! Estrusore errato."); LSTR MSG_PID_TEMP_TOO_HIGH = _UxGT("Calibrazione fallita! Temperatura troppo alta."); LSTR MSG_PID_TIMEOUT = _UxGT("Calibrazione fallita! Tempo scaduto."); diff --git a/Marlin/src/lcd/language/language_ru.h b/Marlin/src/lcd/language/language_ru.h index ffe2fb1ae5c7..851b4ffd0d9a 100644 --- a/Marlin/src/lcd/language/language_ru.h +++ b/Marlin/src/lcd/language/language_ru.h @@ -294,6 +294,7 @@ namespace LanguageNarrow_ru { LSTR MSG_MAX = " " LCD_STR_THERMOMETER ", " LCD_STR_DEGREE _UxGT("С макс"); LSTR MSG_FACTOR = " " LCD_STR_THERMOMETER _UxGT(" Фактор"); LSTR MSG_AUTOTEMP = _UxGT("Автотемпература"); + LSTR MSG_TIMEOUT = _UxGT("Таймаут."); LSTR MSG_LCD_ON = _UxGT("Вкл"); LSTR MSG_LCD_OFF = _UxGT("Выкл"); @@ -707,7 +708,6 @@ namespace LanguageNarrow_ru { LSTR MSG_PID_AUTOTUNE_FAILED = _UxGT("Автонастройка PID не удалась!"); LSTR MSG_BAD_HEATER_ID = _UxGT("Неверный экструдер."); LSTR MSG_TEMP_TOO_HIGH = _UxGT("Слишком высокая температура."); - LSTR MSG_TIMEOUT = _UxGT("Таймаут."); LSTR MSG_MPC_MEASURING_AMBIENT = _UxGT("Тест потери тепла"); LSTR MSG_MPC_HEATING_PAST_200 = _UxGT("Нагрев выше >200C"); LSTR MSG_MPC_COOLING_TO_AMBIENT = _UxGT("Охлаждение до окружающей"); diff --git a/Marlin/src/lcd/language/language_sk.h b/Marlin/src/lcd/language/language_sk.h index 73bf58d99110..dd64c29f2529 100644 --- a/Marlin/src/lcd/language/language_sk.h +++ b/Marlin/src/lcd/language/language_sk.h @@ -338,6 +338,7 @@ namespace LanguageNarrow_sk { LSTR MSG_MAX = " " LCD_STR_THERMOMETER _UxGT(" Max"); LSTR MSG_FACTOR = " " LCD_STR_THERMOMETER _UxGT(" Fakt"); LSTR MSG_AUTOTEMP = _UxGT("Auto-teplota"); + LSTR MSG_TIMEOUT = _UxGT("Čas vypršal"); LSTR MSG_LCD_ON = _UxGT("Zap"); LSTR MSG_LCD_OFF = _UxGT("Vyp"); LSTR MSG_PID_AUTOTUNE = _UxGT("Kalibrácia PID"); @@ -347,7 +348,6 @@ namespace LanguageNarrow_sk { LSTR MSG_PID_AUTOTUNE_FAILED = _UxGT("Kal. PID zlyhala!"); LSTR MSG_BAD_HEATER_ID = _UxGT("Zlý extrudér"); LSTR MSG_TEMP_TOO_HIGH = _UxGT("Príliš vysoká tepl."); - LSTR MSG_TIMEOUT = _UxGT("Čas vypršal"); LSTR MSG_PID_BAD_HEATER_ID = _UxGT("Auto-kal. zlyhala! Zlý extrúder."); LSTR MSG_PID_TEMP_TOO_HIGH = _UxGT("Auto-kal. zlyhala! Príliš vysoká tepl."); LSTR MSG_PID_TIMEOUT = _UxGT("Auto-kal. zlyhala! Čas vypršal."); diff --git a/Marlin/src/lcd/language/language_tr.h b/Marlin/src/lcd/language/language_tr.h index 86c39b344eb7..23aefff2f7de 100644 --- a/Marlin/src/lcd/language/language_tr.h +++ b/Marlin/src/lcd/language/language_tr.h @@ -341,6 +341,7 @@ namespace LanguageNarrow_tr { LSTR MSG_MAX = " " LCD_STR_THERMOMETER _UxGT(" Max"); LSTR MSG_FACTOR = " " LCD_STR_THERMOMETER _UxGT(" Çarpan"); LSTR MSG_AUTOTEMP = _UxGT("Oto. Sıcaklık"); + LSTR MSG_TIMEOUT = _UxGT("Zaman aşımı"); LSTR MSG_LCD_ON = _UxGT("Açık"); LSTR MSG_LCD_OFF = _UxGT("Kapalı"); LSTR MSG_PID_AUTOTUNE = _UxGT("PID Kalibrasyonu"); @@ -350,7 +351,6 @@ namespace LanguageNarrow_tr { LSTR MSG_PID_AUTOTUNE_FAILED = _UxGT("Kalibrasyon başarısız!"); LSTR MSG_BAD_HEATER_ID = _UxGT("Kötü ekstruder."); LSTR MSG_TEMP_TOO_HIGH = _UxGT("Sıcaklık çok yüksek."); - LSTR MSG_TIMEOUT = _UxGT("Zaman aşımı"); LSTR MSG_PID_BAD_HEATER_ID = _UxGT("Kalibrasyon başarısız! Kötü ekstruder."); LSTR MSG_PID_TEMP_TOO_HIGH = _UxGT("Kalibrasyon başarısız! Sıcaklık çok yüksek."); LSTR MSG_PID_TIMEOUT = _UxGT("Kalibrasyon başarısız! Zaman aşımı."); diff --git a/Marlin/src/lcd/lcdprint.h b/Marlin/src/lcd/lcdprint.h index 87032201fb0c..a93e3adc6b14 100644 --- a/Marlin/src/lcd/lcdprint.h +++ b/Marlin/src/lcd/lcdprint.h @@ -38,11 +38,6 @@ #include "e3v2/marlinui/marlinui_dwin.h" - #define LCD_PIXEL_WIDTH DWIN_WIDTH - #define LCD_PIXEL_HEIGHT DWIN_HEIGHT - #define LCD_WIDTH ((LCD_PIXEL_WIDTH) / (MENU_FONT_WIDTH)) - #define LCD_HEIGHT ((LCD_PIXEL_HEIGHT) / (MENU_LINE_HEIGHT)) - // The DWIN lcd_moveto function uses row / column, not pixels #define LCD_COL_X(col) (col) #define LCD_ROW_Y(row) (row) diff --git a/Marlin/src/lcd/marlinui.cpp b/Marlin/src/lcd/marlinui.cpp index 99a5996a2dfe..4eed5f3c6595 100644 --- a/Marlin/src/lcd/marlinui.cpp +++ b/Marlin/src/lcd/marlinui.cpp @@ -1491,7 +1491,7 @@ void MarlinUI::host_notify(const char * const cstr) { else if (!no_welcome) msg = GET_TEXT_F(WELCOME_MSG); else if (ENABLED(DWIN_LCD_PROUI)) - msg = F(""); + msg = F(""); else return; @@ -1605,9 +1605,7 @@ void MarlinUI::host_notify(const char * const cstr) { #endif - #if ENABLED(STATUS_MESSAGE_SCROLLING) && ANY(HAS_WIRED_LCD, DWIN_LCD_PROUI) - status_scroll_offset = 0; - #endif + TERN_(STATUS_MESSAGE_SCROLLING, reset_status_scroll()); TERN_(EXTENSIBLE_UI, ExtUI::onStatusChanged(status_message)); TERN_(DWIN_CREALITY_LCD, dwinStatusChanged(status_message)); @@ -1622,7 +1620,7 @@ void MarlinUI::host_notify(const char * const cstr) { if (status_scroll_offset < status_message.glyphs()) while (!START_OF_UTF8_CHAR(status_message[++status_scroll_offset])); else - status_scroll_offset = 0; + reset_status_scroll(); } char* MarlinUI::status_and_len(uint8_t &len) { @@ -1669,8 +1667,11 @@ void MarlinUI::host_notify(const char * const cstr) { void MarlinUI::abort_print() { #if HAS_MEDIA wait_for_heatup = wait_for_user = false; - card.abortFilePrintSoon(); - #endif + if (IS_SD_PRINTING()) + card.abortFilePrintSoon(); + else if (card.isMounted()) + card.closefile(); + #endif #ifdef ACTION_ON_CANCEL hostui.cancel(); #endif @@ -1698,6 +1699,16 @@ void MarlinUI::host_notify(const char * const cstr) { } #endif + /** + * - Synchronize and put up a wait screen + * - Wake the display + * - Tell the host to present a "Resume" option + * - Print "Paused" on the display + * - One of three possibilities follow: + * - If Parking, Print a message, send M125 P (which parks and waits), then M24 which will resume SD printing. + * - If media exists call M25 to pause the SD print. + * - For a host-only printer tell the host to pause the print in progress. + */ void MarlinUI::pause_print() { #if HAS_MARLINUI_MENU synchronize(GET_TEXT_F(MSG_PAUSING)); @@ -1884,7 +1895,7 @@ void MarlinUI::host_notify(const char * const cstr) { const PauseMode mode/*=PAUSE_MODE_SAME*/, const uint8_t extruder/*=active_extruder*/ ) { - pause_mode = mode; + if (mode != PAUSE_MODE_SAME) pause_mode = mode; ExtUI::pauseModeStatus = message; switch (message) { case PAUSE_MESSAGE_PARKING: ExtUI::onUserConfirmRequired(GET_TEXT_F(MSG_PAUSE_PRINT_PARKING)); break; diff --git a/Marlin/src/lcd/marlinui.h b/Marlin/src/lcd/marlinui.h index ff87852f119b..3388c2047bc4 100644 --- a/Marlin/src/lcd/marlinui.h +++ b/Marlin/src/lcd/marlinui.h @@ -297,14 +297,6 @@ class MarlinUI { static void sleep_display(const bool=true) IF_DISABLED(HAS_DISPLAY_SLEEP, {}); static void wake_display() { sleep_display(false); } - #if HAS_DWIN_E3V2_BASIC - static void refresh(); - #else - FORCE_INLINE static void refresh() { - TERN_(HAS_WIRED_LCD, refresh(LCDVIEW_CLEAR_CALL_REDRAW)); - } - #endif - #if HAS_PRINT_PROGRESS_PERMYRIAD typedef uint16_t progress_t; #define PROGRESS_SCALE 100U @@ -393,6 +385,7 @@ class MarlinUI { #if ENABLED(STATUS_MESSAGE_SCROLLING) static uint8_t status_scroll_offset; + static void reset_status_scroll() { status_scroll_offset = 0; } static void advance_status_scroll(); static char* status_and_len(uint8_t &len); #endif @@ -510,6 +503,11 @@ class MarlinUI { // Periodic or as-needed display update static void update() IF_DISABLED(HAS_UI_UPDATE, {}); + // Tell the screen to redraw on the next call + FORCE_INLINE static void refresh() { + TERN_(HAS_WIRED_LCD, refresh(LCDVIEW_CLEAR_CALL_REDRAW)); + } + #if HAS_DISPLAY static void abort_print(); diff --git a/Marlin/src/lcd/menu/menu_advanced.cpp b/Marlin/src/lcd/menu/menu_advanced.cpp index 840b658d09c9..22c0823f2613 100644 --- a/Marlin/src/lcd/menu/menu_advanced.cpp +++ b/Marlin/src/lcd/menu/menu_advanced.cpp @@ -562,24 +562,24 @@ void menu_backlash(); #if ENABLED(INPUT_SHAPING_X) editable.decimal = stepper.get_shaping_frequency(X_AXIS); if (editable.decimal) { - ACTION_ITEM_N(X_AXIS, MSG_SHAPING_DISABLE, []{ stepper.set_shaping_frequency(X_AXIS, 0.0f); ui.refresh(LCDVIEW_CLEAR_CALL_REDRAW); }); + ACTION_ITEM_N(X_AXIS, MSG_SHAPING_DISABLE, []{ stepper.set_shaping_frequency(X_AXIS, 0.0f); ui.refresh(); }); EDIT_ITEM_FAST_N(float41, X_AXIS, MSG_SHAPING_FREQ, &editable.decimal, min_frequency, 200.0f, []{ stepper.set_shaping_frequency(X_AXIS, editable.decimal); }); editable.decimal = stepper.get_shaping_damping_ratio(X_AXIS); EDIT_ITEM_FAST_N(float42_52, X_AXIS, MSG_SHAPING_ZETA, &editable.decimal, 0.0f, 1.0f, []{ stepper.set_shaping_damping_ratio(X_AXIS, editable.decimal); }); } else - ACTION_ITEM_N(X_AXIS, MSG_SHAPING_ENABLE, []{ stepper.set_shaping_frequency(X_AXIS, (SHAPING_FREQ_X) ?: (SHAPING_MIN_FREQ)); ui.refresh(LCDVIEW_CLEAR_CALL_REDRAW); }); + ACTION_ITEM_N(X_AXIS, MSG_SHAPING_ENABLE, []{ stepper.set_shaping_frequency(X_AXIS, (SHAPING_FREQ_X) ?: (SHAPING_MIN_FREQ)); ui.refresh(); }); #endif #if ENABLED(INPUT_SHAPING_Y) editable.decimal = stepper.get_shaping_frequency(Y_AXIS); if (editable.decimal) { - ACTION_ITEM_N(Y_AXIS, MSG_SHAPING_DISABLE, []{ stepper.set_shaping_frequency(Y_AXIS, 0.0f); ui.refresh(LCDVIEW_CLEAR_CALL_REDRAW); }); + ACTION_ITEM_N(Y_AXIS, MSG_SHAPING_DISABLE, []{ stepper.set_shaping_frequency(Y_AXIS, 0.0f); ui.refresh(); }); EDIT_ITEM_FAST_N(float41, Y_AXIS, MSG_SHAPING_FREQ, &editable.decimal, min_frequency, 200.0f, []{ stepper.set_shaping_frequency(Y_AXIS, editable.decimal); }); editable.decimal = stepper.get_shaping_damping_ratio(Y_AXIS); EDIT_ITEM_FAST_N(float42_52, Y_AXIS, MSG_SHAPING_ZETA, &editable.decimal, 0.0f, 1.0f, []{ stepper.set_shaping_damping_ratio(Y_AXIS, editable.decimal); }); } else - ACTION_ITEM_N(Y_AXIS, MSG_SHAPING_ENABLE, []{ stepper.set_shaping_frequency(Y_AXIS, (SHAPING_FREQ_Y) ?: (SHAPING_MIN_FREQ)); ui.refresh(LCDVIEW_CLEAR_CALL_REDRAW); }); + ACTION_ITEM_N(Y_AXIS, MSG_SHAPING_ENABLE, []{ stepper.set_shaping_frequency(Y_AXIS, (SHAPING_FREQ_Y) ?: (SHAPING_MIN_FREQ)); ui.refresh(); }); #endif END_MENU(); diff --git a/Marlin/src/lcd/menu/menu_main.cpp b/Marlin/src/lcd/menu/menu_main.cpp index 3cff167f3fc0..622b03379a5d 100644 --- a/Marlin/src/lcd/menu/menu_main.cpp +++ b/Marlin/src/lcd/menu/menu_main.cpp @@ -295,7 +295,7 @@ void menu_main() { #if ENABLED(TFT_COLOR_UI) // Menu display issue on item removal with multi language selection menu if (encoderTopLine > 0) encoderTopLine--; - ui.refresh(LCDVIEW_CLEAR_CALL_REDRAW); + ui.refresh(); #endif }); #endif @@ -412,7 +412,7 @@ void menu_main() { #if ENABLED(TFT_COLOR_UI) // Menu display issue on item removal with multi language selection menu if (encoderTopLine > 0) encoderTopLine--; - ui.refresh(LCDVIEW_CLEAR_CALL_REDRAW); + ui.refresh(); #endif }); #endif diff --git a/Marlin/src/module/motion.cpp b/Marlin/src/module/motion.cpp index c86c382ddcbc..c5e45899a19d 100644 --- a/Marlin/src/module/motion.cpp +++ b/Marlin/src/module/motion.cpp @@ -689,6 +689,17 @@ void do_blocking_move_to(const xyze_pos_t &raw, const_feedRate_t fr_mm_s/*=0.0f* fr_mm_s ); } + void do_blocking_move_to_xy(const_float_t rx, const_float_t ry, const_feedRate_t fr_mm_s/*=0.0*/) { + if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPGM("do_blocking_move_to_xy(", rx, ", ", ry, ", ", fr_mm_s, ")"); + do_blocking_move_to( + NUM_AXIS_LIST_(rx, ry, current_position.z, current_position.i, current_position.j, current_position.k, + current_position.u, current_position.v, current_position.w) + fr_mm_s + ); + } + void do_blocking_move_to_xy(const xy_pos_t &raw, const_feedRate_t fr_mm_s/*=0.0f*/) { + do_blocking_move_to_xy(raw.x, raw.y, fr_mm_s); + } #endif #if HAS_Z_AXIS @@ -696,122 +707,108 @@ void do_blocking_move_to(const xyze_pos_t &raw, const_feedRate_t fr_mm_s/*=0.0f* if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPGM("do_blocking_move_to_z(", rz, ", ", fr_mm_s, ")"); do_blocking_move_to_xy_z(current_position, rz, fr_mm_s); } + void do_blocking_move_to_xy_z(const xy_pos_t &raw, const_float_t z, const_feedRate_t fr_mm_s/*=0.0f*/) { + do_blocking_move_to( + NUM_AXIS_LIST_(raw.x, raw.y, z, current_position.i, current_position.j, current_position.k, + current_position.u, current_position.v, current_position.w) + fr_mm_s + ); + } + void do_z_clearance(const_float_t zclear, const bool with_probe/*=true*/, const bool lower_allowed/*=false*/) { + UNUSED(with_probe); + float zdest = zclear; + TERN_(HAS_BED_PROBE, if (with_probe && probe.offset.z < 0) zdest -= probe.offset.z); + NOMORE(zdest, Z_MAX_POS); + if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPGM("do_z_clearance(", zclear, " [", current_position.z, " to ", zdest, "], ", lower_allowed, ")"); + if ((!lower_allowed && zdest < current_position.z) || zdest == current_position.z) return; + do_blocking_move_to_z(zdest, TERN(HAS_BED_PROBE, z_probe_fast_mm_s, homing_feedrate(Z_AXIS))); + } + void do_z_clearance_by(const_float_t zclear) { + if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPGM("do_z_clearance_by(", zclear, ")"); + do_z_clearance(current_position.z + zclear, false); + } + void do_move_after_z_homing() { + DEBUG_SECTION(mzah, "do_move_after_z_homing", DEBUGGING(LEVELING)); + float zpos = 0; + #ifdef Z_POST_CLEARANCE // (is always defined) + NOLESS(zpos, Z_POST_CLEARANCE); + #endif + #if ENABLED(USE_PROBE_FOR_Z_HOMING) + NOLESS(zpos, Z_AFTER_PROBING); + #endif + if (zpos) do_z_clearance(zpos, true, true); + } #endif #if HAS_I_AXIS - void do_blocking_move_to_i(const_float_t ri, const_feedRate_t fr_mm_s/*=0.0*/) { - do_blocking_move_to_xyz_i(current_position, ri, fr_mm_s); - } void do_blocking_move_to_xyz_i(const xyze_pos_t &raw, const_float_t i, const_feedRate_t fr_mm_s/*=0.0f*/) { do_blocking_move_to( NUM_AXIS_LIST_(raw.x, raw.y, raw.z, i, raw.j, raw.k, raw.u, raw.v, raw.w) fr_mm_s ); } + void do_blocking_move_to_i(const_float_t ri, const_feedRate_t fr_mm_s/*=0.0*/) { + do_blocking_move_to_xyz_i(current_position, ri, fr_mm_s); + } #endif #if HAS_J_AXIS - void do_blocking_move_to_j(const_float_t rj, const_feedRate_t fr_mm_s/*=0.0*/) { - do_blocking_move_to_xyzi_j(current_position, rj, fr_mm_s); - } void do_blocking_move_to_xyzi_j(const xyze_pos_t &raw, const_float_t j, const_feedRate_t fr_mm_s/*=0.0f*/) { do_blocking_move_to( NUM_AXIS_LIST_(raw.x, raw.y, raw.z, raw.i, j, raw.k, raw.u, raw.v, raw.w) fr_mm_s ); } + void do_blocking_move_to_j(const_float_t rj, const_feedRate_t fr_mm_s/*=0.0*/) { + do_blocking_move_to_xyzi_j(current_position, rj, fr_mm_s); + } #endif #if HAS_K_AXIS - void do_blocking_move_to_k(const_float_t rk, const_feedRate_t fr_mm_s/*=0.0*/) { - do_blocking_move_to_xyzij_k(current_position, rk, fr_mm_s); - } void do_blocking_move_to_xyzij_k(const xyze_pos_t &raw, const_float_t k, const_feedRate_t fr_mm_s/*=0.0f*/) { do_blocking_move_to( NUM_AXIS_LIST_(raw.x, raw.y, raw.z, raw.i, raw.j, k, raw.u, raw.v, raw.w) fr_mm_s ); } + void do_blocking_move_to_k(const_float_t rk, const_feedRate_t fr_mm_s/*=0.0*/) { + do_blocking_move_to_xyzij_k(current_position, rk, fr_mm_s); + } #endif #if HAS_U_AXIS - void do_blocking_move_to_u(const_float_t ru, const_feedRate_t fr_mm_s/*=0.0*/) { - do_blocking_move_to_xyzijk_u(current_position, ru, fr_mm_s); - } void do_blocking_move_to_xyzijk_u(const xyze_pos_t &raw, const_float_t u, const_feedRate_t fr_mm_s/*=0.0f*/) { do_blocking_move_to( NUM_AXIS_LIST_(raw.x, raw.y, raw.z, raw.i, raw.j, raw.k, u, raw.v, raw.w) fr_mm_s ); } + void do_blocking_move_to_u(const_float_t ru, const_feedRate_t fr_mm_s/*=0.0*/) { + do_blocking_move_to_xyzijk_u(current_position, ru, fr_mm_s); + } #endif #if HAS_V_AXIS - void do_blocking_move_to_v(const_float_t rv, const_feedRate_t fr_mm_s/*=0.0*/) { - do_blocking_move_to_xyzijku_v(current_position, rv, fr_mm_s); - } void do_blocking_move_to_xyzijku_v(const xyze_pos_t &raw, const_float_t v, const_feedRate_t fr_mm_s/*=0.0f*/) { do_blocking_move_to( NUM_AXIS_LIST_(raw.x, raw.y, raw.z, raw.i, raw.j, raw.k, raw.u, v, raw.w) fr_mm_s ); } + void do_blocking_move_to_v(const_float_t rv, const_feedRate_t fr_mm_s/*=0.0*/) { + do_blocking_move_to_xyzijku_v(current_position, rv, fr_mm_s); + } #endif #if HAS_W_AXIS - void do_blocking_move_to_w(const_float_t rw, const_feedRate_t fr_mm_s/*=0.0*/) { - do_blocking_move_to_xyzijkuv_w(current_position, rw, fr_mm_s); - } void do_blocking_move_to_xyzijkuv_w(const xyze_pos_t &raw, const_float_t w, const_feedRate_t fr_mm_s/*=0.0f*/) { do_blocking_move_to( NUM_AXIS_LIST_(raw.x, raw.y, raw.z, raw.i, raw.j, raw.k, raw.u, raw.v, w) fr_mm_s ); } -#endif - -#if HAS_Y_AXIS - void do_blocking_move_to_xy(const_float_t rx, const_float_t ry, const_feedRate_t fr_mm_s/*=0.0*/) { - if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPGM("do_blocking_move_to_xy(", rx, ", ", ry, ", ", fr_mm_s, ")"); - do_blocking_move_to( - NUM_AXIS_LIST_(rx, ry, current_position.z, current_position.i, current_position.j, current_position.k, - current_position.u, current_position.v, current_position.w) - fr_mm_s - ); - } - void do_blocking_move_to_xy(const xy_pos_t &raw, const_feedRate_t fr_mm_s/*=0.0f*/) { - do_blocking_move_to_xy(raw.x, raw.y, fr_mm_s); - } -#endif - -#if HAS_Z_AXIS - void do_blocking_move_to_xy_z(const xy_pos_t &raw, const_float_t z, const_feedRate_t fr_mm_s/*=0.0f*/) { - do_blocking_move_to( - NUM_AXIS_LIST_(raw.x, raw.y, z, current_position.i, current_position.j, current_position.k, - current_position.u, current_position.v, current_position.w) - fr_mm_s - ); - } - void do_z_clearance(const_float_t zclear, const bool with_probe/*=true*/, const bool lower_allowed/*=false*/) { - UNUSED(with_probe); - float zdest = zclear; - TERN_(HAS_BED_PROBE, if (with_probe && probe.offset.z < 0) zdest -= probe.offset.z); - NOMORE(zdest, Z_MAX_POS); - if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPGM("do_z_clearance(", zclear, " [", current_position.z, " to ", zdest, "], ", lower_allowed, ")"); - if ((!lower_allowed && zdest < current_position.z) || zdest == current_position.z) return; - do_blocking_move_to_z(zdest, TERN(HAS_BED_PROBE, z_probe_fast_mm_s, homing_feedrate(Z_AXIS))); - } - void do_z_clearance_by(const_float_t zclear) { - if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPGM("do_z_clearance_by(", zclear, ")"); - do_z_clearance(current_position.z + zclear, false); - } - void do_move_after_z_homing() { - DEBUG_SECTION(mzah, "do_move_after_z_homing", DEBUGGING(LEVELING)); - #if defined(Z_AFTER_HOMING) || ALL(DWIN_LCD_PROUI, INDIVIDUAL_AXIS_HOMING_SUBMENU, MESH_BED_LEVELING) - do_z_clearance(Z_POST_CLEARANCE, true, true); - #elif ENABLED(USE_PROBE_FOR_Z_HOMING) - probe.move_z_after_probing(); - #endif + void do_blocking_move_to_w(const_float_t rw, const_feedRate_t fr_mm_s/*=0.0*/) { + do_blocking_move_to_xyzijkuv_w(current_position, rw, fr_mm_s); } #endif diff --git a/Marlin/src/module/stepper.cpp b/Marlin/src/module/stepper.cpp index 9380ff79f4c0..851fa452e7b9 100644 --- a/Marlin/src/module/stepper.cpp +++ b/Marlin/src/module/stepper.cpp @@ -203,12 +203,17 @@ uint32_t Stepper::acceleration_time, Stepper::deceleration_time; hal_timer_t Stepper::time_spent_in_isr = 0, Stepper::time_spent_out_isr = 0; #endif +#if ENABLED(ADAPTIVE_STEP_SMOOTHING) + // Oversampling factor (log2(multiplier)) to increase temporal resolution of axis + uint8_t Stepper::oversampling_factor; +#else + constexpr uint8_t Stepper::oversampling_factor; // = 0 +#endif + #if ENABLED(FREEZE_FEATURE) bool Stepper::frozen; // = false #endif -IF_DISABLED(ADAPTIVE_STEP_SMOOTHING, constexpr) uint8_t Stepper::oversampling_factor; - xyze_long_t Stepper::delta_error{0}; xyze_long_t Stepper::advance_dividend{0}; @@ -544,6 +549,21 @@ void Stepper::enable_axis(const AxisEnum axis) { mark_axis_enabled(axis); } +/** + * Mark an axis as disabled and power off its stepper(s). + * If one of the axis steppers is still in use by a non-disabled axis the axis will remain powered. + * DISCUSSION: It's basically just stepper ENA pins that are shared across axes, not whole steppers. + * Used on MCUs with a shortage of pins. We already track the overlap of ENA pins, so now + * we just need stronger logic to track which ENA pins are being set more than once. + * + * It would be better to use a bit mask (i.e., Flags). + * While the method try_to_disable in gcode/control/M17_M18_M84.cpp does use the + * bit mask, it is still only at the axis level. + * TODO: Power off steppers that don't share another axis. Currently axis-based steppers turn off as a unit. + * So we'd need to power off the off axis, then power on the on axis (for a microsecond). + * A global solution would keep a usage count when enabling or disabling a stepper, but this partially + * defeats the purpose of an on/off mask. + */ bool Stepper::disable_axis(const AxisEnum axis) { mark_axis_disabled(axis); @@ -558,6 +578,7 @@ bool Stepper::disable_axis(const AxisEnum axis) { default: break; } } + return can_disable; } diff --git a/Marlin/src/module/stepper.h b/Marlin/src/module/stepper.h index 99fd2d293609..8c13831d9e7b 100644 --- a/Marlin/src/module/stepper.h +++ b/Marlin/src/module/stepper.h @@ -377,7 +377,7 @@ class Stepper { #if ENABLED(ADAPTIVE_STEP_SMOOTHING) static uint8_t oversampling_factor; // Oversampling factor (log2(multiplier)) to increase temporal resolution of axis #else - static constexpr uint8_t oversampling_factor = 0; + static constexpr uint8_t oversampling_factor = 0; // Without smoothing apply no shift #endif // Delta error variables for the Bresenham line tracer diff --git a/Marlin/src/module/temperature.cpp b/Marlin/src/module/temperature.cpp index 9b071ecc3650..53b9f37fb2ef 100644 --- a/Marlin/src/module/temperature.cpp +++ b/Marlin/src/module/temperature.cpp @@ -723,12 +723,12 @@ volatile bool Temperature::raw_temps_ready = false; TERN_(HAS_FAN_LOGIC, fan_update_ms = next_temp_ms + fan_update_interval_ms); - TERN_(EXTENSIBLE_UI, ExtUI::onPidTuning(ExtUI::result_t::PID_STARTED)); + TERN_(EXTENSIBLE_UI, ExtUI::onPIDTuning(ExtUI::result_t::PID_STARTED)); TERN_(PROUI_PID_TUNE, dwinPidTuning(isbed ? PIDTEMPBED_START : PIDTEMP_START)); if (target > GHV(CHAMBER_MAX_TARGET, BED_MAX_TARGET, hotend_max_target(heater_id))) { SERIAL_ECHOPGM(STR_PID_AUTOTUNE); SERIAL_ECHOLNPGM(STR_PID_TEMP_TOO_HIGH); - TERN_(EXTENSIBLE_UI, ExtUI::onPidTuning(ExtUI::result_t::PID_TEMP_TOO_HIGH)); + TERN_(EXTENSIBLE_UI, ExtUI::onPIDTuning(ExtUI::result_t::PID_TEMP_TOO_HIGH)); TERN_(PROUI_PID_TUNE, dwinPidTuning(PID_TEMP_TOO_HIGH)); TERN_(HOST_PROMPT_SUPPORT, hostui.notify(GET_TEXT_F(MSG_PID_TEMP_TOO_HIGH))); return; @@ -822,7 +822,7 @@ volatile bool Temperature::raw_temps_ready = false; #endif if (current_temp > target + MAX_OVERSHOOT_PID_AUTOTUNE) { SERIAL_ECHOPGM(STR_PID_AUTOTUNE); SERIAL_ECHOLNPGM(STR_PID_TEMP_TOO_HIGH); - TERN_(EXTENSIBLE_UI, ExtUI::onPidTuning(ExtUI::result_t::PID_TEMP_TOO_HIGH)); + TERN_(EXTENSIBLE_UI, ExtUI::onPIDTuning(ExtUI::result_t::PID_TEMP_TOO_HIGH)); TERN_(PROUI_PID_TUNE, dwinPidTuning(PID_TEMP_TOO_HIGH)); TERN_(HOST_PROMPT_SUPPORT, hostui.notify(GET_TEXT_F(MSG_PID_TEMP_TOO_HIGH))); break; @@ -861,7 +861,7 @@ volatile bool Temperature::raw_temps_ready = false; if ((ms - _MIN(t1, t2)) > MIN_TO_MS(PID_AUTOTUNE_MAX_CYCLE_MINS)) { TERN_(DWIN_CREALITY_LCD, dwinPopupTemperature(0)); TERN_(PROUI_PID_TUNE, dwinPidTuning(PID_TUNING_TIMEOUT)); - TERN_(EXTENSIBLE_UI, ExtUI::onPidTuning(ExtUI::result_t::PID_TUNING_TIMEOUT)); + TERN_(EXTENSIBLE_UI, ExtUI::onPIDTuning(ExtUI::result_t::PID_TUNING_TIMEOUT)); TERN_(HOST_PROMPT_SUPPORT, hostui.notify(GET_TEXT_F(MSG_PID_TIMEOUT))); SERIAL_ECHOPGM(STR_PID_AUTOTUNE); SERIAL_ECHOLNPGM(STR_PID_TIMEOUT); break; @@ -918,8 +918,8 @@ volatile bool Temperature::raw_temps_ready = false; disable_all_heaters(); EXIT_M303: - TERN_(PRINTER_EVENT_LEDS, printerEventLEDs.onPidTuningDone(oldcolor)); - TERN_(EXTENSIBLE_UI, ExtUI::onPidTuning(ExtUI::result_t::PID_DONE)); + TERN_(PRINTER_EVENT_LEDS, printerEventLEDs.onPIDTuningDone(oldcolor)); + TERN_(EXTENSIBLE_UI, ExtUI::onPIDTuning(ExtUI::result_t::PID_DONE)); TERN_(PROUI_PID_TUNE, dwinPidTuning(AUTOTUNE_DONE)); TERN_(TEMP_TUNING_MAINTAIN_FAN, adaptive_fan_slowing = true); return; diff --git a/Marlin/src/sd/cardreader.cpp b/Marlin/src/sd/cardreader.cpp index ae7415548213..25a30585f81f 100644 --- a/Marlin/src/sd/cardreader.cpp +++ b/Marlin/src/sd/cardreader.cpp @@ -34,8 +34,6 @@ #if ENABLED(DWIN_CREALITY_LCD) #include "../lcd/e3v2/creality/dwin.h" -#elif ENABLED(DWIN_LCD_PROUI) - #include "../lcd/e3v2/proui/dwin.h" #endif #include "../module/planner.h" // for synchronize