diff --git a/Firmware/lcd.cpp b/Firmware/lcd.cpp index 06755d7b..6f45b4a7 100644 --- a/Firmware/lcd.cpp +++ b/Firmware/lcd.cpp @@ -662,7 +662,6 @@ int8_t lcd_encoder_diff = 0; uint8_t lcd_buttons = 0; uint8_t lcd_button_pressed = 0; uint8_t lcd_update_enabled = 1; -LongTimer lcd_timeoutToStatus; uint32_t lcd_next_update_millis = 0; uint8_t lcd_status_update_delay = 0; @@ -677,6 +676,7 @@ lcd_lcdupdate_func_t lcd_lcdupdate_func = 0; static ShortTimer buttonBlanking; ShortTimer longPressTimer; +LongTimer lcd_timeoutToStatus; uint8_t lcd_clicked(void) diff --git a/Firmware/lcd.h b/Firmware/lcd.h index 573205d7..27ebfed6 100644 --- a/Firmware/lcd.h +++ b/Firmware/lcd.h @@ -4,6 +4,7 @@ #include #include +#include "Timer.h" @@ -108,7 +109,7 @@ extern uint8_t lcd_button_pressed; extern uint8_t lcd_update_enabled; -extern uint32_t lcd_timeoutToStatus; +extern LongTimer lcd_timeoutToStatus; extern uint32_t lcd_next_update_millis; diff --git a/Firmware/ultralcd.cpp b/Firmware/ultralcd.cpp index 31359908..22000847 100644 --- a/Firmware/ultralcd.cpp +++ b/Firmware/ultralcd.cpp @@ -2840,7 +2840,7 @@ static void _lcd_babystep(int axis, const char *msg) //SERIAL_ECHO("Z baby step: "); //SERIAL_ECHO(menuData.babyStep.babystepMem[2]); // Wait 90 seconds before closing the live adjust dialog. - lcd_timeoutToStatus = millis() + 90000; + lcd_timeoutToStatus.start(); } if (lcd_encoder != 0) @@ -7533,18 +7533,18 @@ void menu_lcd_charsetup_func(void) static inline bool z_menu_expired() { - return (currentMenu == lcd_babystep_z + return (menu_menu == lcd_babystep_z && lcd_timeoutToStatus.expired(LCD_TIMEOUT_TO_STATUS_BABYSTEP_Z)); } static inline bool other_menu_expired() { - return (currentMenu != lcd_status_screen - && currentMenu != lcd_babystep_z + return (menu_menu != lcd_status_screen + && menu_menu != lcd_babystep_z && lcd_timeoutToStatus.expired(LCD_TIMEOUT_TO_STATUS)); } static inline bool forced_menu_expire() { - bool retval = (currentMenu != lcd_status_screen + bool retval = (menu_menu != lcd_status_screen && forceMenuExpire); forceMenuExpire = false; return retval; diff --git a/Firmware/ultralcd.h b/Firmware/ultralcd.h index 5cd56e35..bb6be348 100644 --- a/Firmware/ultralcd.h +++ b/Firmware/ultralcd.h @@ -4,7 +4,6 @@ #include "Marlin.h" #include "lcd.h" #include "conv2str.h" -#include "Timer.h" extern int lcd_puts_P(const char* str); extern int lcd_printf_P(const char* format, ...); @@ -104,7 +103,6 @@ extern void menu_lcd_lcdupdate_func(void); #define LCD_COMMAND_PID_EXTRUDER 7 #define LCD_COMMAND_V2_CAL 8 - extern unsigned long lcd_timeoutToStatus; extern int lcd_commands_type; extern uint8_t farm_mode;