Skip to content

Commit

Permalink
Handle machines with a buzzer
Browse files Browse the repository at this point in the history
  • Loading branch information
tpruvot committed Aug 28, 2021
1 parent 9c092fe commit 97d7339
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 5 deletions.
2 changes: 2 additions & 0 deletions Marlin/src/lcd/marlinui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -667,6 +667,8 @@ constexpr uint8_t epps = ENCODER_PULSES_PER_STEP;
#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();
#endif
TERN_(HAS_LCD_MENU, refresh());

Expand Down
4 changes: 2 additions & 2 deletions Marlin/src/lcd/marlinui.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@

#if ENABLED(TOUCH_SCREEN) && defined(TOUCH_IDLE_SLEEP)
#include "tft/touch.h"
#elif ENABLED(TFT_TOUCH_DEVICE_XPT2046) && defined(TOUCH_IDLE_SLEEP)
#elif HAS_TOUCH_BUTTONS && defined(TOUCH_IDLE_SLEEP)
#include "touch/touch_buttons.h"
#endif

Expand Down Expand Up @@ -430,7 +430,7 @@ class MarlinUI {
static inline void completion_feedback(const bool=true) {
#if ENABLED(TOUCH_SCREEN) && defined(TOUCH_IDLE_SLEEP)
touch.wakeUp();
#elif ENABLED(TFT_TOUCH_DEVICE_XPT2046) && defined(TOUCH_IDLE_SLEEP)
#elif HAS_TOUCH_BUTTONS && defined(TOUCH_IDLE_SLEEP)
touchBt.wakeUp();
#endif
}
Expand Down
5 changes: 5 additions & 0 deletions Marlin/src/lcd/menu/menu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -285,6 +285,11 @@ 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();
#endif
if (good) {
BUZZ(100, 659);
BUZZ(100, 698);
Expand Down
6 changes: 3 additions & 3 deletions Marlin/src/lcd/touch/touch_buttons.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -97,9 +97,9 @@ uint8_t TouchButtons::read_buttons() {
}

void TouchButtons::wakeUp() {
#if ENABLED(TFT_TOUCH_DEVICE_XPT2046)
if (touchIO.isSleeping()) touchIO.doWakeUp();
#endif
#if ENABLED(TFT_TOUCH_DEVICE_XPT2046)
if (touchIO.isSleeping()) touchIO.doWakeUp();
#endif
}

#endif // HAS_TOUCH_BUTTONS

0 comments on commit 97d7339

Please sign in to comment.