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:
Jared Boone 2015-08-04 10:03:18 -07:00
parent 255de16d3e
commit 45d26abf10
8 changed files with 120 additions and 8 deletions

View file

@ -22,6 +22,7 @@
#include "receiver_model.hpp"
#include "portapack_shared_memory.hpp"
#include "portapack_persistent_memory.hpp"
#include "portapack.hpp"
using namespace portapack;
@ -43,11 +44,11 @@ void ReceiverModel::set_frequency_step(rf::Frequency f) {
}
int32_t ReceiverModel::reference_ppm_correction() const {
return shared_memory.correction_ppm;
return persistent_memory::correction_ppb() / 1000;
}
void ReceiverModel::set_reference_ppm_correction(int32_t v) {
shared_memory.correction_ppm = v;
persistent_memory::set_correction_ppb(v * 1000);
update_tuning_frequency();
}