General cosmetic LCD

This commit is contained in:
Scott Lahteine 2017-11-21 00:18:46 -06:00
parent 617993d0ea
commit 3994d3b935
2 changed files with 21 additions and 13 deletions

View file

@ -4590,14 +4590,20 @@ void lcd_update() {
#if ENABLED(ULTIPANEL) #if ENABLED(ULTIPANEL)
static millis_t return_to_status_ms = 0; static millis_t return_to_status_ms = 0;
// Handle any queued Move Axis motion
manage_manual_move(); manage_manual_move();
// Update button states for LCD_CLICKED, etc.
// After state changes the next button update
// may be delayed 300-500ms.
lcd_buttons_update(); lcd_buttons_update();
#if ENABLED(AUTO_BED_LEVELING_UBL) #if ENABLED(AUTO_BED_LEVELING_UBL)
const bool UBL_CONDITION = !ubl.has_control_of_lcd_panel; // Don't run the debouncer if UBL owns the display
#define UBL_CONDITION !ubl.has_control_of_lcd_panel
#else #else
constexpr bool UBL_CONDITION = true; #define UBL_CONDITION true
#endif #endif
// If the action button is pressed... // If the action button is pressed...
@ -4944,7 +4950,7 @@ void lcd_reset_alert_level() { lcd_status_message_level = 0; }
*/ */
void lcd_buttons_update() { void lcd_buttons_update() {
static uint8_t lastEncoderBits; static uint8_t lastEncoderBits;
millis_t now = millis(); const millis_t now = millis();
if (ELAPSED(now, next_button_update_ms)) { if (ELAPSED(now, next_button_update_ms)) {
#if ENABLED(NEWPANEL) #if ENABLED(NEWPANEL)
@ -4962,9 +4968,16 @@ void lcd_reset_alert_level() { lcd_status_message_level = 0; }
if (BUTTON_PRESSED(ENC)) newbutton |= EN_C; if (BUTTON_PRESSED(ENC)) newbutton |= EN_C;
#endif #endif
buttons = newbutton;
#if ENABLED(LCD_HAS_SLOW_BUTTONS)
buttons |= slow_buttons;
#endif
//
// Directional buttons
//
#if LCD_HAS_DIRECTIONAL_BUTTONS #if LCD_HAS_DIRECTIONAL_BUTTONS
// Manage directional buttons
#if ENABLED(REVERSE_MENU_DIRECTION) #if ENABLED(REVERSE_MENU_DIRECTION)
#define _ENCODER_UD_STEPS (ENCODER_STEPS_PER_MENU_ITEM * encoderDirection) #define _ENCODER_UD_STEPS (ENCODER_STEPS_PER_MENU_ITEM * encoderDirection)
#else #else
@ -5008,11 +5021,6 @@ void lcd_reset_alert_level() { lcd_status_message_level = 0; }
#endif // LCD_HAS_DIRECTIONAL_BUTTONS #endif // LCD_HAS_DIRECTIONAL_BUTTONS
buttons = newbutton;
#if ENABLED(LCD_HAS_SLOW_BUTTONS)
buttons |= slow_buttons;
#endif
#if ENABLED(ADC_KEYPAD) #if ENABLED(ADC_KEYPAD)
uint8_t newbutton_reprapworld_keypad = 0; uint8_t newbutton_reprapworld_keypad = 0;

View file

@ -78,12 +78,12 @@ extern volatile uint8_t buttons; //an extended version of the last checked butt
#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
#undef LCD_CLICKED #undef LCD_CLICKED
#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
#undef LCD_CLICKED #undef LCD_CLICKED
#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
@ -119,7 +119,7 @@ extern volatile uint8_t buttons; //an extended version of the last checked butt
#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) || (buttons & B_ST)) #define LCD_CLICKED (buttons & (B_MI|B_ST))
#endif #endif
#endif // ULTIPANEL #endif // ULTIPANEL