1
0
Fork 0
mirror of https://github.com/opentx/opentx.git synced 2025-07-26 01:35:21 +03:00

[ARM boards] Model persistent timers / telemetry / pots positions were not always correctly saved

This commit is contained in:
Bertrand Songis 2016-09-13 18:35:03 +02:00
parent 4a88d3477d
commit 2b32abe467
8 changed files with 40 additions and 45 deletions

View file

@ -106,3 +106,29 @@ void postModelLoad(bool alarms)
SEND_FAILSAFE_1S();
PLAY_MODEL_NAME();
}
void storageFlushCurrentModel()
{
saveTimers();
#if defined(CPUARM)
for (int i=0; i<MAX_TELEMETRY_SENSORS; i++) {
TelemetrySensor & sensor = g_model.telemetrySensors[i];
if (sensor.type == TELEM_TYPE_CALCULATED && sensor.persistent && sensor.persistentValue != telemetryItems[i].value) {
sensor.persistentValue = telemetryItems[i].value;
storageDirty(EE_MODEL);
}
}
#endif
#if defined(CPUARM)
if (g_model.potsWarnMode == POTS_WARN_AUTO) {
for (int i=0; i<NUM_POTS+NUM_SLIDERS; i++) {
if (!(g_model.potsWarnEnabled & (1 << i))) {
SAVE_POT_POSITION(i);
}
}
storageDirty(EE_MODEL);
}
#endif
}