Conversions fix

This commit is contained in:
Bertrand Songis
2019-03-19 14:18:27 +01:00
parent d0c6f6b9b7
commit 9831853050
2 changed files with 54 additions and 10 deletions
+22 -2
View File
@@ -1,9 +1,29 @@
if(NOT PCB STREQUAL X3) if(PCB STREQUAL X9D OR PCB STREQUAL X9DP OR PCB STREQUAL SKY9X)
add_definitions(-DEEPROM_CONVERSIONS) set(EEPROM_CONVERSIONS 216)
endif()
if(PCB STREQUAL X12S OR PCB STREQUAL X10 OR PCB STREQUAL X7 OR PCB STREQUAL XLITE)
set(EEPROM_CONVERSIONS 218)
endif()
if(EEPROM_CONVERSIONS)
add_definitions(-DEEPROM_CONVERSIONS=${EEPROM_CONVERSIONS})
set(SRC set(SRC
${SRC} ${SRC}
storage/conversions/conversions.cpp storage/conversions/conversions.cpp
)
endif()
if(EEPROM_CONVERSIONS GREATER 215)
set(SRC
${SRC}
storage/conversions/conversions_216_218.cpp storage/conversions/conversions_216_218.cpp
)
endif()
if(EEPROM_CONVERSIONS GREATER 217)
set(SRC
${SRC}
storage/conversions/conversions_218_219.cpp storage/conversions/conversions_218_219.cpp
) )
endif() endif()
+32 -8
View File
@@ -25,20 +25,26 @@ void convertModelData(int id, int version)
{ {
eeLoadModelData(id); eeLoadModelData(id);
#if EEPROM_CONVERSIONS >= 216
if (version == 216) { if (version == 216) {
version = 217; version = 217;
convertModelData_216_to_217(g_model); convertModelData_216_to_217(g_model);
} }
#endif
#if EEPROM_CONVERSIONS >= 217
if (version == 217) { if (version == 217) {
version = 218; version = 218;
convertModelData_217_to_218(g_model); convertModelData_217_to_218(g_model);
} }
#endif
#if EEPROM_CONVERSIONS >= 218
if (version == 218) { if (version == 218) {
version = 219; version = 219;
convertModelData_218_to_219(g_model); convertModelData_218_to_219(g_model);
} }
#endif
uint8_t currModel = g_eeGeneral.currModel; uint8_t currModel = g_eeGeneral.currModel;
g_eeGeneral.currModel = id; g_eeGeneral.currModel = id;
@@ -51,14 +57,18 @@ bool eeConvert()
{ {
const char *msg = NULL; const char *msg = NULL;
if (g_eeGeneral.version == 216) { switch (g_eeGeneral.version) {
msg = "EEprom Data v216"; case 216:
} msg = "EEprom Data v216";
else if (g_eeGeneral.version == 217) { break;
msg = "EEprom Data v217"; case 217:
} msg = "EEprom Data v217";
else { break;
return false; case 218:
msg = "EEprom Data v218";
break;
default:
return false;
} }
int conversionVersionStart = g_eeGeneral.version; int conversionVersionStart = g_eeGeneral.version;
@@ -78,14 +88,28 @@ bool eeConvert()
// General Settings conversion // General Settings conversion
eeLoadGeneralSettingsData(); eeLoadGeneralSettingsData();
int version = conversionVersionStart; int version = conversionVersionStart;
#if EEPROM_CONVERSIONS >= 216
if (version == 216) { if (version == 216) {
version = 217; version = 217;
convertRadioData_216_to_217(g_eeGeneral); convertRadioData_216_to_217(g_eeGeneral);
} }
#endif
#if EEPROM_CONVERSIONS >= 217
if (version == 217) { if (version == 217) {
version = 218; version = 218;
convertRadioData_217_to_218(g_eeGeneral); convertRadioData_217_to_218(g_eeGeneral);
} }
#endif
#if EEPROM_CONVERSIONS >= 218
if (version == 218) {
version = 219;
// no conversion needed for now
}
#endif
storageDirty(EE_GENERAL); storageDirty(EE_GENERAL);
storageCheck(true); storageCheck(true);