Fix handling of zero-length pulseout pulse

This commit is contained in:
root 2022-08-23 15:17:54 -05:00
parent 0b2528bc1b
commit 3daebb36c3
1 changed files with 5 additions and 0 deletions

View File

@ -74,6 +74,11 @@ static void pulseout_event_handler(nrf_timer_event_t event_type, void *p_context
nrfx_timer_pause(timer);
pulse_array_index++;
// Ignore a zero-length pulse
while (pulse_array[pulse_array_index] == 0 &&
pulse_array_index < pulse_array_length) {
pulse_array_index++;
}
// No more pulses. Turn off output and don't restart.
if (pulse_array_index >= pulse_array_length) {