Fix, clarify LCD_TIMEOUT_TO_STATUS
Replaces #17887 Co-Authored-By: Daniel Callander <knifa@users.noreply.github.com>
This commit is contained in:
parent
1aa9d44783
commit
7c26a54d3f
|
@ -46,7 +46,7 @@ bool BaseScreen::buttonStyleCallback(CommandProcessor &cmd, uint8_t tag, uint8_t
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if LCD_TIMEOUT_TO_STATUS
|
#if LCD_TIMEOUT_TO_STATUS > 0
|
||||||
if (EventLoop::get_pressed_tag() != 0) {
|
if (EventLoop::get_pressed_tag() != 0) {
|
||||||
reset_menu_timeout();
|
reset_menu_timeout();
|
||||||
}
|
}
|
||||||
|
@ -66,7 +66,7 @@ bool BaseScreen::buttonStyleCallback(CommandProcessor &cmd, uint8_t tag, uint8_t
|
||||||
}
|
}
|
||||||
|
|
||||||
void BaseScreen::onIdle() {
|
void BaseScreen::onIdle() {
|
||||||
#if LCD_TIMEOUT_TO_STATUS
|
#if LCD_TIMEOUT_TO_STATUS > 0
|
||||||
if ((millis() - last_interaction) > LCD_TIMEOUT_TO_STATUS) {
|
if ((millis() - last_interaction) > LCD_TIMEOUT_TO_STATUS) {
|
||||||
reset_menu_timeout();
|
reset_menu_timeout();
|
||||||
#if ENABLED(TOUCH_UI_DEBUG)
|
#if ENABLED(TOUCH_UI_DEBUG)
|
||||||
|
@ -78,12 +78,12 @@ void BaseScreen::onIdle() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void BaseScreen::reset_menu_timeout() {
|
void BaseScreen::reset_menu_timeout() {
|
||||||
#if LCD_TIMEOUT_TO_STATUS
|
#if LCD_TIMEOUT_TO_STATUS > 0
|
||||||
last_interaction = millis();
|
last_interaction = millis();
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
#if LCD_TIMEOUT_TO_STATUS
|
#if LCD_TIMEOUT_TO_STATUS > 0
|
||||||
uint32_t BaseScreen::last_interaction;
|
uint32_t BaseScreen::last_interaction;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -103,7 +103,7 @@ enum {
|
||||||
|
|
||||||
class BaseScreen : public UIScreen {
|
class BaseScreen : public UIScreen {
|
||||||
protected:
|
protected:
|
||||||
#if LCD_TIMEOUT_TO_STATUS
|
#if LCD_TIMEOUT_TO_STATUS > 0
|
||||||
static uint32_t last_interaction;
|
static uint32_t last_interaction;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -121,7 +121,7 @@ MarlinUI ui;
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if HAS_LCD_MENU && LCD_TIMEOUT_TO_STATUS
|
#if HAS_LCD_MENU && LCD_TIMEOUT_TO_STATUS > 0
|
||||||
bool MarlinUI::defer_return_to_status;
|
bool MarlinUI::defer_return_to_status;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -732,7 +732,7 @@ void MarlinUI::update() {
|
||||||
static uint16_t max_display_update_time = 0;
|
static uint16_t max_display_update_time = 0;
|
||||||
millis_t ms = millis();
|
millis_t ms = millis();
|
||||||
|
|
||||||
#if HAS_LCD_MENU && LCD_TIMEOUT_TO_STATUS
|
#if HAS_LCD_MENU && LCD_TIMEOUT_TO_STATUS > 0
|
||||||
static millis_t return_to_status_ms = 0;
|
static millis_t return_to_status_ms = 0;
|
||||||
#define RESET_STATUS_TIMEOUT() (return_to_status_ms = ms + LCD_TIMEOUT_TO_STATUS)
|
#define RESET_STATUS_TIMEOUT() (return_to_status_ms = ms + LCD_TIMEOUT_TO_STATUS)
|
||||||
#else
|
#else
|
||||||
|
@ -967,7 +967,7 @@ void MarlinUI::update() {
|
||||||
NOLESS(max_display_update_time, millis() - ms);
|
NOLESS(max_display_update_time, millis() - ms);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if HAS_LCD_MENU && LCD_TIMEOUT_TO_STATUS
|
#if HAS_LCD_MENU && LCD_TIMEOUT_TO_STATUS > 0
|
||||||
// Return to Status Screen after a timeout
|
// Return to Status Screen after a timeout
|
||||||
if (on_status_screen() || defer_return_to_status)
|
if (on_status_screen() || defer_return_to_status)
|
||||||
RESET_STATUS_TIMEOUT();
|
RESET_STATUS_TIMEOUT();
|
||||||
|
|
|
@ -508,7 +508,11 @@ public:
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
FORCE_INLINE static void defer_status_screen(const bool defer=true) {
|
FORCE_INLINE static void defer_status_screen(const bool defer=true) {
|
||||||
TERN(LCD_TIMEOUT_TO_STATUS, defer_return_to_status = defer, UNUSED(defer));
|
#if LCD_TIMEOUT_TO_STATUS > 0
|
||||||
|
defer_return_to_status = defer;
|
||||||
|
#else
|
||||||
|
UNUSED(defer);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void goto_previous_screen_no_defer() {
|
static inline void goto_previous_screen_no_defer() {
|
||||||
|
@ -612,7 +616,7 @@ private:
|
||||||
|
|
||||||
#if HAS_SPI_LCD
|
#if HAS_SPI_LCD
|
||||||
#if HAS_LCD_MENU
|
#if HAS_LCD_MENU
|
||||||
#if LCD_TIMEOUT_TO_STATUS
|
#if LCD_TIMEOUT_TO_STATUS > 0
|
||||||
static bool defer_return_to_status;
|
static bool defer_return_to_status;
|
||||||
#else
|
#else
|
||||||
static constexpr bool defer_return_to_status = false;
|
static constexpr bool defer_return_to_status = false;
|
||||||
|
|
Loading…
Reference in a new issue