Skip to content

Commit b494d97

Browse files
Flush sampels received during startup and transmission
During transmission, the buffer is being filled with data received. However the concept of walkie talkie is that it is not being buffered, as it creates problems.
1 parent b384bea commit b494d97

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/Application.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,8 @@ void Application::begin()
9999
pinMode(GPIO_TRANSMIT_BUTTON, INPUT_PULLDOWN);
100100
// start off with i2S output running
101101
m_output->start(SAMPLE_RATE);
102+
// flush all samples received during startup
103+
m_output_buffer->flush();
102104
// start the main task for the application
103105
TaskHandle_t task_handle;
104106
xTaskCreate(application_task, "application_task", 8192, this, 1, &task_handle);
@@ -132,7 +134,10 @@ void Application::loop()
132134
m_transport->add_sample(samples[i]);
133135
}
134136
}
137+
// send all packets still in the transport buffer
135138
m_transport->flush();
139+
// throw away all packets that have been received during transmission
140+
m_output_buffer->flush();
136141
// finished transmitting stop the input and start the output
137142
Serial.println("Finished transmitting");
138143
m_indicator_led->set_is_flashing(false, 0xff0000);

0 commit comments

Comments
 (0)