|
@@ -79,7 +79,6 @@ int inbound_count;
|
79
|
79
|
|
80
|
80
|
// For sending print completion messages
|
81
|
81
|
bool last_printing_status = false;
|
82
|
|
-uint8_t last_percent_done = 100;
|
83
|
82
|
|
84
|
83
|
// Everything written needs the high bit set.
|
85
|
84
|
void write_to_lcd_P(const char * const message) {
|
|
@@ -442,25 +441,18 @@ void lcd_update() {
|
442
|
441
|
// The way last printing status works is simple:
|
443
|
442
|
// The UI needs to see at least one TQ which is not 100%
|
444
|
443
|
// and then when the print is complete, one which is.
|
445
|
|
- if (card.sdprinting) {
|
446
|
|
- if (card.percentDone() != last_percent_done) {
|
447
|
|
- char message_buffer[10];
|
448
|
|
- last_percent_done = card.percentDone();
|
449
|
|
- sprintf_P(message_buffer, PSTR("{TQ:%03i}"), last_percent_done);
|
450
|
|
- write_to_lcd(message_buffer);
|
451
|
|
-
|
452
|
|
- if (!last_printing_status) last_printing_status = true;
|
453
|
|
- }
|
454
|
|
- }
|
455
|
|
- else {
|
456
|
|
- // If there was a print in progress, we need to emit the final
|
457
|
|
- // print status as {TQ:100}. Reset last percent done so a new print will
|
458
|
|
- // issue a percent of 0.
|
459
|
|
- if (last_printing_status) {
|
460
|
|
- last_printing_status = false;
|
461
|
|
- last_percent_done = 100;
|
462
|
|
- write_to_lcd_P(PSTR("{TQ:100}"));
|
463
|
|
- }
|
|
444
|
+ static uint8_t last_percent_done = 100;
|
|
445
|
+
|
|
446
|
+ // If there was a print in progress, we need to emit the final
|
|
447
|
+ // print status as {TQ:100}. Reset last percent done so a new print will
|
|
448
|
+ // issue a percent of 0.
|
|
449
|
+ const uint8_t percent_done = card.sdprinting ? card.percentDone() : last_printing_status ? 100 : 0;
|
|
450
|
+ if (percent_done != last_percent_done) {
|
|
451
|
+ char message_buffer[10];
|
|
452
|
+ sprintf_P(message_buffer, PSTR("{TQ:%03i}"), percent_done);
|
|
453
|
+ write_to_lcd(message_buffer);
|
|
454
|
+ last_percent_done = percent_done;
|
|
455
|
+ last_printing_status = card.sdprinting;
|
464
|
456
|
}
|
465
|
457
|
#endif
|
466
|
458
|
}
|