Skip to content

Commit 83838fc

Browse files
authored
Merge pull request #6798 from DavePutz/issue_6735
Fix handling of zero-length pulseout pulse
2 parents 48967ed + c00a630 commit 83838fc

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

ports/nrf/common-hal/pulseio/PulseOut.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,11 @@ static void pulseout_event_handler(nrf_timer_event_t event_type, void *p_context
7474
nrfx_timer_pause(timer);
7575

7676
pulse_array_index++;
77+
// Ignore a zero-length pulse
78+
while (pulse_array_index < pulse_array_length &&
79+
pulse_array[pulse_array_index] == 0) {
80+
pulse_array_index++;
81+
}
7782

7883
// No more pulses. Turn off output and don't restart.
7984
if (pulse_array_index >= pulse_array_length) {

0 commit comments

Comments
 (0)