Added a beep duration parameter (#2013)

This commit is contained in:
Mark Thompson
2024-03-19 12:23:06 -05:00
committed by GitHub
parent 74442f197d
commit 308573918c
3 changed files with 14 additions and 6 deletions

View File

@@ -59,7 +59,7 @@ void SondeProcessor::on_message(const Message* const msg) {
case Message::ID::RequestSignal:
if ((*reinterpret_cast<const RequestSignalMessage*>(msg)).signal == RequestSignalMessage::Signal::BeepRequest) {
float rssi_ratio = (float)last_rssi / (float)RSSI_CEILING;
int beep_duration = 0;
uint32_t beep_duration = 0;
if (rssi_ratio <= PROPORTIONAL_BEEP_THRES) {
beep_duration = BEEP_MIN_DURATION;
@@ -69,9 +69,7 @@ void SondeProcessor::on_message(const Message* const msg) {
beep_duration = BEEP_DURATION_RANGE + BEEP_MIN_DURATION;
}
audio::dma::beep_start(beep_freq, AUDIO_SAMPLE_RATE);
chThdSleepMilliseconds(beep_duration);
audio::dma::beep_stop();
audio::dma::beep_start(beep_freq, AUDIO_SAMPLE_RATE, beep_duration);
}
break;