Merge pull request #6816 from dhalbert/7.3.x-6798-backport

7.3.x #6798 backport (zero-length pulse Pulseout fix
This commit is contained in:
Dan Halbert 2022-08-25 17:01:31 -04:00 committed by GitHub
commit fdda9c0176
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

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