mirror of
https://github.com/firewalkwithm3/Sensor-Watch.git
synced 2024-11-22 11:10:29 +08:00
Additional code review change
This commit is contained in:
parent
c6f2bff75e
commit
d5a8c57c82
|
@ -681,10 +681,15 @@ static void debounce_btn_press(uint8_t pin, uint8_t *debounce_ticks, uint16_t *d
|
|||
*down_timestamp = 0;
|
||||
}
|
||||
|
||||
static void disable_if_needed(uint8_t *ticks) {
|
||||
if (*ticks > 0 && --*ticks == 0)
|
||||
_movement_disable_fast_tick_if_possible();
|
||||
}
|
||||
|
||||
static void movement_disable_if_debounce_complete(void) {
|
||||
if (movement_state.debounce_ticks_light > 0 && --movement_state.debounce_ticks_light == 0) _movement_disable_fast_tick_if_possible();
|
||||
if (movement_state.debounce_ticks_alarm > 0 && --movement_state.debounce_ticks_alarm == 0) _movement_disable_fast_tick_if_possible();
|
||||
if (movement_state.debounce_ticks_mode > 0 && --movement_state.debounce_ticks_mode == 0) _movement_disable_fast_tick_if_possible();
|
||||
disable_if_needed(&movement_state.debounce_ticks_light);
|
||||
disable_if_needed(&movement_state.debounce_ticks_alarm);
|
||||
disable_if_needed(&movement_state.debounce_ticks_mode);
|
||||
}
|
||||
|
||||
void cb_light_btn_interrupt(void) {
|
||||
|
|
Loading…
Reference in a new issue