Fix, clarify LCD_TIMEOUT_TO_STATUS

Replaces #17887

Co-Authored-By: Daniel Callander <knifa@users.noreply.github.com>
This commit is contained in:
Scott Lahteine
2020-05-06 03:34:05 -05:00
parent 1aa9d44783
commit 7c26a54d3f
4 changed files with 14 additions and 10 deletions

View File

@ -46,7 +46,7 @@ bool BaseScreen::buttonStyleCallback(CommandProcessor &cmd, uint8_t tag, uint8_t
return false;
}
#if LCD_TIMEOUT_TO_STATUS
#if LCD_TIMEOUT_TO_STATUS > 0
if (EventLoop::get_pressed_tag() != 0) {
reset_menu_timeout();
}
@ -66,7 +66,7 @@ bool BaseScreen::buttonStyleCallback(CommandProcessor &cmd, uint8_t tag, uint8_t
}
void BaseScreen::onIdle() {
#if LCD_TIMEOUT_TO_STATUS
#if LCD_TIMEOUT_TO_STATUS > 0
if ((millis() - last_interaction) > LCD_TIMEOUT_TO_STATUS) {
reset_menu_timeout();
#if ENABLED(TOUCH_UI_DEBUG)
@ -78,12 +78,12 @@ void BaseScreen::onIdle() {
}
void BaseScreen::reset_menu_timeout() {
#if LCD_TIMEOUT_TO_STATUS
#if LCD_TIMEOUT_TO_STATUS > 0
last_interaction = millis();
#endif
}
#if LCD_TIMEOUT_TO_STATUS
#if LCD_TIMEOUT_TO_STATUS > 0
uint32_t BaseScreen::last_interaction;
#endif

View File

@ -103,7 +103,7 @@ enum {
class BaseScreen : public UIScreen {
protected:
#if LCD_TIMEOUT_TO_STATUS
#if LCD_TIMEOUT_TO_STATUS > 0
static uint32_t last_interaction;
#endif