mirror of
https://github.com/portapack-mayhem/mayhem-firmware.git
synced 2025-08-13 23:17:41 +00:00
Use correct memory region for persistent storage.
Turns out 0x10088000 - 0x10089fff is not the right place. It's 0x40041000, and is only 256 bytes! Move PPM to correct place, change representation to PPB for finer control. Reset PPB value to initial value if read value out of bounds. Clip PPB value on write to permitted bounds. Contributes to resolution of issue #11.
This commit is contained in:
@@ -37,6 +37,7 @@
|
||||
using namespace hackrf::one;
|
||||
|
||||
#include "portapack.hpp"
|
||||
#include "portapack_persistent_memory.hpp"
|
||||
|
||||
namespace radio {
|
||||
|
||||
@@ -117,7 +118,8 @@ void set_direction(const rf::Direction new_direction) {
|
||||
}
|
||||
|
||||
bool set_tuning_frequency(const rf::Frequency frequency) {
|
||||
rf::Frequency corrected_frequency = frequency * (1000000 + shared_memory.correction_ppm) / 1000000;
|
||||
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);
|
||||
if( tuning_config.is_valid() ) {
|
||||
first_if.disable();
|
||||
|
Reference in New Issue
Block a user