Beep-on-packet support in TPMS app (#2062)

* Beep-on-packet support in TPMS app
* audio::output::stop when exiting
This commit is contained in:
Mark Thompson
2024-03-29 15:28:27 -05:00
committed by GitHub
parent 0db65ccb6b
commit 746bf1c15f
4 changed files with 31 additions and 1 deletions

View File

@@ -23,7 +23,7 @@
#include "tpms_app.hpp"
#include "baseband_api.hpp"
#include "audio.hpp"
#include "portapack.hpp"
using namespace portapack;
@@ -32,6 +32,8 @@ using namespace portapack;
#include "utility.hpp"
#include "file_path.hpp"
namespace pmem = portapack::persistent_memory;
namespace tpms {
namespace format {
@@ -147,6 +149,7 @@ TPMSAppView::TPMSAppView(NavigationView&) {
baseband::run_image(portapack::spi_flash::image_tag_tpms);
add_children({&rssi,
&field_volume,
&channel,
&options_band,
&options_pressure,
@@ -179,9 +182,15 @@ TPMSAppView::TPMSAppView(NavigationView&) {
if (logger) {
logger->append(logs_dir / u"TPMS.TXT");
}
if (pmem::beep_on_packets()) {
audio::set_rate(audio::Rate::Hz_24000);
audio::output::start();
}
}
TPMSAppView::~TPMSAppView() {
audio::output::stop();
receiver_model.disable();
baseband::shutdown();
}
@@ -214,6 +223,10 @@ void TPMSAppView::on_packet(const tpms::Packet& packet) {
entry.update(reading);
recent_entries_view.set_dirty();
}
if (pmem::beep_on_packets()) {
baseband::request_audio_beep(1000, 24000, 60);
}
}
void TPMSAppView::on_show_list() {

View File

@@ -143,6 +143,9 @@ class TPMSAppView : public View {
{21 * 8, 0, 6 * 8, 4},
};
AudioVolumeField field_volume{
{28 * 8, 0 * 16}};
Channel channel{
{21 * 8, 5, 6 * 8, 4},
};