Browse Source

Add parentheses to LCD_CLICKED

pull/1/head
Scott Lahteine 6 years ago
parent
commit
eb5600acd2
  1. 8
      Marlin/src/lcd/HD44780/ultralcd_common_HD44780.h
  2. 6
      Marlin/src/lcd/ultralcd.cpp
  3. 8
      Marlin/src/lcd/ultralcd.h

8
Marlin/src/lcd/HD44780/ultralcd_common_HD44780.h

@ -60,9 +60,9 @@
#if BUTTON_EXISTS(ENC) #if BUTTON_EXISTS(ENC)
// the pause/stop/restart button is connected to BTN_ENC when used // the pause/stop/restart button is connected to BTN_ENC when used
#define B_ST (EN_C) // Map the pause/stop/resume button into its normalized functional name #define B_ST (EN_C) // Map the pause/stop/resume button into its normalized functional name
#define LCD_CLICKED (buttons & (B_MI|B_RI|B_ST)) // pause/stop button also acts as click until we implement proper pause/stop. #define LCD_CLICKED() (buttons & (B_MI|B_RI|B_ST)) // pause/stop button also acts as click until we implement proper pause/stop.
#else #else
#define LCD_CLICKED (buttons & (B_MI|B_RI)) #define LCD_CLICKED() (buttons & (B_MI|B_RI))
#endif #endif
// I2C buttons take too long to read inside an interrupt context and so we read them during lcd_update // I2C buttons take too long to read inside an interrupt context and so we read them during lcd_update
@ -77,7 +77,7 @@
#define B_MI (PANELOLU2_ENCODER_C << B_I2C_BTN_OFFSET) // requires LiquidTWI2 library v1.2.3 or later #define B_MI (PANELOLU2_ENCODER_C << B_I2C_BTN_OFFSET) // requires LiquidTWI2 library v1.2.3 or later
#undef LCD_CLICKED #undef LCD_CLICKED
#define LCD_CLICKED (buttons & B_MI) #define LCD_CLICKED() (buttons & B_MI)
// I2C buttons take too long to read inside an interrupt context and so we read them during lcd_update // I2C buttons take too long to read inside an interrupt context and so we read them during lcd_update
#define LCD_HAS_SLOW_BUTTONS #define LCD_HAS_SLOW_BUTTONS
@ -98,7 +98,7 @@
#define B_DW (_BV(BL_DW)) #define B_DW (_BV(BL_DW))
#define B_RI (_BV(BL_RI)) #define B_RI (_BV(BL_RI))
#define B_ST (_BV(BL_ST)) #define B_ST (_BV(BL_ST))
#define LCD_CLICKED (buttons & (B_MI|B_ST)) #define LCD_CLICKED() (buttons & (B_MI|B_ST))
#endif #endif
#if ENABLED(AUTO_BED_LEVELING_UBL) #if ENABLED(AUTO_BED_LEVELING_UBL)

6
Marlin/src/lcd/ultralcd.cpp

@ -660,7 +660,7 @@ void lcd_update() {
// Handle any queued Move Axis motion // Handle any queued Move Axis motion
manage_manual_move(); manage_manual_move();
// Update button states for LCD_CLICKED, etc. // Update button states for LCD_CLICKED(), etc.
// After state changes the next button update // After state changes the next button update
// may be delayed 300-500ms. // may be delayed 300-500ms.
lcd_buttons_update(); lcd_buttons_update();
@ -673,7 +673,7 @@ void lcd_update() {
#endif #endif
// If the action button is pressed... // If the action button is pressed...
if (UBL_CONDITION && LCD_CLICKED) { if (UBL_CONDITION && LCD_CLICKED()) {
if (!wait_for_unclick) { // If not waiting for a debounce release: if (!wait_for_unclick) { // If not waiting for a debounce release:
wait_for_unclick = true; // Set debounce flag to ignore continous clicks wait_for_unclick = true; // Set debounce flag to ignore continous clicks
lcd_clicked = !wait_for_user && !no_reentry; // Keep the click if not waiting for a user-click lcd_clicked = !wait_for_user && !no_reentry; // Keep the click if not waiting for a user-click
@ -1102,7 +1102,7 @@ void lcd_reset_alert_level() { lcd_status_message_level = 0; }
#endif #endif
#if ENABLED(AUTO_BED_LEVELING_UBL) || ENABLED(G26_MESH_VALIDATION) #if ENABLED(AUTO_BED_LEVELING_UBL) || ENABLED(G26_MESH_VALIDATION)
bool is_lcd_clicked() { return LCD_CLICKED; } bool is_lcd_clicked() { return LCD_CLICKED(); }
void wait_for_release() { void wait_for_release() {
while (is_lcd_clicked()) safe_delay(50); while (is_lcd_clicked()) safe_delay(50);
safe_delay(50); safe_delay(50);

8
Marlin/src/lcd/ultralcd.h

@ -409,14 +409,14 @@
#if ENABLED(REPRAPWORLD_KEYPAD) #if ENABLED(REPRAPWORLD_KEYPAD)
#ifdef EN_C #ifdef EN_C
#define LCD_CLICKED ((buttons & EN_C) || REPRAPWORLD_KEYPAD_MOVE_MENU) #define LCD_CLICKED() ((buttons & EN_C) || REPRAPWORLD_KEYPAD_MOVE_MENU)
#else #else
#define LCD_CLICKED REPRAPWORLD_KEYPAD_MOVE_MENU #define LCD_CLICKED() REPRAPWORLD_KEYPAD_MOVE_MENU
#endif #endif
#elif defined(EN_C) #elif defined(EN_C)
#define LCD_CLICKED (buttons & EN_C) #define LCD_CLICKED() (buttons & EN_C)
#else #else
#define LCD_CLICKED false #define LCD_CLICKED() false
#endif #endif
extern uint8_t lcd_status_update_delay; extern uint8_t lcd_status_update_delay;

Loading…
Cancel
Save