diff --git a/firmware/application/portapack.cpp b/firmware/application/portapack.cpp index 8f60e0647..b640d3576 100644 --- a/firmware/application/portapack.cpp +++ b/firmware/application/portapack.cpp @@ -21,6 +21,7 @@ #include "portapack.hpp" #include "portapack_hal.hpp" +#include "portapack_persistent_memory.hpp" #include "hackrf_hal.hpp" #include "hackrf_gpio.hpp" @@ -127,6 +128,7 @@ void init() { led_tx.setup(); clock_manager.init(); + clock_manager.set_reference_ppb(persistent_memory::correction_ppb()); clock_manager.run_at_full_speed(); clock_manager.start_audio_pll(); diff --git a/firmware/application/radio.cpp b/firmware/application/radio.cpp index 6073ca10b..bd0a80849 100644 --- a/firmware/application/radio.cpp +++ b/firmware/application/radio.cpp @@ -37,7 +37,6 @@ using namespace hackrf::one; #include "portapack.hpp" -#include "portapack_persistent_memory.hpp" namespace radio { @@ -118,9 +117,7 @@ void set_direction(const rf::Direction new_direction) { } bool set_tuning_frequency(const rf::Frequency frequency) { - const int32_t frequency_correction = frequency * portapack::persistent_memory::correction_ppb() / 1000000000; - rf::Frequency corrected_frequency = frequency + frequency_correction; - const auto tuning_config = tuning::config::create(corrected_frequency); + const auto tuning_config = tuning::config::create(frequency); if( tuning_config.is_valid() ) { first_if.disable(); diff --git a/firmware/application/receiver_model.cpp b/firmware/application/receiver_model.cpp index 164d9ce87..93090025b 100644 --- a/firmware/application/receiver_model.cpp +++ b/firmware/application/receiver_model.cpp @@ -49,7 +49,7 @@ int32_t ReceiverModel::reference_ppm_correction() const { void ReceiverModel::set_reference_ppm_correction(int32_t v) { persistent_memory::set_correction_ppb(v * 1000); - update_tuning_frequency(); + clock_manager.set_reference_ppb(v * 1000); } bool ReceiverModel::rf_amp() const {