From d0f9073b6700fab5915be5ae1b0a3da1dc49ebed Mon Sep 17 00:00:00 2001 From: Brumi-2021 Date: Sun, 5 Dec 2021 16:18:52 +0100 Subject: [PATCH] Minor improvementes to the previous PR #395 Add Gain_TX to Replay App --- firmware/application/apps/replay_app.cpp | 19 ++++++++++++++----- firmware/application/apps/replay_app.hpp | 9 +++++++-- 2 files changed, 21 insertions(+), 7 deletions(-) diff --git a/firmware/application/apps/replay_app.cpp b/firmware/application/apps/replay_app.cpp index 900a8ed9..5b8d4a99 100644 --- a/firmware/application/apps/replay_app.cpp +++ b/firmware/application/apps/replay_app.cpp @@ -145,16 +145,23 @@ void ReplayAppView::start() { field_rfgain.set_value(tx_gain); receiver_model.set_tx_gain(tx_gain); + + field_rfamp.on_change = [this](int32_t v) { + rf_amp = (bool)v; + }; + field_rfamp.set_value(rf_amp ? 14 : 0); + radio::enable({ receiver_model.tuning_frequency(), sample_rate * 8 , baseband_bandwidth, rf::Direction::Transmit, - receiver_model.rf_amp(), + rf_amp, // previous code line : "receiver_model.rf_amp()," was passing the same rf_amp of all Receiver Apps static_cast(receiver_model.lna()), static_cast(receiver_model.vga()) - }); -} + }); + +} void ReplayAppView::stop(const bool do_loop) { if( is_active() ) @@ -186,7 +193,9 @@ ReplayAppView::ReplayAppView( ) : nav_ (nav) { - tx_gain = 35;field_rfgain.set_value(tx_gain); + tx_gain = 35;field_rfgain.set_value(tx_gain); // Initial default value (-12 dB's max ). + field_rfamp.set_value(rf_amp ? 14 : 0); // Initial default value True. (TX RF amp on , +14dB's) + baseband::run_image(portapack::spi_flash::image_tag_replay); add_children({ @@ -198,7 +207,7 @@ ReplayAppView::ReplayAppView( &progressbar, &field_frequency, &field_rfgain, - &field_rf_amp, + &field_rfamp, // let's not use common rf_amp &check_loop, &button_play, &waterfall, diff --git a/firmware/application/apps/replay_app.hpp b/firmware/application/apps/replay_app.hpp index ac3df3b0..4be20546 100644 --- a/firmware/application/apps/replay_app.hpp +++ b/firmware/application/apps/replay_app.hpp @@ -52,6 +52,7 @@ private: uint32_t sample_rate = 0; int32_t tx_gain { 47 }; + bool rf_amp { true }; // aux private var to store temporal, Replay App rf_amp user selection. static constexpr uint32_t baseband_bandwidth = 2500000; const size_t read_size { 16384 }; const size_t buffer_count { 3 }; @@ -112,8 +113,12 @@ private: 1, ' ' }; - RFAmpField field_rf_amp { - { 19 * 8, 2 * 16 } + NumberField field_rfamp { // previously I was using "RFAmpField field_rf_amp" but that is general Receiver amp setting. + { 19 * 8, 2 * 16 }, + 2, + { 0, 14 }, // this time we will display GUI , 0 or 14 dBs same as Mic App + 14, + ' ' }; Checkbox check_loop { { 21 * 8, 2 * 16 },