@@ -66,7 +66,14 @@ bool DGUSScreenHandler::wait_continue = false;
6666
6767bool DGUSScreenHandler::leveling_active = false ;
6868
69+ uint8_t DGUSScreenHandler::language = 0 ;
70+
71+ #if ENABLED(FILAMENT_SWITCH_AND_MOTION)
72+ uint16_t DGUSScreenHandler::jam_length = DGUS_DEFAULT_JAM_LEN ;
73+ #endif
74+
6975millis_t DGUSScreenHandler::status_expire = 0 ;
76+ char DGUSScreenHandler::standing_status[] = " " ;
7077millis_t DGUSScreenHandler::eeprom_save = 0 ;
7178
7279void DGUSScreenHandler::init () {
@@ -135,7 +142,7 @@ void DGUSScreenHandler::loop() {
135142 }
136143
137144 if (status_expire > 0 && ELAPSED (ms, status_expire)) {
138- setStatusMessage (FPSTR ( NUL_STR ) , 0 );
145+ setStatusMessage (standing_status , 0 ); // Back to Marlin's own status
139146 return ;
140147 }
141148
@@ -191,6 +198,7 @@ void DGUSScreenHandler::storeSettings(char *buff) {
191198 data.volume = dgus.getVolume ();
192199 data.brightness = dgus.getBrightness ();
193200 data.abl_okay = (ExtUI::getLevelingActive () && ExtUI::getLevelingIsValid ());
201+ data.language = language;
194202
195203 memcpy (buff, &data, sizeof (data));
196204}
@@ -204,6 +212,7 @@ void DGUSScreenHandler::loadSettings(const char *buff) {
204212
205213 dgus.setVolume (data.initialized ? data.volume : DGUS_DEFAULT_VOLUME );
206214 dgus.setBrightness (data.initialized ? data.brightness : DGUS_DEFAULT_BRIGHTNESS );
215+ language = data.initialized ? data.language : 0 ;
207216
208217 if (data.initialized ) {
209218 leveling_active = (data.abl_okay && ExtUI::getLevelingIsValid ());
@@ -372,15 +381,28 @@ void DGUSScreenHandler::setMessageLine_P(PGM_P const msg, const uint8_t line) {
372381}
373382
374383void DGUSScreenHandler::setStatusMessage (const char * msg, const millis_t duration) {
375- dgus.writeString ((uint16_t )DGUS_Addr::MESSAGE_Status, msg, DGUS_STATUS_LEN , false , true );
384+ dgus.writeString ((uint16_t )DGUS_Addr::MESSAGE_Status, msg, DGUS_STATUS_LEN , true , false , false );
376385 status_expire = (duration > 0 ? ExtUI::safe_millis () + duration : 0 );
377386}
378387
379388void DGUSScreenHandler::setStatusMessage (FSTR_P const fmsg, const millis_t duration) {
380- dgus.writeString ((uint16_t )DGUS_Addr::MESSAGE_Status, fmsg, DGUS_STATUS_LEN , false , true );
389+ dgus.writeString ((uint16_t )DGUS_Addr::MESSAGE_Status, fmsg, DGUS_STATUS_LEN , true , false , false );
381390 status_expire = (duration > 0 ? ExtUI::safe_millis () + duration : 0 );
382391}
383392
393+ static PGMSTR (k_machine_name, MACHINE_NAME );
394+
395+ // Marlin's own status ("<machine name> Ready.", "Printing...") stays on screen until the next one, and comes
396+ // back when a screen message expires. The machine name has its own field, so drop it from the message.
397+ void DGUSScreenHandler::setStandingStatus (const char * const msg) {
398+ const char *m = msg;
399+ const size_t n = strlen_P (k_machine_name);
400+ if (n && strncmp_P (m, k_machine_name, n) == 0 && m[n] == ' ' ) m += n + 1 ;
401+ strncpy (standing_status, m, DGUS_STATUS_LEN );
402+ standing_status[DGUS_STATUS_LEN ] = ' \0 ' ;
403+ setStatusMessage (standing_status, 0 );
404+ }
405+
384406void DGUSScreenHandler::showWaitScreen (const DGUS_ScreenID return_screenID, const bool has_continue/* =false*/ ) {
385407 if (return_screenID != DGUS_ScreenID::WAIT )
386408 wait_return_screenID = return_screenID;
0 commit comments