From 5b7266fdf1d261fd9a27f311c94f57bb65a8e191 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gu=C3=B0ni=20M=C3=A1r=20Gilbert?= Date: Sun, 23 Apr 2023 09:43:23 +0000 Subject: [PATCH] Don't render message when printer is idle Guard the lcd_display_message_fullscreen_P call by blocks_queued(). If there are no planned moves, there is no need to render this message, it creates a weird LCD draw noticable by the user. Change in memory: Flash: +10 bytes SRAM: 0 bytes --- Firmware/ultralcd.cpp | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/Firmware/ultralcd.cpp b/Firmware/ultralcd.cpp index 90efb9f54..6c68fe38a 100644 --- a/Firmware/ultralcd.cpp +++ b/Firmware/ultralcd.cpp @@ -3377,15 +3377,18 @@ static void lcd_silent_mode_set() { } eeprom_update_byte((unsigned char *)EEPROM_SILENT, SilentModeMenu); #ifdef TMC2130 - lcd_display_message_fullscreen_P(_i("Mode change in progress..."));////MSG_MODE_CHANGE_IN_PROGRESS c=20 r=3 - // Wait until the planner queue is drained and the stepper routine achieves - // an idle state. - st_synchronize(); + if (blocks_queued()) + { + lcd_display_message_fullscreen_P(_i("Mode change in progress..."));////MSG_MODE_CHANGE_IN_PROGRESS c=20 r=3 + // Wait until the planner queue is drained and the stepper routine achieves + // an idle state. + st_synchronize(); + } tmc2130_wait_standstill_xy(1000); - cli(); - tmc2130_mode = (SilentModeMenu != SILENT_MODE_NORMAL)?TMC2130_MODE_SILENT:TMC2130_MODE_NORMAL; - update_mode_profile(); - tmc2130_init(TMCInitParams(false, FarmOrUserECool())); + cli(); + tmc2130_mode = (SilentModeMenu != SILENT_MODE_NORMAL)?TMC2130_MODE_SILENT:TMC2130_MODE_NORMAL; + update_mode_profile(); + tmc2130_init(TMCInitParams(false, FarmOrUserECool())); // We may have missed a stepper timer interrupt due to the time spent in tmc2130_init. // Be safe than sorry, reset the stepper timer before re-enabling interrupts. st_reset_timer();