Skip to content

Commit

Permalink
TFT: Wake up with Rotary encoder wheel too
Browse files Browse the repository at this point in the history
  • Loading branch information
tpruvot committed Sep 7, 2021
1 parent c83cb49 commit 729e7ce
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 13 deletions.
22 changes: 17 additions & 5 deletions Marlin/src/lcd/marlinui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -673,12 +673,21 @@ constexpr uint8_t epps = ENCODER_PULSES_PER_STEP;
draw_kill_screen();
}

#ifdef TOUCH_IDLE_SLEEP
// Handle events which should wake up a sleeping TFT
void MarlinUI::wakeup_screen() {
#if ENABLED(TOUCH_SCREEN)
touch.wakeUp();
#elif HAS_TOUCH_BUTTONS
touchBt.wakeUp();
#endif
}
#endif

void MarlinUI::quick_feedback(const bool clear_buttons/*=true*/) {
#if ENABLED(TOUCH_SCREEN) && defined(TOUCH_IDLE_SLEEP)
// Wake up, if needed, the TFT from any button or encoder
touch.wakeUp();
#elif HAS_TOUCH_BUTTONS && defined(TOUCH_IDLE_SLEEP)
touchBt.wakeUp();
#ifdef TOUCH_IDLE_SLEEP
// Wake up the TFT with most buttons
ui.wakeup_screen();
#endif
TERN_(HAS_LCD_MENU, refresh());

Expand Down Expand Up @@ -960,6 +969,9 @@ constexpr uint8_t epps = ENCODER_PULSES_PER_STEP;
abs_diff = epps; // Treat as a full step size
encoderDiff = (encoderDiff < 0 ? -1 : 1) * abs_diff; // ...in the spin direction.
}
#ifdef TOUCH_IDLE_SLEEP
if (lastEncoderDiff != encoderDiff) ui.wakeup_screen();
#endif
lastEncoderDiff = encoderDiff;
#endif

Expand Down
10 changes: 6 additions & 4 deletions Marlin/src/lcd/marlinui.h
Original file line number Diff line number Diff line change
Expand Up @@ -441,15 +441,17 @@ class MarlinUI {
static millis_t next_filament_display;
#endif

#ifdef TOUCH_IDLE_SLEEP
static void wakeup_screen();
#endif

static void quick_feedback(const bool clear_buttons=true);
#if HAS_BUZZER
static void completion_feedback(const bool good=true);
#else
static inline void completion_feedback(const bool=true) {
#if ENABLED(TOUCH_SCREEN) && defined(TOUCH_IDLE_SLEEP)
touch.wakeUp();
#elif HAS_TOUCH_BUTTONS && defined(TOUCH_IDLE_SLEEP)
touchBt.wakeUp();
#ifdef TOUCH_IDLE_SLEEP
wakeup_screen();
#endif
}
#endif
Expand Down
7 changes: 3 additions & 4 deletions Marlin/src/lcd/menu/menu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -285,10 +285,9 @@ void scroll_screen(const uint8_t limit, const bool is_menu) {

#if HAS_BUZZER
void MarlinUI::completion_feedback(const bool good/*=true*/) {
#if ENABLED(TOUCH_SCREEN) && defined(TOUCH_IDLE_SLEEP)
touch.wakeUp();
#elif HAS_TOUCH_BUTTONS && defined(TOUCH_IDLE_SLEEP)
touchBt.wakeUp();
#ifdef TOUCH_IDLE_SLEEP
// Wake up on rotary encoder click...
ui.wakeup_screen();
#endif
if (good) {
BUZZ(100, 659);
Expand Down

0 comments on commit 729e7ce

Please sign in to comment.