|
@@ -252,7 +252,7 @@ static void lcd_goto_menu(menuFunc_t menu, const uint32_t encoder=0, const bool
|
252
|
252
|
if (feedback) lcd_quick_feedback();
|
253
|
253
|
|
254
|
254
|
// For LCD_PROGRESS_BAR re-initialize the custom characters
|
255
|
|
- #if defined(LCD_PROGRESS_BAR) && defined(SDSUPPORT) && !defined(DOGLCD)
|
|
255
|
+ #ifdef LCD_PROGRESS_BAR
|
256
|
256
|
lcd_set_custom_characters(menu == lcd_status_screen);
|
257
|
257
|
#endif
|
258
|
258
|
}
|
|
@@ -262,29 +262,32 @@ static void lcd_goto_menu(menuFunc_t menu, const uint32_t encoder=0, const bool
|
262
|
262
|
static void lcd_status_screen()
|
263
|
263
|
{
|
264
|
264
|
encoderRateMultiplierEnabled = false;
|
265
|
|
- #if defined(LCD_PROGRESS_BAR) && defined(SDSUPPORT) && !defined(DOGLCD)
|
266
|
|
- uint16_t mil = millis();
|
|
265
|
+
|
|
266
|
+ #ifdef LCD_PROGRESS_BAR
|
|
267
|
+ unsigned long ms = millis();
|
267
|
268
|
#ifndef PROGRESS_MSG_ONCE
|
268
|
|
- if (mil > progressBarTick + PROGRESS_BAR_MSG_TIME + PROGRESS_BAR_BAR_TIME) {
|
269
|
|
- progressBarTick = mil;
|
|
269
|
+ if (ms > progressBarTick + PROGRESS_BAR_MSG_TIME + PROGRESS_BAR_BAR_TIME) {
|
|
270
|
+ progressBarTick = ms;
|
270
|
271
|
}
|
271
|
272
|
#endif
|
272
|
273
|
#if PROGRESS_MSG_EXPIRE > 0
|
273
|
|
- // keep the message alive if paused, count down otherwise
|
274
|
|
- if (messageTick > 0) {
|
|
274
|
+ // Handle message expire
|
|
275
|
+ if (expireStatusMillis > 0) {
|
275
|
276
|
if (card.isFileOpen()) {
|
|
277
|
+ // Expire the message when printing is active
|
276
|
278
|
if (IS_SD_PRINTING) {
|
277
|
|
- if ((mil-messageTick) >= PROGRESS_MSG_EXPIRE) {
|
|
279
|
+ // Expire the message when printing is active
|
|
280
|
+ if (ms >= expireStatusMillis) {
|
278
|
281
|
lcd_status_message[0] = '\0';
|
279
|
|
- messageTick = 0;
|
|
282
|
+ expireStatusMillis = 0;
|
280
|
283
|
}
|
281
|
284
|
}
|
282
|
285
|
else {
|
283
|
|
- messageTick += LCD_UPDATE_INTERVAL;
|
|
286
|
+ expireStatusMillis += LCD_UPDATE_INTERVAL;
|
284
|
287
|
}
|
285
|
288
|
}
|
286
|
289
|
else {
|
287
|
|
- messageTick = 0;
|
|
290
|
+ expireStatusMillis = 0;
|
288
|
291
|
}
|
289
|
292
|
}
|
290
|
293
|
#endif
|
|
@@ -324,7 +327,7 @@ static void lcd_status_screen()
|
324
|
327
|
{
|
325
|
328
|
lcd_goto_menu(lcd_main_menu);
|
326
|
329
|
lcd_implementation_init( // to maybe revive the LCD if static electricity killed it.
|
327
|
|
- #if defined(LCD_PROGRESS_BAR) && defined(SDSUPPORT) && !defined(DOGLCD)
|
|
330
|
+ #ifdef LCD_PROGRESS_BAR
|
328
|
331
|
currentMenu == lcd_status_screen
|
329
|
332
|
#endif
|
330
|
333
|
);
|
|
@@ -380,7 +383,7 @@ static void lcd_sdcard_stop() {
|
380
|
383
|
card.closefile();
|
381
|
384
|
autotempShutdown();
|
382
|
385
|
cancel_heatup = true;
|
383
|
|
- lcd_setstatus(MSG_PRINT_ABORTED);
|
|
386
|
+ lcd_setstatus(MSG_PRINT_ABORTED, true);
|
384
|
387
|
}
|
385
|
388
|
|
386
|
389
|
/* Menu implementation */
|
|
@@ -1275,7 +1278,7 @@ void lcd_update() {
|
1275
|
1278
|
lcdDrawUpdate = 2;
|
1276
|
1279
|
lcd_oldcardstatus = IS_SD_INSERTED;
|
1277
|
1280
|
lcd_implementation_init( // to maybe revive the LCD if static electricity killed it.
|
1278
|
|
- #if defined(LCD_PROGRESS_BAR) && defined(SDSUPPORT) && !defined(DOGLCD)
|
|
1281
|
+ #ifdef LCD_PROGRESS_BAR
|
1279
|
1282
|
currentMenu == lcd_status_screen
|
1280
|
1283
|
#endif
|
1281
|
1284
|
);
|
|
@@ -1393,7 +1396,7 @@ void lcd_ignore_click(bool b) {
|
1393
|
1396
|
wait_for_unclick = false;
|
1394
|
1397
|
}
|
1395
|
1398
|
|
1396
|
|
-void lcd_finishstatus() {
|
|
1399
|
+void lcd_finishstatus(bool persist=false) {
|
1397
|
1400
|
int len = lcd_strlen(lcd_status_message);
|
1398
|
1401
|
if (len > 0) {
|
1399
|
1402
|
while (len < LCD_WIDTH) {
|
|
@@ -1401,11 +1404,11 @@ void lcd_finishstatus() {
|
1401
|
1404
|
}
|
1402
|
1405
|
}
|
1403
|
1406
|
lcd_status_message[LCD_WIDTH] = '\0';
|
1404
|
|
- #if defined(LCD_PROGRESS_BAR) && defined(SDSUPPORT) && !defined(DOGLCD)
|
|
1407
|
+ #ifdef LCD_PROGRESS_BAR
|
|
1408
|
+ progressBarTick = millis();
|
1405
|
1409
|
#if PROGRESS_MSG_EXPIRE > 0
|
1406
|
|
- messageTick =
|
|
1410
|
+ expireStatusMillis = persist ? 0 : progressBarTick + PROGRESS_MSG_EXPIRE;
|
1407
|
1411
|
#endif
|
1408
|
|
- progressBarTick = millis();
|
1409
|
1412
|
#endif
|
1410
|
1413
|
lcdDrawUpdate = 2;
|
1411
|
1414
|
|
|
@@ -1414,21 +1417,26 @@ void lcd_finishstatus() {
|
1414
|
1417
|
#endif
|
1415
|
1418
|
}
|
1416
|
1419
|
|
1417
|
|
-void lcd_setstatus(const char* message) {
|
|
1420
|
+#if defined(LCD_PROGRESS_BAR) && PROGRESS_MSG_EXPIRE > 0
|
|
1421
|
+ void dontExpireStatus() { expireStatusMillis = 0; }
|
|
1422
|
+#endif
|
|
1423
|
+
|
|
1424
|
+void lcd_setstatus(const char* message, bool persist) {
|
1418
|
1425
|
if (lcd_status_message_level > 0) return;
|
1419
|
1426
|
strncpy(lcd_status_message, message, LCD_WIDTH);
|
1420
|
|
- lcd_finishstatus();
|
|
1427
|
+ lcd_finishstatus(persist);
|
1421
|
1428
|
}
|
1422
|
1429
|
|
1423
|
|
-void lcd_setstatuspgm(const char* message) {
|
1424
|
|
- if (lcd_status_message_level > 0) return;
|
1425
|
|
- strncpy_P(lcd_status_message, message, LCD_WIDTH);
|
1426
|
|
- lcd_finishstatus();
|
|
1430
|
+void lcd_setstatuspgm(const char* message, uint8_t level) {
|
|
1431
|
+ if (level >= lcd_status_message_level) {
|
|
1432
|
+ strncpy_P(lcd_status_message, message, LCD_WIDTH);
|
|
1433
|
+ lcd_status_message_level = level;
|
|
1434
|
+ lcd_finishstatus(level > 0);
|
|
1435
|
+ }
|
1427
|
1436
|
}
|
1428
|
1437
|
|
1429
|
1438
|
void lcd_setalertstatuspgm(const char* message) {
|
1430
|
|
- lcd_setstatuspgm(message);
|
1431
|
|
- lcd_status_message_level = 1;
|
|
1439
|
+ lcd_setstatuspgm(message, 1);
|
1432
|
1440
|
#ifdef ULTIPANEL
|
1433
|
1441
|
lcd_return_to_status();
|
1434
|
1442
|
#endif
|