From fe2ba80a108623998c797d1289fafd1034b36756 Mon Sep 17 00:00:00 2001 From: Pezsma <159525557+Pezsma@users.noreply.github.com> Date: Sat, 4 Jul 2026 08:53:28 +0200 Subject: [PATCH] refactor: simplify audio volume handling in AudioVolumeField (#3246) --- firmware/application/ui/ui_receiver.cpp | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/firmware/application/ui/ui_receiver.cpp b/firmware/application/ui/ui_receiver.cpp index 17d08ca4e..6204cf946 100644 --- a/firmware/application/ui/ui_receiver.cpp +++ b/firmware/application/ui/ui_receiver.cpp @@ -26,10 +26,7 @@ #include "string_format.hpp" #include "ui_receiver.hpp" #include "ui_freqman.hpp" - -#ifndef PRALINE #include "audio.hpp" -#endif using namespace portapack; @@ -595,18 +592,13 @@ AudioVolumeField::AudioVolumeField( /* fill char */ ' '} { set_value(receiver_model.normalized_headphone_volume()); -#ifdef PRALINE - on_change = [](int32_t v) { - receiver_model.set_normalized_headphone_volume(v); -#else on_change = [](int32_t vol) { - // don't call receiver model, because this widget shuld be able to handle volume settinsg from any app, regardless of the receiver model's enables state. like the tx apps should be able to set volume too. - // this is identical to the receiver model's method + // Don't call receiver_model here so volume can be adjusted even when ReceiverModel is disabled (e.g. TX apps/games). + // The dB mapping mirrors ReceiverModel::set_normalized_headphone_volume(). uint8_t v = clip(vol, 0, 99); auto new_volume = volume_t::decibel(v - 99) + audio::headphone::volume_range().max; persistent_memory::set_headphone_volume(new_volume); audio::headphone::set_volume(new_volume); -#endif }; }