More improvements to the rssi tone. Added saving of the tuned frequency

to the radio model persistent store.
This commit is contained in:
teixeluis 2021-06-13 23:35:33 +01:00
parent 43e123bafe
commit a80d91fb1e
4 changed files with 31 additions and 11 deletions

View file

@ -66,6 +66,9 @@ SondeView::SondeView(NavigationView& nav) {
&button_see_map
});
// start from the frequency currently stored in the receiver_model:
target_frequency_ = receiver_model.tuning_frequency();
field_frequency.set_value(target_frequency_);
field_frequency.set_step(500); //euquiq: was 10000, but we are using this for fine-tunning
field_frequency.on_change = [this](rf::Frequency f) {
@ -206,7 +209,9 @@ void SondeView::on_headphone_volume_changed(int32_t v) {
void SondeView::set_target_frequency(const uint32_t new_value) {
target_frequency_ = new_value;
radio::set_tuning_frequency(tuning_frequency());
//radio::set_tuning_frequency(tuning_frequency());
// we better remember the tuned frequency, by using this function instead:
receiver_model.set_tuning_frequency(tuning_frequency());
}
uint32_t SondeView::tuning_frequency() const {

View file

@ -55,14 +55,6 @@ class SondeView : public View {
public:
static constexpr uint32_t sampling_rate = 2457600;
static constexpr uint32_t baseband_bandwidth = 1750000;
static constexpr int rssi_sample_range = 256;
static constexpr float rssi_voltage_min = 0.4;
static constexpr float rssi_voltage_max = 2.2;
static constexpr float adc_voltage_max = 3.3;
static constexpr int raw_min = rssi_sample_range * rssi_voltage_min / adc_voltage_max;
static constexpr int raw_max = rssi_sample_range * rssi_voltage_max / adc_voltage_max;
static constexpr int raw_delta = raw_max - raw_min;
SondeView(NavigationView& nav);
~SondeView();