Skip to content

Commit

Permalink
use ui.lcd_clicked
Browse files Browse the repository at this point in the history
  • Loading branch information
thinkyhead committed Jun 14, 2021
1 parent b877ce1 commit 36030c7
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 28 deletions.
4 changes: 0 additions & 4 deletions Marlin/src/lcd/extui/ui_api.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -892,10 +892,6 @@ namespace ExtUI {

#endif // HAS_LEVELING

bool ui_cancel_operation;
void ui_setUICancelOperation(const bool state) { ui_cancel_operation = state; }
bool get_isUICanceled() { return ui_cancel_operation; }

#if ENABLED(HOST_PROMPT_SUPPORT)
void setHostResponse(const uint8_t response) { host_response_handler(response); }
#endif
Expand Down
3 changes: 1 addition & 2 deletions Marlin/src/lcd/extui/ui_api.h
Original file line number Diff line number Diff line change
Expand Up @@ -190,8 +190,7 @@ namespace ExtUI {
void setHostResponse(const uint8_t);
#endif

void ui_setUICancelOperation(const bool);
bool get_isUICanceled();
inline void simulateUserClick() { ui.lcd_clicked = true; }

#if ENABLED(PRINTCOUNTER)
char* getFailedPrints_str(char buffer[21]);
Expand Down
20 changes: 4 additions & 16 deletions Marlin/src/lcd/marlinui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,10 @@ millis_t MarlinUI::next_button_update_ms; // = 0

#endif

#if EITHER(HAS_LCD_MENU, EXTENSIBLE_UI)
bool MarlinUI::lcd_clicked;
#endif

#if HAS_LCD_MENU
#include "menu/menu.h"

Expand All @@ -247,14 +251,6 @@ millis_t MarlinUI::next_button_update_ms; // = 0
uint8_t MarlinUI::repeat_delay;
#endif

bool MarlinUI::lcd_clicked;

bool MarlinUI::use_click() {
const bool click = lcd_clicked;
lcd_clicked = false;
return click;
}

#if EITHER(AUTO_BED_LEVELING_UBL, G26_MESH_VALIDATION)

bool MarlinUI::external_control; // = false
Expand Down Expand Up @@ -1458,14 +1454,6 @@ void MarlinUI::update() {
TERN_(DWIN_CREALITY_LCD, DWIN_StatusChanged(status_message));
}

#if ENABLED(EXTENSIBLE_UI)
bool MarlinUI::use_click() {
const bool click = ExtUI::get_isUICanceled();
ExtUI::ui_setUICancelOperation(false);
return click;
}
#endif

#if ENABLED(STATUS_MESSAGE_SCROLLING)

void MarlinUI::advance_status_scroll() {
Expand Down
17 changes: 11 additions & 6 deletions Marlin/src/lcd/marlinui.h
Original file line number Diff line number Diff line change
Expand Up @@ -474,9 +474,6 @@ class MarlinUI {
static void set_selection(const bool sel) { selection = sel; }
static bool update_selection();

static bool lcd_clicked;
static bool use_click();

static void synchronize(PGM_P const msg=nullptr);

static screenFunc_t currentScreen;
Expand Down Expand Up @@ -527,13 +524,21 @@ class MarlinUI {

#elif HAS_WIRED_LCD

static constexpr bool lcd_clicked = false;
static constexpr bool on_status_screen() { return true; }
FORCE_INLINE static void run_current_screen() { status_screen(); }

#elif ENABLED(EXTENSIBLE_UI)
#endif

#if EITHER(HAS_LCD_MENU, EXTENSIBLE_UI)
static bool lcd_clicked;
static bool use_click();
static bool use_click() {
const bool click = lcd_clicked;
lcd_clicked = false;
return click;
}
#else
static constexpr bool lcd_clicked = false;
static inline bool use_click() { return false; }
#endif

#if BOTH(HAS_LCD_MENU, ADVANCED_PAUSE_FEATURE)
Expand Down

0 comments on commit 36030c7

Please sign in to comment.