Closed rananna closed 3 years ago
I call play next repeatedly with no issues - I can mash the buttons and it keeps playing the assist sequences... things get queued up as expected.
if (handled == false) { if (events & UP_CLICK) { ui_vars.ui8_assist_level++;
if (ui_vars.ui8_assist_level > ui_vars.ui8_number_of_assist_levels) {
ui_vars.ui8_assist_level = ui_vars.ui8_number_of_assist_levels;
led_sequence_play_next(LED_EVENT_ASSIST_LIMITS_REACHED);
}
else led_sequence_play_next(LED_EVENT_ASSIST_LEVEL_INCREASE);
handled = true;
}
if (events & DOWN_CLICK && !ui_vars.ui8_walk_assist) // do not lower assist level if walk assist is active
{
if (ui_vars.ui8_assist_level > 0)
{
ui_vars.ui8_assist_level--;
led_sequence_play_next(LED_EVENT_ASSIST_LEVEL_DECREASE);
}
else led_sequence_play_next(LED_EVENT_ASSIST_LIMITS_REACHED);
handled = true;
}
}
doing a few tests just to double check
doing a few tests just to double check
@rananna - ok does seem that if you call them in succession something odd happens - I'll repot back later this morning with findings!
ok - i can see why it happens - it's because we changed the sequencer to sit on an interrupt. So there isn't a synchronous call to start playing - we queue and in the background wait for the sequencer to fire and start it playing.
So when we call two next in quick succession - the first doesn't get a chance to play because there isn't time for the sequence ISR to fire and register the sequence playing - so it gets lost.
@rananna - ok am off in training again all day so won't be online - but i've submitted a PR that 'fixes' the issue. It's not a nice fix - but does solve the current problem. I'll work on a better fix later this evening.
https://github.com/OpenSourceEBike/TSDZ2_wireless/pull/101/files
@4var1 , If you call led_sequence_next two times in a row, the led sequence will no longer function.