Merge pull request #4803 from thinkyhead/rc_lcd_button_fix

Clear LCD button state, apply timer to all
2.0.x
Scott Lahteine 8 years ago committed by GitHub
commit e40646de42

@ -2361,6 +2361,7 @@ void kill_screen(const char* lcd_msg) {
void lcd_quick_feedback() { void lcd_quick_feedback() {
lcdDrawUpdate = LCDVIEW_CLEAR_CALL_REDRAW; lcdDrawUpdate = LCDVIEW_CLEAR_CALL_REDRAW;
buttons = 0;
next_button_update_ms = millis() + 500; next_button_update_ms = millis() + 500;
// Buzz and wait. The delay is needed for buttons to settle! // Buzz and wait. The delay is needed for buttons to settle!
@ -2850,20 +2851,26 @@ void lcd_reset_alert_level() { lcd_status_message_level = 0; }
* Warning: This function is called from interrupt context! * Warning: This function is called from interrupt context!
*/ */
void lcd_buttons_update() { void lcd_buttons_update() {
#if ENABLED(NEWPANEL) millis_t now = millis();
uint8_t newbutton = 0; if (ELAPSED(now, next_button_update_ms)) {
#if BUTTON_EXISTS(EN1)
if (BUTTON_PRESSED(EN1)) newbutton |= EN_A; #if ENABLED(NEWPANEL)
#endif uint8_t newbutton = 0;
#if BUTTON_EXISTS(EN2)
if (BUTTON_PRESSED(EN2)) newbutton |= EN_B; #if BUTTON_EXISTS(EN1)
#endif if (BUTTON_PRESSED(EN1)) newbutton |= EN_A;
#if LCD_HAS_DIRECTIONAL_BUTTONS || BUTTON_EXISTS(ENC) #endif
millis_t now = millis();
#endif #if BUTTON_EXISTS(EN2)
if (BUTTON_PRESSED(EN2)) newbutton |= EN_B;
#endif
#if BUTTON_EXISTS(ENC)
if (BUTTON_PRESSED(ENC)) newbutton |= EN_C;
#endif
#if LCD_HAS_DIRECTIONAL_BUTTONS
#if LCD_HAS_DIRECTIONAL_BUTTONS
if (ELAPSED(now, next_button_update_ms)) {
if (false) { if (false) {
// for the else-ifs below // for the else-ifs below
} }
@ -2891,23 +2898,21 @@ void lcd_reset_alert_level() { lcd_status_message_level = 0; }
next_button_update_ms = now + 300; next_button_update_ms = now + 300;
} }
#endif #endif
}
#endif
#if BUTTON_EXISTS(ENC) #endif // LCD_HAS_DIRECTIONAL_BUTTONS
if (ELAPSED(now, next_button_update_ms) && BUTTON_PRESSED(ENC)) newbutton |= EN_C;
#endif
buttons = newbutton; buttons = newbutton;
#if ENABLED(LCD_HAS_SLOW_BUTTONS) #if ENABLED(LCD_HAS_SLOW_BUTTONS)
buttons |= slow_buttons; buttons |= slow_buttons;
#endif #endif
#if ENABLED(REPRAPWORLD_KEYPAD) #if ENABLED(REPRAPWORLD_KEYPAD)
GET_BUTTON_STATES(buttons_reprapworld_keypad); GET_BUTTON_STATES(buttons_reprapworld_keypad);
#endif #endif
#else #else
GET_BUTTON_STATES(buttons); GET_BUTTON_STATES(buttons);
#endif //!NEWPANEL #endif //!NEWPANEL
} // next_button_update_ms
// Manage encoder rotation // Manage encoder rotation
#if ENABLED(REVERSE_MENU_DIRECTION) && ENABLED(REVERSE_ENCODER_DIRECTION) #if ENABLED(REVERSE_MENU_DIRECTION) && ENABLED(REVERSE_ENCODER_DIRECTION)

Loading…
Cancel
Save