Merge pull request #4803 from thinkyhead/rc_lcd_button_fix
Clear LCD button state, apply timer to all
This commit is contained in:
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() {
|
||||||
|
millis_t now = millis();
|
||||||
|
if (ELAPSED(now, next_button_update_ms)) {
|
||||||
|
|
||||||
#if ENABLED(NEWPANEL)
|
#if ENABLED(NEWPANEL)
|
||||||
uint8_t newbutton = 0;
|
uint8_t newbutton = 0;
|
||||||
|
|
||||||
#if BUTTON_EXISTS(EN1)
|
#if BUTTON_EXISTS(EN1)
|
||||||
if (BUTTON_PRESSED(EN1)) newbutton |= EN_A;
|
if (BUTTON_PRESSED(EN1)) newbutton |= EN_A;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if BUTTON_EXISTS(EN2)
|
#if BUTTON_EXISTS(EN2)
|
||||||
if (BUTTON_PRESSED(EN2)) newbutton |= EN_B;
|
if (BUTTON_PRESSED(EN2)) newbutton |= EN_B;
|
||||||
#endif
|
#endif
|
||||||
#if LCD_HAS_DIRECTIONAL_BUTTONS || BUTTON_EXISTS(ENC)
|
|
||||||
millis_t now = millis();
|
#if BUTTON_EXISTS(ENC)
|
||||||
|
if (BUTTON_PRESSED(ENC)) newbutton |= EN_C;
|
||||||
#endif
|
#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,12 +2898,8 @@ 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)
|
||||||
|
@ -2909,6 +2912,8 @@ void lcd_reset_alert_level() { lcd_status_message_level = 0; }
|
||||||
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)
|
||||||
#define ENCODER_DIFF_CW (encoderDiff -= encoderDirection)
|
#define ENCODER_DIFF_CW (encoderDiff -= encoderDirection)
|
||||||
|
|
Loading…
Reference in a new issue