Add_Gain_TX_to_GPS_sim_App_issue_480

Add Gain control to the GPS Sim App .
(we are clonning the two previous PR's n #395 and #446 of the Replay App, correcting TX Gain control to this GPS Sim App )
This commit is contained in:
Brumi-2021 2022-01-29 23:29:17 +01:00
parent 799a701fc3
commit a11b9c492f
2 changed files with 32 additions and 8 deletions

View file

@ -140,13 +140,24 @@ void GpsSimAppView::start() {
}
);
}
field_rfgain.on_change = [this](int32_t v) {
tx_gain = v;
};
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 ,
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<int8_t>(receiver_model.lna()),
static_cast<int8_t>(receiver_model.vga())
});
@ -181,6 +192,9 @@ GpsSimAppView::GpsSimAppView(
NavigationView& nav
) : nav_ (nav)
{
tx_gain = 35;field_rfgain.set_value(tx_gain); // Initial default value (-12 dB's max 47dBs ).
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_gps);
add_children({
@ -191,8 +205,8 @@ GpsSimAppView::GpsSimAppView(
&text_duration,
&progressbar,
&field_frequency,
&field_lna,
&field_rf_amp,
&field_rfgain,
&field_rfamp, // let's not use common persistent rf_amp , local rfamp is enough
&check_loop,
&button_play,
&waterfall,