mirror of
https://github.com/MarlinFirmware/Marlin.git
synced 2024-12-02 08:09:36 +00:00
Reduce TQ message code size
This commit is contained in:
parent
b04e0c0cbb
commit
8c40f0c6c7
@ -79,7 +79,6 @@ int inbound_count;
|
|||||||
|
|
||||||
// For sending print completion messages
|
// For sending print completion messages
|
||||||
bool last_printing_status = false;
|
bool last_printing_status = false;
|
||||||
uint8_t last_percent_done = 100;
|
|
||||||
|
|
||||||
// Everything written needs the high bit set.
|
// Everything written needs the high bit set.
|
||||||
void write_to_lcd_P(const char * const message) {
|
void write_to_lcd_P(const char * const message) {
|
||||||
@ -442,25 +441,18 @@ void lcd_update() {
|
|||||||
// The way last printing status works is simple:
|
// The way last printing status works is simple:
|
||||||
// The UI needs to see at least one TQ which is not 100%
|
// The UI needs to see at least one TQ which is not 100%
|
||||||
// and then when the print is complete, one which is.
|
// and then when the print is complete, one which is.
|
||||||
if (card.sdprinting) {
|
static uint8_t last_percent_done = 100;
|
||||||
if (card.percentDone() != last_percent_done) {
|
|
||||||
char message_buffer[10];
|
|
||||||
last_percent_done = card.percentDone();
|
|
||||||
sprintf_P(message_buffer, PSTR("{TQ:%03i}"), last_percent_done);
|
|
||||||
write_to_lcd(message_buffer);
|
|
||||||
|
|
||||||
if (!last_printing_status) last_printing_status = true;
|
// If there was a print in progress, we need to emit the final
|
||||||
}
|
// print status as {TQ:100}. Reset last percent done so a new print will
|
||||||
}
|
// issue a percent of 0.
|
||||||
else {
|
const uint8_t percent_done = card.sdprinting ? card.percentDone() : last_printing_status ? 100 : 0;
|
||||||
// If there was a print in progress, we need to emit the final
|
if (percent_done != last_percent_done) {
|
||||||
// print status as {TQ:100}. Reset last percent done so a new print will
|
char message_buffer[10];
|
||||||
// issue a percent of 0.
|
sprintf_P(message_buffer, PSTR("{TQ:%03i}"), percent_done);
|
||||||
if (last_printing_status) {
|
write_to_lcd(message_buffer);
|
||||||
last_printing_status = false;
|
last_percent_done = percent_done;
|
||||||
last_percent_done = 100;
|
last_printing_status = card.sdprinting;
|
||||||
write_to_lcd_P(PSTR("{TQ:100}"));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user