Skip to content

Commit

Permalink
🩹 Misc. changes from ProUI / ExtUI updates (MarlinFirmware#26928)
Browse files Browse the repository at this point in the history
  • Loading branch information
thinkyhead authored Mar 31, 2024
1 parent 1759429 commit 466282f
Show file tree
Hide file tree
Showing 48 changed files with 363 additions and 244 deletions.
2 changes: 1 addition & 1 deletion Marlin/src/feature/leds/printer_event_leds.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 5 additions & 1 deletion Marlin/src/feature/pause.h
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion Marlin/src/gcode/temp/M303.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
2 changes: 1 addition & 1 deletion Marlin/src/lcd/dogm/status_screen_lite_ST7920.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 6 additions & 0 deletions Marlin/src/lcd/e3v2/common/dwin_api.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions Marlin/src/lcd/e3v2/common/dwin_font.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@
*/
#pragma once

#include <stdint.h>

typedef uint8_t fontid_t;

/**
Expand Down
2 changes: 0 additions & 2 deletions Marlin/src/lcd/e3v2/creality/dwin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions Marlin/src/lcd/e3v2/jyersui/dwin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
4 changes: 0 additions & 4 deletions Marlin/src/lcd/e3v2/marlinui/dwin_lcd.h
Original file line number Diff line number Diff line change
Expand Up @@ -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)
6 changes: 6 additions & 0 deletions Marlin/src/lcd/e3v2/marlinui/marlinui_dwin.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion Marlin/src/lcd/e3v2/marlinui/ui_common.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 1 addition & 4 deletions Marlin/src/lcd/e3v2/proui/dwin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand Down
14 changes: 12 additions & 2 deletions Marlin/src/lcd/e3v2/proui/dwin_defines.h
Original file line number Diff line number Diff line change
Expand Up @@ -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

/**
Expand Down
12 changes: 7 additions & 5 deletions Marlin/src/lcd/extui/anycubic_chiron/chiron_extui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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() {}
Expand Down Expand Up @@ -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
9 changes: 7 additions & 2 deletions Marlin/src/lcd/extui/anycubic_i3mega/anycubic_extui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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() {}
Expand Down Expand Up @@ -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
8 changes: 4 additions & 4 deletions Marlin/src/lcd/extui/anycubic_i3mega/anycubic_i3mega_lcd.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down Expand Up @@ -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;

Expand Down Expand Up @@ -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
}
Expand Down
10 changes: 6 additions & 4 deletions Marlin/src/lcd/extui/anycubic_vyper/vyper_extui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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(); }
Expand Down Expand Up @@ -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;
Expand All @@ -148,7 +150,7 @@ namespace ExtUI {
#endif

void onSteppersDisabled() {}
void onSteppersEnabled() {}
void onSteppersEnabled() {}
}

#endif // ANYCUBIC_LCD_VYPER
4 changes: 2 additions & 2 deletions Marlin/src/lcd/extui/dgus/DGUSScreenHandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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);
}

Expand Down
6 changes: 3 additions & 3 deletions Marlin/src/lcd/extui/dgus/DGUSScreenHandlerBase.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
6 changes: 4 additions & 2 deletions Marlin/src/lcd/extui/dgus/dgus_extui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ namespace ExtUI {

void onHomingStart() {}
void onHomingDone() {}

void onPrintDone() {}

void onFactoryReset() {}
Expand Down Expand Up @@ -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:
Expand All @@ -165,7 +167,7 @@ namespace ExtUI {
#endif

void onSteppersDisabled() {}
void onSteppersEnabled() {}
void onSteppersEnabled() {}
}

#endif // HAS_DGUS_LCD_CLASSIC
16 changes: 6 additions & 10 deletions Marlin/src/lcd/extui/dgus_e3s1pro/dgus_e3s1pro_extui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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);
}
Expand Down
Loading

0 comments on commit 466282f

Please sign in to comment.