Fix color lcd conversions

This commit is contained in:
Raphael Coeffic
2021-11-10 11:07:01 +01:00
parent 4c8db58166
commit fb4f555442
5 changed files with 24 additions and 3 deletions
@@ -82,11 +82,13 @@ void convertBinRadioData(const char * path, int version)
#if STORAGE_CONVERSIONS < 220 #if STORAGE_CONVERSIONS < 220
if (version == 219) { if (version == 219) {
convertRadioData_219_to_220(path); convertRadioData_219_to_220(path);
version = 220;
} }
#endif #endif
#if STORAGE_CONVERSIONS < 220 #if STORAGE_CONVERSIONS < 220
if (version == 220) { if (version == 220) {
convertRadioData_220_to_221(path); convertRadioData_220_to_221(path);
version = 221;
} }
#endif #endif
converted++; converted++;
@@ -138,16 +140,21 @@ const char* convertBinModelData(const char* filename, int version)
{ {
TRACE("convertModelData(%s,%d)", filename); TRACE("convertModelData(%s,%d)", filename);
char path[FF_MAX_LFN + 1];
memcpy(path, MODELS_PATH, sizeof(MODELS_PATH)-1);
path[sizeof(MODELS_PATH)-1] = '/';
strcat(&path[sizeof(MODELS_PATH)], filename);
#if STORAGE_CONVERSIONS < 220 #if STORAGE_CONVERSIONS < 220
if (version == 219) { if (version == 219) {
const char* error = convertModelData_219_to_220(filename); const char* error = convertModelData_219_to_220(path);
if (error) return error; if (error) return error;
version = 220; version = 220;
} }
#endif #endif
#if STORAGE_CONVERSIONS < 221 #if STORAGE_CONVERSIONS < 221
if (version == 220) { if (version == 220) {
const char* error = convertModelData_220_to_221(filename); const char* error = convertModelData_220_to_221(path);
if (error) return error; if (error) return error;
version = 221; version = 221;
} }
@@ -301,7 +301,7 @@ void convertRadioData_219_to_220(void* data)
// Clear CustomScreenData + TopBarPersistentData // Clear CustomScreenData + TopBarPersistentData
// as they cannot be converted (missing option types) // as they cannot be converted (missing option types)
strcpy(settings.themeName, defaultTheme->getName()); strcpy(settings.themeName, defaultTheme->getName());
defaultTheme->init(); // TODO: just dump the data into the settings memset(&settings.themeData, 0, sizeof(settings.themeData));
#endif #endif
for (int i = 0; i < NUM_SWITCHES_219; ++i) { for (int i = 0; i < NUM_SWITCHES_219; ++i) {
@@ -33,6 +33,9 @@
#define STORAGE_NUM_SLIDERS 0 #define STORAGE_NUM_SLIDERS 0
#define STORAGE_NUM_MOUSE_ANALOGS 0 #define STORAGE_NUM_MOUSE_ANALOGS 0
#define NUM_POTS 2
#define NUM_XPOTS 0
#elif defined(PCBHORUS) #elif defined(PCBHORUS)
#define STORAGE_NUM_SWITCHES 10 #define STORAGE_NUM_SWITCHES 10
@@ -40,6 +43,13 @@
#define STORAGE_NUM_SLIDERS 4 #define STORAGE_NUM_SLIDERS 4
#define STORAGE_NUM_MOUSE_ANALOGS 2 #define STORAGE_NUM_MOUSE_ANALOGS 2
#if defined(PCBX10)
#define NUM_POTS 5
#else
#define NUM_POTS 3
#endif
#define NUM_XPOTS NUM_POTS
#elif defined(PCBTARANIS) #elif defined(PCBTARANIS)
#if defined(PCBX9LITE) #if defined(PCBX9LITE)
@@ -94,6 +94,8 @@ static uint8_t select_zov(uint8_t* data, uint32_t bitoffs)
data += bitoffs >> 3UL; data += bitoffs >> 3UL;
data -= sizeof(ZoneOptionValueEnum); data -= sizeof(ZoneOptionValueEnum);
ZoneOptionValueEnum* p_zovt = (ZoneOptionValueEnum*)data; ZoneOptionValueEnum* p_zovt = (ZoneOptionValueEnum*)data;
if (*p_zovt > ZOV_String)
return 0;
return *p_zovt; return *p_zovt;
} }
#endif #endif
@@ -132,6 +132,8 @@ static uint8_t select_zov(uint8_t* data, uint32_t bitoffs)
data += bitoffs >> 3UL; data += bitoffs >> 3UL;
data -= sizeof(ZoneOptionValueEnum); data -= sizeof(ZoneOptionValueEnum);
ZoneOptionValueEnum* p_zovt = (ZoneOptionValueEnum*)data; ZoneOptionValueEnum* p_zovt = (ZoneOptionValueEnum*)data;
if (*p_zovt > ZOV_String)
return 0;
return *p_zovt; return *p_zovt;
} }
#endif #endif