♻️ Refactor status screen timeout
This commit is contained in:
@ -45,7 +45,7 @@ bool BaseScreen::buttonStyleCallback(CommandProcessor &cmd, uint8_t tag, uint8_t
|
||||
return false;
|
||||
}
|
||||
|
||||
#if LCD_TIMEOUT_TO_STATUS > 0
|
||||
#if SCREENS_CAN_TIME_OUT
|
||||
if (EventLoop::get_pressed_tag() != 0) {
|
||||
reset_menu_timeout();
|
||||
}
|
||||
@ -65,7 +65,7 @@ bool BaseScreen::buttonStyleCallback(CommandProcessor &cmd, uint8_t tag, uint8_t
|
||||
}
|
||||
|
||||
void BaseScreen::onIdle() {
|
||||
#if LCD_TIMEOUT_TO_STATUS > 0
|
||||
#if SCREENS_CAN_TIME_OUT
|
||||
if ((millis() - last_interaction) > LCD_TIMEOUT_TO_STATUS) {
|
||||
reset_menu_timeout();
|
||||
#if ENABLED(TOUCH_UI_DEBUG)
|
||||
@ -77,12 +77,10 @@ void BaseScreen::onIdle() {
|
||||
}
|
||||
|
||||
void BaseScreen::reset_menu_timeout() {
|
||||
#if LCD_TIMEOUT_TO_STATUS > 0
|
||||
last_interaction = millis();
|
||||
#endif
|
||||
TERN_(SCREENS_CAN_TIME_OUT, last_interaction = millis());
|
||||
}
|
||||
|
||||
#if LCD_TIMEOUT_TO_STATUS > 0
|
||||
#if SCREENS_CAN_TIME_OUT
|
||||
uint32_t BaseScreen::last_interaction;
|
||||
#endif
|
||||
|
||||
|
@ -27,7 +27,7 @@
|
||||
|
||||
class BaseScreen : public UIScreen {
|
||||
protected:
|
||||
#if LCD_TIMEOUT_TO_STATUS > 0
|
||||
#if SCREENS_CAN_TIME_OUT
|
||||
static uint32_t last_interaction;
|
||||
#endif
|
||||
|
||||
|
Reference in New Issue
Block a user