From bf3f9cfe7535bc269c6517d940a6e075ee988452 Mon Sep 17 00:00:00 2001 From: eried <1091420+eried@users.noreply.github.com> Date: Mon, 8 Jun 2020 01:23:23 +0200 Subject: [PATCH] Setting for hiding the speaker --- firmware/application/apps/ui_settings.cpp | 12 ++++++++++++ firmware/application/apps/ui_settings.hpp | 5 +++++ 2 files changed, 17 insertions(+) diff --git a/firmware/application/apps/ui_settings.cpp b/firmware/application/apps/ui_settings.cpp index b963ab05..3f5708b3 100644 --- a/firmware/application/apps/ui_settings.cpp +++ b/firmware/application/apps/ui_settings.cpp @@ -29,6 +29,7 @@ #include "lpc43xx_cpp.hpp" using namespace lpc43xx; +#include "audio.hpp" #include "portapack.hpp" using portapack::receiver_model; using namespace portapack; @@ -240,12 +241,14 @@ void SetPlayDeadView::focus() { SetUIView::SetUIView(NavigationView& nav) { add_children({ //&checkbox_login, + &checkbox_speaker, &checkbox_bloff, &options_bloff, &checkbox_showsplash, &button_ok }); + checkbox_speaker.set_value(persistent_memory::config_speaker()); checkbox_showsplash.set_value(persistent_memory::config_splash()); //checkbox_login.set_value(persistent_memory::config_login()); @@ -258,6 +261,15 @@ SetUIView::SetUIView(NavigationView& nav) { options_bloff.set_selected_index(0); } + checkbox_speaker.on_select = [this](Checkbox&, bool v) { + if (v) audio::output::speaker_mute(); //Just mute audio if speaker is disabled + + persistent_memory::set_config_speaker(v); //Store Speaker status + + StatusRefreshMessage message { }; //Refresh status bar with/out speaker + EventDispatcher::send_message(message); + }; + button_ok.on_select = [&nav, this](Button&) { if (checkbox_bloff.value()) persistent_memory::set_config_backlight_timer(options_bloff.selected_index() + 1); diff --git a/firmware/application/apps/ui_settings.hpp b/firmware/application/apps/ui_settings.hpp index 0e3abbc7..076ede03 100644 --- a/firmware/application/apps/ui_settings.hpp +++ b/firmware/application/apps/ui_settings.hpp @@ -200,6 +200,11 @@ private: "Login with play dead" };*/ + Checkbox checkbox_speaker { + { 3 * 8, 2 * 16 }, + 20, + "Hide H1 Speaker option" + }; Checkbox checkbox_bloff { { 3 * 8, 5 * 16 }, 20,