Skip to content

Commit

Permalink
Beep-on-packet support in POCSAG app (#2061)
Browse files Browse the repository at this point in the history
  • Loading branch information
NotherNgineer authored Mar 29, 2024
1 parent fe2fbb8 commit 0db65cc
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 0 deletions.
8 changes: 8 additions & 0 deletions firmware/application/apps/pocsag_app.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,10 @@ POCSAGAppView::POCSAGAppView(NavigationView& nav)
};

refresh_ui();

if (pmem::beep_on_packets())
audio::set_rate(audio::Rate::Hz_24000);

audio::output::start();
receiver_model.enable();
baseband::set_pocsag();
Expand Down Expand Up @@ -304,6 +308,10 @@ void POCSAGAppView::on_packet(const POCSAGPacketMessage* message) {

// Set status icon color to indicate state machine 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) {
Expand Down
8 changes: 8 additions & 0 deletions firmware/baseband/proc_pocsag2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -361,6 +361,10 @@ void POCSAGProcessor::on_message(const Message* const message) {
break;
}

case Message::ID::AudioBeep:
on_beep_message(*reinterpret_cast<const AudioBeepMessage*>(message));
break;

default:
break;
}
Expand Down Expand Up @@ -414,6 +418,10 @@ void POCSAGProcessor::send_packet() {
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 **************************************************/

int main() {
Expand Down
1 change: 1 addition & 0 deletions firmware/baseband/proc_pocsag2.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,7 @@ class POCSAGProcessor : public BasebandProcessor {
void reset();
void send_stats() const;
void send_packet();
void on_beep_message(const AudioBeepMessage& message);

/* Set once app is ready to receive messages. */
bool configured = false;
Expand Down

0 comments on commit 0db65cc

Please sign in to comment.