mirror of
https://github.com/firewalkwithm3/Sensor-Watch.git
synced 2024-11-22 19:20:30 +08:00
A little bit of clean-up
This commit is contained in:
parent
f7d1b8f9f3
commit
607946ed2e
|
@ -668,21 +668,19 @@ static void debounce_btn_press(uint8_t pin, uint8_t *debounce_ticks, uint16_t *d
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
*down_timestamp = 0;
|
*down_timestamp = 0;
|
||||||
|
_movement_enable_fast_tick_if_needed();
|
||||||
}
|
}
|
||||||
|
|
||||||
void cb_light_btn_interrupt(void) {
|
void cb_light_btn_interrupt(void) {
|
||||||
debounce_btn_press(BTN_LIGHT, &movement_state.debounce_ticks_light, &movement_state.light_down_timestamp, light_btn_action);
|
debounce_btn_press(BTN_LIGHT, &movement_state.debounce_ticks_light, &movement_state.light_down_timestamp, light_btn_action);
|
||||||
_movement_enable_fast_tick_if_needed();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void cb_mode_btn_interrupt(void) {
|
void cb_mode_btn_interrupt(void) {
|
||||||
debounce_btn_press(BTN_MODE, &movement_state.debounce_ticks_mode, &movement_state.mode_down_timestamp, mode_btn_action);
|
debounce_btn_press(BTN_MODE, &movement_state.debounce_ticks_mode, &movement_state.mode_down_timestamp, mode_btn_action);
|
||||||
_movement_enable_fast_tick_if_needed();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void cb_alarm_btn_interrupt(void) {
|
void cb_alarm_btn_interrupt(void) {
|
||||||
debounce_btn_press(BTN_ALARM, &movement_state.debounce_ticks_alarm, &movement_state.alarm_down_timestamp, alarm_btn_action);
|
debounce_btn_press(BTN_ALARM, &movement_state.debounce_ticks_alarm, &movement_state.alarm_down_timestamp, alarm_btn_action);
|
||||||
_movement_enable_fast_tick_if_needed();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void cb_alarm_btn_extwake(void) {
|
void cb_alarm_btn_extwake(void) {
|
||||||
|
@ -695,9 +693,9 @@ void cb_alarm_fired(void) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void cb_fast_tick(void) {
|
void cb_fast_tick(void) {
|
||||||
if (movement_state.debounce_ticks_light > 0){{if (--movement_state.debounce_ticks_light == 0) {_movement_disable_fast_tick_if_possible();}}}
|
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){{if (--movement_state.debounce_ticks_alarm == 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){{if (--movement_state.debounce_ticks_mode == 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();
|
||||||
if (movement_state.debounce_ticks_light + movement_state.debounce_ticks_mode + movement_state.debounce_ticks_alarm == 0)
|
if (movement_state.debounce_ticks_light + movement_state.debounce_ticks_mode + movement_state.debounce_ticks_alarm == 0)
|
||||||
movement_state.fast_ticks++;
|
movement_state.fast_ticks++;
|
||||||
if (movement_state.light_ticks > 0) movement_state.light_ticks--;
|
if (movement_state.light_ticks > 0) movement_state.light_ticks--;
|
||||||
|
|
Loading…
Reference in a new issue