use the conditional
This commit is contained in:
@@ -3605,7 +3605,7 @@
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if HAS_MARLINUI_MENU
|
||||
#if EITHER(HAS_MARLINUI_MENU, TOUCH_UI_FTDI_EVE)
|
||||
// LCD timeout to status screen default is 15s
|
||||
#ifndef LCD_TIMEOUT_TO_STATUS
|
||||
#define LCD_TIMEOUT_TO_STATUS 15000
|
||||
|
||||
@@ -45,16 +45,16 @@ 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) {
|
||||
SERIAL_ECHO_MSG("buttonStyleCallback, resetting timeout");
|
||||
#if ENABLED(TOUCH_UI_DEBUG)
|
||||
SERIAL_ECHO_MSG("buttonStyleCallback, resetting timeout");
|
||||
#endif
|
||||
reset_menu_timeout();
|
||||
}
|
||||
#endif
|
||||
|
||||
if (buttonIsPressed(tag)) {
|
||||
options = OPT_FLAT;
|
||||
}
|
||||
if (buttonIsPressed(tag)) options = OPT_FLAT;
|
||||
|
||||
if (style & cmd.STYLE_DISABLED) {
|
||||
cmd.tag(0);
|
||||
@@ -66,10 +66,10 @@ bool BaseScreen::buttonStyleCallback(CommandProcessor &cmd, uint8_t tag, uint8_t
|
||||
}
|
||||
|
||||
void BaseScreen::onIdle() {
|
||||
#if LCD_TIMEOUT_TO_STATUS > 0
|
||||
if (EventLoop::get_pressed_tag() != 0) {
|
||||
#if SCREENS_CAN_TIME_OUT
|
||||
if (EventLoop::get_pressed_tag() != 0)
|
||||
reset_menu_timeout();
|
||||
}
|
||||
|
||||
if ((millis() - last_interaction) > LCD_TIMEOUT_TO_STATUS) {
|
||||
reset_menu_timeout();
|
||||
#if ENABLED(TOUCH_UI_DEBUG)
|
||||
@@ -81,12 +81,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