Beep-on-packet support in POCSAG app (#2061)

This commit is contained in:
Mark Thompson 2024-03-29 15:27:53 -05:00 committed by GitHub
parent fe2fbb847f
commit 0db65ccb6b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 17 additions and 0 deletions

View File

@ -136,6 +136,10 @@ POCSAGAppView::POCSAGAppView(NavigationView& nav)
}; };
refresh_ui(); refresh_ui();
if (pmem::beep_on_packets())
audio::set_rate(audio::Rate::Hz_24000);
audio::output::start(); audio::output::start();
receiver_model.enable(); receiver_model.enable();
baseband::set_pocsag(); baseband::set_pocsag();
@ -304,6 +308,10 @@ void POCSAGAppView::on_packet(const POCSAGPacketMessage* message) {
// Set status icon color to indicate state machine state. // Set status icon color to indicate state machine state.
image_status.set_foreground(get_status_color(pocsag_state)); image_status.set_foreground(get_status_color(pocsag_state));
if (pmem::beep_on_packets()) {
baseband::request_audio_beep(1000, 24000, 60);
}
} }
void POCSAGAppView::on_stats(const POCSAGStatsMessage* stats) { void POCSAGAppView::on_stats(const POCSAGStatsMessage* stats) {

View File

@ -361,6 +361,10 @@ void POCSAGProcessor::on_message(const Message* const message) {
break; break;
} }
case Message::ID::AudioBeep:
on_beep_message(*reinterpret_cast<const AudioBeepMessage*>(message));
break;
default: default:
break; break;
} }
@ -414,6 +418,10 @@ void POCSAGProcessor::send_packet() {
shared_memory.application_queue.push(message); shared_memory.application_queue.push(message);
} }
void POCSAGProcessor::on_beep_message(const AudioBeepMessage& message) {
audio::dma::beep_start(message.freq, message.sample_rate, message.duration_ms);
}
/* main **************************************************/ /* main **************************************************/
int main() { int main() {

View File

@ -212,6 +212,7 @@ class POCSAGProcessor : public BasebandProcessor {
void reset(); void reset();
void send_stats() const; void send_stats() const;
void send_packet(); void send_packet();
void on_beep_message(const AudioBeepMessage& message);
/* Set once app is ready to receive messages. */ /* Set once app is ready to receive messages. */
bool configured = false; bool configured = false;