faces/tally: avoid resetting counters
Don't reset the counters unless there are multiple presets. Move back to the first face directly if there are no presets to cycle through.
This commit is contained in:
parent
6b7ea8bbaa
commit
e4e0b611f3
@ -105,6 +105,11 @@ static void tally_face_decrement(tally_state_t *state, bool sound_on) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static bool tally_face_should_move_back(tally_state_t *state) {
|
||||||
|
if (_tally_default_size <= 1) { return false; }
|
||||||
|
return state->tally_idx == _tally_default[state->tally_default_idx];
|
||||||
|
}
|
||||||
|
|
||||||
bool tally_face_loop(movement_event_t event, movement_settings_t *settings, void *context) {
|
bool tally_face_loop(movement_event_t event, movement_settings_t *settings, void *context) {
|
||||||
tally_state_t *state = (tally_state_t *)context;
|
tally_state_t *state = (tally_state_t *)context;
|
||||||
static bool using_led = false;
|
static bool using_led = false;
|
||||||
@ -138,7 +143,7 @@ bool tally_face_loop(movement_event_t event, movement_settings_t *settings, void
|
|||||||
start_quick_cyc();
|
start_quick_cyc();
|
||||||
break;
|
break;
|
||||||
case EVENT_MODE_LONG_PRESS:
|
case EVENT_MODE_LONG_PRESS:
|
||||||
if (state->tally_idx == _tally_default[state->tally_default_idx]) {
|
if (tally_face_should_move_back(state)) {
|
||||||
_init_val = true;
|
_init_val = true;
|
||||||
movement_move_to_face(0);
|
movement_move_to_face(0);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user