mirror of
https://github.com/eried/portapack-mayhem.git
synced 2025-07-22 06:29:31 -04:00
Fixed Select button responsiveness when updating frequency field during heavy CPU activity (e.g. WFM Audio) (#1335)
* Resolve button responsiveness * Resolve button responsiveness * Clang * Clang * Clang try again * Removed unnecessary lines * Address review comments * Add comments per reviewer suggestion * Clang test * Clang retry
This commit is contained in:
parent
d24ff7b3bc
commit
06b7a0419e
2 changed files with 96 additions and 70 deletions
|
@ -43,15 +43,25 @@ class Debounce {
|
|||
bool long_press_occurred();
|
||||
|
||||
private:
|
||||
uint8_t history_{0};
|
||||
uint8_t state_{0};
|
||||
bool repeat_enabled_{false};
|
||||
uint16_t repeat_ctr_{0};
|
||||
uint16_t held_time_{0};
|
||||
bool pulse_upon_release_{false};
|
||||
bool simulated_pulse_{false};
|
||||
bool long_press_enabled_{false};
|
||||
bool long_press_occurred_{false};
|
||||
uint8_t history_{0}; // shift register of last 8 reads from button hardware state bit
|
||||
|
||||
uint8_t state_{0}; // actual button hardware state (after debounce logic), 1=pressed
|
||||
|
||||
uint8_t state_to_report_{0}; // pseudo button state reported by state() function (may be masked off or simulated presses)
|
||||
|
||||
bool repeat_enabled_{false}; // TRUE if this button is enabled to auto-repeat when held down (ignored if long_press_enabled)
|
||||
|
||||
uint16_t repeat_ctr_{0}; // used for timing auto-repeat simulated button presses when button is held down and repeat_enabled
|
||||
|
||||
uint16_t held_time_{0}; // number of ticks that the button has been held down (compared against REPEAT and LONG_PRESS delays)
|
||||
|
||||
bool pulse_upon_release_{false}; // TRUE when button is being held down when long_press_enabled and LONG_PRESS_DELAY hasn't been reached yet
|
||||
|
||||
bool simulated_pulse_{false}; // TRUE if a simulated button press is active following a short button press (only when long_press_enabled)
|
||||
|
||||
bool long_press_enabled_{false}; // TRUE when button is in long-press mode (takes precedence over the repeat_enabled flag)
|
||||
|
||||
bool long_press_occurred_{false}; // TRUE when button is being held down and LONG_PRESS_DELAY has been reached (only when long_press_enabled)
|
||||
};
|
||||
|
||||
#endif /*__DEBOUNCE_H__*/
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue