Beep-on-packet support in ADSB RX app (#2065)

This commit is contained in:
Mark Thompson 2024-03-29 16:34:18 -05:00 committed by GitHub
parent 6e5eadd25c
commit b473930f94
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 43 additions and 9 deletions

View file

@ -32,9 +32,12 @@
#include "rtc_time.hpp"
#include "string_format.hpp"
#include "file_path.hpp"
#include "audio.hpp"
using namespace portapack;
namespace pmem = portapack::persistent_memory;
namespace ui {
static std::string get_map_tag(const AircraftRecentEntry& entry) {
@ -373,7 +376,8 @@ ADSBRxView::ADSBRxView(NavigationView& nav) {
&rssi,
&recent_entries_view,
&status_frame,
&status_good_frame});
&status_good_frame,
&field_volume});
recent_entries_view.set_parent_rect({0, 16, 240, 272});
recent_entries_view.on_select = [this, &nav](const AircraftRecentEntry& entry) {
@ -395,10 +399,16 @@ ADSBRxView::ADSBRxView(NavigationView& nav) {
receiver_model.enable();
baseband::set_adsb();
if (pmem::beep_on_packets()) {
audio::set_rate(audio::Rate::Hz_24000);
audio::output::start();
}
}
ADSBRxView::~ADSBRxView() {
rtc_time::signal_tick_second -= signal_token_tick_second;
audio::output::stop();
receiver_model.disable();
baseband::shutdown();
}
@ -473,6 +483,10 @@ void ADSBRxView::on_frame(const ADSBFrameMessage* message) {
}
logger->log(log_entry);
if (pmem::beep_on_packets()) {
baseband::request_audio_beep(1000, 24000, 60);
}
}
void ADSBRxView::on_tick_second() {