Merge pull request #446 from Brumi-2021/“Indep_persistent_memory_14dBs_RF_tx-rx_amp”

Minor improvements to the previous PR #395 Add Gain_TX to Replay App
This commit is contained in:
Erwin Ried 2022-01-12 15:19:54 +01:00 committed by GitHub
commit e5015cc67b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 21 additions and 7 deletions

View File

@ -145,16 +145,23 @@ void ReplayAppView::start() {
field_rfgain.set_value(tx_gain); field_rfgain.set_value(tx_gain);
receiver_model.set_tx_gain(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({ radio::enable({
receiver_model.tuning_frequency(), receiver_model.tuning_frequency(),
sample_rate * 8 , sample_rate * 8 ,
baseband_bandwidth, baseband_bandwidth,
rf::Direction::Transmit, 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<int8_t>(receiver_model.lna()), static_cast<int8_t>(receiver_model.lna()),
static_cast<int8_t>(receiver_model.vga()) static_cast<int8_t>(receiver_model.vga())
}); });
}
}
void ReplayAppView::stop(const bool do_loop) { void ReplayAppView::stop(const bool do_loop) {
if( is_active() ) if( is_active() )
@ -186,7 +193,9 @@ ReplayAppView::ReplayAppView(
) : nav_ (nav) ) : 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); baseband::run_image(portapack::spi_flash::image_tag_replay);
add_children({ add_children({
@ -198,7 +207,7 @@ ReplayAppView::ReplayAppView(
&progressbar, &progressbar,
&field_frequency, &field_frequency,
&field_rfgain, &field_rfgain,
&field_rf_amp, &field_rfamp, // let's not use common rf_amp
&check_loop, &check_loop,
&button_play, &button_play,
&waterfall, &waterfall,

View File

@ -52,6 +52,7 @@ private:
uint32_t sample_rate = 0; uint32_t sample_rate = 0;
int32_t tx_gain { 47 }; 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; static constexpr uint32_t baseband_bandwidth = 2500000;
const size_t read_size { 16384 }; const size_t read_size { 16384 };
const size_t buffer_count { 3 }; const size_t buffer_count { 3 };
@ -112,8 +113,12 @@ private:
1, 1,
' ' ' '
}; };
RFAmpField field_rf_amp { NumberField field_rfamp { // previously I was using "RFAmpField field_rf_amp" but that is general Receiver amp setting.
{ 19 * 8, 2 * 16 } { 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 { Checkbox check_loop {
{ 21 * 8, 2 * 16 }, { 21 * 8, 2 * 16 },