Skip to content

Commit

Permalink
Fix #1385 - I2SO synchronous_write was not waiting long enough
Browse files Browse the repository at this point in the history
  • Loading branch information
MitchBradley committed Dec 10, 2024
1 parent ebc20ea commit 1c2caed
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions FluidNC/esp32/i2s_engine.c
Original file line number Diff line number Diff line change
Expand Up @@ -159,14 +159,10 @@ static int i2s_out_start() {

static bool timer_running = false;

//
// External functions
//
// i2s_out_delay() is used by synchronous_write(), to ensure that that
// the newly-written data has arrived at the shift register output
void i2s_out_delay() {
// Depending on the timing, it may not be reflected immediately,
// so wait twice as long just in case.
uint32_t wait_counts = timer_running ? FIFO_THRESHOLD + FIFO_RELOAD : 2;
delay_us(I2S_OUT_USEC_PER_PULSE * wait_counts);
delay_us((FIFO_LENGTH + FIFO_RELOAD) * (I2S_OUT_USEC_PER_PULSE / 2));
}

void IRAM_ATTR i2s_out_write(pinnum_t pin, uint8_t val) {
Expand Down

0 comments on commit 1c2caed

Please sign in to comment.