From 610326f21640962227d8766d5e464789d2743588 Mon Sep 17 00:00:00 2001 From: Raphael Coeffic Date: Sun, 20 Mar 2022 10:18:01 +0100 Subject: [PATCH] Write 'semver' tag with the current firmware version (#1695) And remove `version`/`variant`. --- radio/src/datastructs.h | 16 +++--- radio/src/datastructs_private.h | 4 +- radio/src/opentx.cpp | 5 -- radio/src/storage/conversions/conversions.cpp | 15 ++--- radio/src/storage/conversions/conversions.h | 2 +- radio/src/storage/eeprom_rlc.cpp | 56 +++++-------------- radio/src/storage/sdcard_yaml.cpp | 4 +- .../storage/yaml/yaml_datastructs_funcs.cpp | 7 +++ .../storage/yaml/yaml_datastructs_nv14.cpp | 4 +- .../src/storage/yaml/yaml_datastructs_t12.cpp | 4 +- .../src/storage/yaml/yaml_datastructs_t8.cpp | 4 +- .../storage/yaml/yaml_datastructs_tlite.cpp | 4 +- .../storage/yaml/yaml_datastructs_tpro.cpp | 4 +- .../storage/yaml/yaml_datastructs_tx12.cpp | 4 +- .../src/storage/yaml/yaml_datastructs_x10.cpp | 4 +- .../storage/yaml/yaml_datastructs_x12s.cpp | 4 +- .../src/storage/yaml/yaml_datastructs_x7.cpp | 4 +- .../src/storage/yaml/yaml_datastructs_x9d.cpp | 4 +- .../src/storage/yaml/yaml_datastructs_x9e.cpp | 4 +- .../storage/yaml/yaml_datastructs_x9lite.cpp | 4 +- .../storage/yaml/yaml_datastructs_x9lites.cpp | 4 +- .../storage/yaml/yaml_datastructs_xlite.cpp | 4 +- .../storage/yaml/yaml_datastructs_xlites.cpp | 4 +- .../storage/yaml/yaml_datastructs_zorro.cpp | 4 +- radio/src/tests/conversions.cpp | 4 -- 25 files changed, 69 insertions(+), 108 deletions(-) diff --git a/radio/src/datastructs.h b/radio/src/datastructs.h index 4f3a3fd18..a8c667558 100644 --- a/radio/src/datastructs.h +++ b/radio/src/datastructs.h @@ -116,29 +116,29 @@ static inline void check_struct() CHKSIZE(TrainerData, 16); #if defined(PCBXLITES) - CHKSIZE(RadioData, 860); + CHKSIZE(RadioData, 857); CHKSIZE(ModelData, 6161); #elif defined(PCBXLITE) - CHKSIZE(RadioData, 858); + CHKSIZE(RadioData, 855); CHKSIZE(ModelData, 6161); #elif defined(RADIO_TPRO) - CHKSIZE(RadioData, 841); + CHKSIZE(RadioData, 838); CHKSIZE(ModelData, 6186); #elif defined(PCBX7) - CHKSIZE(RadioData, 864); + CHKSIZE(RadioData, 861); CHKSIZE(ModelData, 6161); #elif defined(PCBX9E) - CHKSIZE(RadioData, 954); + CHKSIZE(RadioData, 951); CHKSIZE(ModelData, 6613); #elif defined(PCBX9D) || defined(PCBX9DP) - CHKSIZE(RadioData, 896); + CHKSIZE(RadioData, 893); CHKSIZE(ModelData, 6605); #elif defined(PCBHORUS) #if defined(PCBX10) - CHKSIZE(RadioData, 921); + CHKSIZE(RadioData, 918); CHKSIZE(ModelData, 11025); #else - CHKSIZE(RadioData, 903); + CHKSIZE(RadioData, 900); CHKSIZE(ModelData, 11023); #endif #endif diff --git a/radio/src/datastructs_private.h b/radio/src/datastructs_private.h index 603c428bd..587bbc78f 100644 --- a/radio/src/datastructs_private.h +++ b/radio/src/datastructs_private.h @@ -637,6 +637,7 @@ PACK(struct PartialModel { }); PACK(struct ModelData { + CUST_ATTR(semver,nullptr,w_semver); ModelHeader header; TimerData timers[MAX_TIMERS]; uint8_t telemetryProtocol:3; @@ -841,9 +842,8 @@ PACK(struct TrainerData { PACK(struct RadioData { // Real attributes - NOBACKUP(uint8_t version); + CUST_ATTR(semver,nullptr,w_semver); CUST_ATTR(board,nullptr,w_board); - NOBACKUP(uint16_t variant SKIP); CalibData calib[NUM_STICKS + STORAGE_NUM_POTS + STORAGE_NUM_SLIDERS + STORAGE_NUM_MOUSE_ANALOGS] NO_IDX; NOBACKUP(uint16_t chkSum SKIP); N_HORUS_FIELD(int8_t currModel); diff --git a/radio/src/opentx.cpp b/radio/src/opentx.cpp index f8eb98194..023404666 100644 --- a/radio/src/opentx.cpp +++ b/radio/src/opentx.cpp @@ -272,8 +272,6 @@ void setDefaultOwnerId() void generalDefault() { memclear(&g_eeGeneral, sizeof(g_eeGeneral)); - g_eeGeneral.version = EEPROM_VER; - g_eeGeneral.variant = EEPROM_VARIANT; #if defined(PCBHORUS) g_eeGeneral.blOffBright = 20; @@ -1670,9 +1668,6 @@ void copyMinMaxToOutputs(uint8_t ch) inline uint32_t PWR_PRESS_DURATION_MIN() { - if (g_eeGeneral.version != EEPROM_VER) - return 200; - return (2 - g_eeGeneral.pwrOnSpeed) * 100; } diff --git a/radio/src/storage/conversions/conversions.cpp b/radio/src/storage/conversions/conversions.cpp index 2c8fa4bed..eb638950e 100644 --- a/radio/src/storage/conversions/conversions.cpp +++ b/radio/src/storage/conversions/conversions.cpp @@ -215,11 +215,11 @@ void eeConvertModel(int id, int version) // TODO: error handling } -bool eeConvert() +bool eeConvert(uint8_t start_version) { const char *msg = NULL; - switch (g_eeGeneral.version) { + switch (start_version) { case 219: msg = "EEprom Data v219"; break; @@ -230,8 +230,6 @@ bool eeConvert() return false; } - int conversionVersionStart = g_eeGeneral.version; - // Information to the user and wait for key press g_eeGeneral.backlightMode = e_backlight_mode_on; g_eeGeneral.backlightBright = 0; @@ -242,7 +240,8 @@ bool eeConvert() RAISE_ALERT(STR_STORAGE_WARNING, STR_EEPROM_CONVERTING, NULL, AU_NONE); // General Settings conversion - int version = conversionVersionStart; + int version = start_version; + (void)version; sdCheckAndCreateDirectory(RADIO_PATH); sdCheckAndCreateDirectory(MODELS_PATH); @@ -259,10 +258,6 @@ bool eeConvert() convertRadioData_220_to_221(); } #endif - //TODO: reload from YAML - g_eeGeneral.version = EEPROM_VER; - // storageDirty(EE_GENERAL); - // storageCheck(true); #if defined(STORAGE_MODELSLIST) modelslist.clear(); @@ -292,7 +287,7 @@ bool eeConvert() #else if (eeModelExists(id)) { #endif - eeConvertModel(id, conversionVersionStart); + eeConvertModel(id, start_version); } } diff --git a/radio/src/storage/conversions/conversions.h b/radio/src/storage/conversions/conversions.h index 2f0e49b89..135533091 100644 --- a/radio/src/storage/conversions/conversions.h +++ b/radio/src/storage/conversions/conversions.h @@ -23,7 +23,7 @@ void convertBinRadioData(const char * path, int version); const char* convertBinModelData(char * filename, int version); -bool eeConvert(); +bool eeConvert(uint8_t start_version); void eeConvertModel(int id, int version); // // Conversions 216 to 217 diff --git a/radio/src/storage/eeprom_rlc.cpp b/radio/src/storage/eeprom_rlc.cpp index 0c8d80315..e40377ea3 100644 --- a/radio/src/storage/eeprom_rlc.cpp +++ b/radio/src/storage/eeprom_rlc.cpp @@ -793,61 +793,31 @@ uint16_t eeLoadModelData(uint8_t index) bool eeLoadGeneral(bool allowFixes) { theFile.openRlc(FILE_GENERAL); - if (theFile.readRlc((uint8_t*)&g_eeGeneral, 3) == 3 && g_eeGeneral.version == EEPROM_VER) { + + uint8_t versions[3]; + uint16_t* variant = (uint16_t*)&versions[1]; + + if (theFile.readRlc(versions, 3) == 3 && versions[0] == EEPROM_VER) { theFile.openRlc(FILE_GENERAL); - if (theFile.readRlc((uint8_t*)&g_eeGeneral, sizeof(g_eeGeneral)) <= sizeof(g_eeGeneral) && g_eeGeneral.variant == EEPROM_VARIANT) { + if (theFile.readRlc((uint8_t *)&g_eeGeneral, sizeof(g_eeGeneral)) <= + sizeof(g_eeGeneral) && + *variant == EEPROM_VARIANT) { return true; } } -#if defined(PCBX7) - if (g_eeGeneral.variant == 0) { - TRACE("Pre release EEPROM detected, variant %d instead of %d for X7 radio. Loading anyway", g_eeGeneral.variant, EEPROM_VARIANT); - g_eeGeneral.variant = EEPROM_VARIANT; - storageDirty(EE_GENERAL); - return true; - } -#endif - -#if defined(PCBX9LITES) - if (g_eeGeneral.variant == 0x0800) { - TRACE("Pre release EEPROM detected, variant %d instead of %d for X9LiteS radio. Loading anyway", g_eeGeneral.variant, EEPROM_VARIANT); - g_eeGeneral.variant = EEPROM_VARIANT; - storageDirty(EE_GENERAL); - return true; - } -#endif - -#if defined(RADIO_T12) - if (g_eeGeneral.variant != (EEPROM_VARIANT & 0xFFFE)) { - TRACE("EEPROM variant %d instead of %d", g_eeGeneral.variant, EEPROM_VARIANT); - return false; - } - else if (g_eeGeneral.variant != EEPROM_VARIANT && g_eeGeneral.version == 218) { - TRACE("V218 T12/X7 detected, allowing use", g_eeGeneral.variant, EEPROM_VARIANT); // Production firmware use v218 X7 variant - } - else { - TRACE("EEPROM variant %d instead of %d", g_eeGeneral.variant, EEPROM_VARIANT); - return false; - } -#elif defined(PCBTARANIS) - if (g_eeGeneral.variant != EEPROM_VARIANT) { - TRACE("EEPROM variant %d instead of %d", g_eeGeneral.variant, EEPROM_VARIANT); - return false; - } -#endif - #if defined(STORAGE_CONVERSIONS) - if (g_eeGeneral.version != EEPROM_VER) { - TRACE("EEPROM version %d instead of %d", g_eeGeneral.version, EEPROM_VER); + if (versions[0] != EEPROM_VER) { + TRACE("EEPROM version %d instead of %d", versions[0], EEPROM_VER); if (!allowFixes) return false; // prevent eeprom from being wiped - if (!eeConvert()) + if (!eeConvert(versions[0])) return false; } return true; #else - TRACE("EEPROM version %d (%d) instead of %d (%d)", g_eeGeneral.version, g_eeGeneral.variant, EEPROM_VER, EEPROM_VARIANT); + TRACE("EEPROM version %d (%d) instead of %d (%d)", versions[0], *variant, + EEPROM_VER, EEPROM_VARIANT); return false; #endif } diff --git a/radio/src/storage/sdcard_yaml.cpp b/radio/src/storage/sdcard_yaml.cpp index bcb1f38df..fdcdf2fe7 100644 --- a/radio/src/storage/sdcard_yaml.cpp +++ b/radio/src/storage/sdcard_yaml.cpp @@ -123,9 +123,7 @@ const char * loadRadioSettings() || (*variant != EEPROM_VARIANT)) { return "ERROR"; } - g_eeGeneral.version = versions[0]; - g_eeGeneral.variant = *variant; - eeConvert(); + eeConvert(versions[0]); #else #error "Unsupported conversion format" #endif diff --git a/radio/src/storage/yaml/yaml_datastructs_funcs.cpp b/radio/src/storage/yaml/yaml_datastructs_funcs.cpp index 68c15bcd4..a65a1a52b 100644 --- a/radio/src/storage/yaml/yaml_datastructs_funcs.cpp +++ b/radio/src/storage/yaml/yaml_datastructs_funcs.cpp @@ -24,6 +24,7 @@ #include "yaml_tree_walker.h" #include "pulses/multi.h" +#include "stamp.h" // Use definitions from v220 conversions as long as nothing changes @@ -136,6 +137,12 @@ static inline void check_yaml_funcs() #endif } +static bool w_semver(void* user, uint8_t* data, uint32_t bitoffs, + yaml_writer_func wf, void* opaque) +{ + return wf(opaque, VERSION, sizeof(VERSION)-1); +} + static bool w_board(void* user, uint8_t* data, uint32_t bitoffs, yaml_writer_func wf, void* opaque) { diff --git a/radio/src/storage/yaml/yaml_datastructs_nv14.cpp b/radio/src/storage/yaml/yaml_datastructs_nv14.cpp index 0f849ff67..60e463020 100644 --- a/radio/src/storage/yaml/yaml_datastructs_nv14.cpp +++ b/radio/src/storage/yaml/yaml_datastructs_nv14.cpp @@ -362,9 +362,8 @@ static const struct YamlNode struct_OpenTxTheme__PersistentData[] = { YAML_END }; static const struct YamlNode struct_RadioData[] = { - YAML_UNSIGNED( "version", 8 ), + YAML_CUSTOM("semver",nullptr,w_semver), YAML_CUSTOM("board",nullptr,w_board), - YAML_PADDING( 16 ), YAML_ARRAY("calib", 48, 9, struct_CalibData, NULL), YAML_PADDING( 16 ), YAML_SIGNED( "currModel", 8 ), @@ -830,6 +829,7 @@ static const struct YamlNode struct_TopBarPersistentData[] = { YAML_END }; static const struct YamlNode struct_ModelData[] = { + YAML_CUSTOM("semver",nullptr,w_semver), YAML_STRUCT("header", 248, struct_ModelHeader, NULL), YAML_ARRAY("timers", 128, 3, struct_TimerData, NULL), YAML_UNSIGNED( "telemetryProtocol", 3 ), diff --git a/radio/src/storage/yaml/yaml_datastructs_t12.cpp b/radio/src/storage/yaml/yaml_datastructs_t12.cpp index 8b2e6f73f..5dc03c25f 100644 --- a/radio/src/storage/yaml/yaml_datastructs_t12.cpp +++ b/radio/src/storage/yaml/yaml_datastructs_t12.cpp @@ -333,9 +333,8 @@ static const struct YamlNode struct_string_24[] = { YAML_END }; static const struct YamlNode struct_RadioData[] = { - YAML_UNSIGNED( "version", 8 ), + YAML_CUSTOM("semver",nullptr,w_semver), YAML_CUSTOM("board",nullptr,w_board), - YAML_PADDING( 16 ), YAML_ARRAY("calib", 48, 6, struct_CalibData, NULL), YAML_PADDING( 16 ), YAML_SIGNED( "currModel", 8 ), @@ -799,6 +798,7 @@ static const struct YamlNode struct_TelemetryScreenData[] = { YAML_END }; static const struct YamlNode struct_ModelData[] = { + YAML_CUSTOM("semver",nullptr,w_semver), YAML_STRUCT("header", 96, struct_ModelHeader, NULL), YAML_ARRAY("timers", 88, 3, struct_TimerData, NULL), YAML_UNSIGNED( "telemetryProtocol", 3 ), diff --git a/radio/src/storage/yaml/yaml_datastructs_t8.cpp b/radio/src/storage/yaml/yaml_datastructs_t8.cpp index 2bf9a7048..11cdef60b 100644 --- a/radio/src/storage/yaml/yaml_datastructs_t8.cpp +++ b/radio/src/storage/yaml/yaml_datastructs_t8.cpp @@ -333,9 +333,8 @@ static const struct YamlNode struct_string_24[] = { YAML_END }; static const struct YamlNode struct_RadioData[] = { - YAML_UNSIGNED( "version", 8 ), + YAML_CUSTOM("semver",nullptr,w_semver), YAML_CUSTOM("board",nullptr,w_board), - YAML_PADDING( 16 ), YAML_ARRAY("calib", 48, 6, struct_CalibData, NULL), YAML_PADDING( 16 ), YAML_SIGNED( "currModel", 8 ), @@ -799,6 +798,7 @@ static const struct YamlNode struct_TelemetryScreenData[] = { YAML_END }; static const struct YamlNode struct_ModelData[] = { + YAML_CUSTOM("semver",nullptr,w_semver), YAML_STRUCT("header", 96, struct_ModelHeader, NULL), YAML_ARRAY("timers", 88, 3, struct_TimerData, NULL), YAML_UNSIGNED( "telemetryProtocol", 3 ), diff --git a/radio/src/storage/yaml/yaml_datastructs_tlite.cpp b/radio/src/storage/yaml/yaml_datastructs_tlite.cpp index 2bf9a7048..11cdef60b 100644 --- a/radio/src/storage/yaml/yaml_datastructs_tlite.cpp +++ b/radio/src/storage/yaml/yaml_datastructs_tlite.cpp @@ -333,9 +333,8 @@ static const struct YamlNode struct_string_24[] = { YAML_END }; static const struct YamlNode struct_RadioData[] = { - YAML_UNSIGNED( "version", 8 ), + YAML_CUSTOM("semver",nullptr,w_semver), YAML_CUSTOM("board",nullptr,w_board), - YAML_PADDING( 16 ), YAML_ARRAY("calib", 48, 6, struct_CalibData, NULL), YAML_PADDING( 16 ), YAML_SIGNED( "currModel", 8 ), @@ -799,6 +798,7 @@ static const struct YamlNode struct_TelemetryScreenData[] = { YAML_END }; static const struct YamlNode struct_ModelData[] = { + YAML_CUSTOM("semver",nullptr,w_semver), YAML_STRUCT("header", 96, struct_ModelHeader, NULL), YAML_ARRAY("timers", 88, 3, struct_TimerData, NULL), YAML_UNSIGNED( "telemetryProtocol", 3 ), diff --git a/radio/src/storage/yaml/yaml_datastructs_tpro.cpp b/radio/src/storage/yaml/yaml_datastructs_tpro.cpp index 0d54e72e6..323581225 100644 --- a/radio/src/storage/yaml/yaml_datastructs_tpro.cpp +++ b/radio/src/storage/yaml/yaml_datastructs_tpro.cpp @@ -341,9 +341,8 @@ static const struct YamlNode struct_string_24[] = { YAML_END }; static const struct YamlNode struct_RadioData[] = { - YAML_UNSIGNED( "version", 8 ), + YAML_CUSTOM("semver",nullptr,w_semver), YAML_CUSTOM("board",nullptr,w_board), - YAML_PADDING( 16 ), YAML_ARRAY("calib", 48, 6, struct_CalibData, NULL), YAML_PADDING( 16 ), YAML_SIGNED( "currModel", 8 ), @@ -805,6 +804,7 @@ static const struct YamlNode struct_TelemetryScreenData[] = { YAML_END }; static const struct YamlNode struct_ModelData[] = { + YAML_CUSTOM("semver",nullptr,w_semver), YAML_STRUCT("header", 96, struct_ModelHeader, NULL), YAML_ARRAY("timers", 88, 3, struct_TimerData, NULL), YAML_UNSIGNED( "telemetryProtocol", 3 ), diff --git a/radio/src/storage/yaml/yaml_datastructs_tx12.cpp b/radio/src/storage/yaml/yaml_datastructs_tx12.cpp index 21e4c4f29..71cfa04d5 100644 --- a/radio/src/storage/yaml/yaml_datastructs_tx12.cpp +++ b/radio/src/storage/yaml/yaml_datastructs_tx12.cpp @@ -333,9 +333,8 @@ static const struct YamlNode struct_string_24[] = { YAML_END }; static const struct YamlNode struct_RadioData[] = { - YAML_UNSIGNED( "version", 8 ), + YAML_CUSTOM("semver",nullptr,w_semver), YAML_CUSTOM("board",nullptr,w_board), - YAML_PADDING( 16 ), YAML_ARRAY("calib", 48, 6, struct_CalibData, NULL), YAML_PADDING( 16 ), YAML_SIGNED( "currModel", 8 ), @@ -799,6 +798,7 @@ static const struct YamlNode struct_TelemetryScreenData[] = { YAML_END }; static const struct YamlNode struct_ModelData[] = { + YAML_CUSTOM("semver",nullptr,w_semver), YAML_STRUCT("header", 96, struct_ModelHeader, NULL), YAML_ARRAY("timers", 88, 3, struct_TimerData, NULL), YAML_UNSIGNED( "telemetryProtocol", 3 ), diff --git a/radio/src/storage/yaml/yaml_datastructs_x10.cpp b/radio/src/storage/yaml/yaml_datastructs_x10.cpp index a5a436a49..244a023b7 100644 --- a/radio/src/storage/yaml/yaml_datastructs_x10.cpp +++ b/radio/src/storage/yaml/yaml_datastructs_x10.cpp @@ -385,9 +385,8 @@ static const struct YamlNode struct_OpenTxTheme__PersistentData[] = { YAML_END }; static const struct YamlNode struct_RadioData[] = { - YAML_UNSIGNED( "version", 8 ), + YAML_CUSTOM("semver",nullptr,w_semver), YAML_CUSTOM("board",nullptr,w_board), - YAML_PADDING( 16 ), YAML_ARRAY("calib", 48, 17, struct_CalibData, NULL), YAML_PADDING( 16 ), YAML_UNSIGNED( "vBatWarn", 8 ), @@ -851,6 +850,7 @@ static const struct YamlNode struct_TopBarPersistentData[] = { YAML_END }; static const struct YamlNode struct_ModelData[] = { + YAML_CUSTOM("semver",nullptr,w_semver), YAML_STRUCT("header", 248, struct_ModelHeader, NULL), YAML_ARRAY("timers", 128, 3, struct_TimerData, NULL), YAML_UNSIGNED( "telemetryProtocol", 3 ), diff --git a/radio/src/storage/yaml/yaml_datastructs_x12s.cpp b/radio/src/storage/yaml/yaml_datastructs_x12s.cpp index 396932e15..4dccba04d 100644 --- a/radio/src/storage/yaml/yaml_datastructs_x12s.cpp +++ b/radio/src/storage/yaml/yaml_datastructs_x12s.cpp @@ -383,9 +383,8 @@ static const struct YamlNode struct_OpenTxTheme__PersistentData[] = { YAML_END }; static const struct YamlNode struct_RadioData[] = { - YAML_UNSIGNED( "version", 8 ), + YAML_CUSTOM("semver",nullptr,w_semver), YAML_CUSTOM("board",nullptr,w_board), - YAML_PADDING( 16 ), YAML_ARRAY("calib", 48, 15, struct_CalibData, NULL), YAML_PADDING( 16 ), YAML_UNSIGNED( "vBatWarn", 8 ), @@ -849,6 +848,7 @@ static const struct YamlNode struct_TopBarPersistentData[] = { YAML_END }; static const struct YamlNode struct_ModelData[] = { + YAML_CUSTOM("semver",nullptr,w_semver), YAML_STRUCT("header", 248, struct_ModelHeader, NULL), YAML_ARRAY("timers", 128, 3, struct_TimerData, NULL), YAML_UNSIGNED( "telemetryProtocol", 3 ), diff --git a/radio/src/storage/yaml/yaml_datastructs_x7.cpp b/radio/src/storage/yaml/yaml_datastructs_x7.cpp index 2bf9a7048..11cdef60b 100644 --- a/radio/src/storage/yaml/yaml_datastructs_x7.cpp +++ b/radio/src/storage/yaml/yaml_datastructs_x7.cpp @@ -333,9 +333,8 @@ static const struct YamlNode struct_string_24[] = { YAML_END }; static const struct YamlNode struct_RadioData[] = { - YAML_UNSIGNED( "version", 8 ), + YAML_CUSTOM("semver",nullptr,w_semver), YAML_CUSTOM("board",nullptr,w_board), - YAML_PADDING( 16 ), YAML_ARRAY("calib", 48, 6, struct_CalibData, NULL), YAML_PADDING( 16 ), YAML_SIGNED( "currModel", 8 ), @@ -799,6 +798,7 @@ static const struct YamlNode struct_TelemetryScreenData[] = { YAML_END }; static const struct YamlNode struct_ModelData[] = { + YAML_CUSTOM("semver",nullptr,w_semver), YAML_STRUCT("header", 96, struct_ModelHeader, NULL), YAML_ARRAY("timers", 88, 3, struct_TimerData, NULL), YAML_UNSIGNED( "telemetryProtocol", 3 ), diff --git a/radio/src/storage/yaml/yaml_datastructs_x9d.cpp b/radio/src/storage/yaml/yaml_datastructs_x9d.cpp index 154b6fae2..c246bb654 100644 --- a/radio/src/storage/yaml/yaml_datastructs_x9d.cpp +++ b/radio/src/storage/yaml/yaml_datastructs_x9d.cpp @@ -340,9 +340,8 @@ static const struct YamlNode struct_string_24[] = { YAML_END }; static const struct YamlNode struct_RadioData[] = { - YAML_UNSIGNED( "version", 8 ), + YAML_CUSTOM("semver",nullptr,w_semver), YAML_CUSTOM("board",nullptr,w_board), - YAML_PADDING( 16 ), YAML_ARRAY("calib", 48, 9, struct_CalibData, NULL), YAML_PADDING( 16 ), YAML_SIGNED( "currModel", 8 ), @@ -812,6 +811,7 @@ static const struct YamlNode struct_TelemetryScreenData[] = { YAML_END }; static const struct YamlNode struct_ModelData[] = { + YAML_CUSTOM("semver",nullptr,w_semver), YAML_STRUCT("header", 192, struct_ModelHeader, NULL), YAML_ARRAY("timers", 128, 3, struct_TimerData, NULL), YAML_UNSIGNED( "telemetryProtocol", 3 ), diff --git a/radio/src/storage/yaml/yaml_datastructs_x9e.cpp b/radio/src/storage/yaml/yaml_datastructs_x9e.cpp index 3b61f7f51..0f0a8d5a1 100644 --- a/radio/src/storage/yaml/yaml_datastructs_x9e.cpp +++ b/radio/src/storage/yaml/yaml_datastructs_x9e.cpp @@ -379,9 +379,8 @@ static const struct YamlNode struct_string_24[] = { YAML_END }; static const struct YamlNode struct_RadioData[] = { - YAML_UNSIGNED( "version", 8 ), + YAML_CUSTOM("semver",nullptr,w_semver), YAML_CUSTOM("board",nullptr,w_board), - YAML_PADDING( 16 ), YAML_ARRAY("calib", 48, 12, struct_CalibData, NULL), YAML_PADDING( 16 ), YAML_SIGNED( "currModel", 8 ), @@ -851,6 +850,7 @@ static const struct YamlNode struct_TelemetryScreenData[] = { YAML_END }; static const struct YamlNode struct_ModelData[] = { + YAML_CUSTOM("semver",nullptr,w_semver), YAML_STRUCT("header", 192, struct_ModelHeader, NULL), YAML_ARRAY("timers", 128, 3, struct_TimerData, NULL), YAML_UNSIGNED( "telemetryProtocol", 3 ), diff --git a/radio/src/storage/yaml/yaml_datastructs_x9lite.cpp b/radio/src/storage/yaml/yaml_datastructs_x9lite.cpp index 17513ae76..8388fc4da 100644 --- a/radio/src/storage/yaml/yaml_datastructs_x9lite.cpp +++ b/radio/src/storage/yaml/yaml_datastructs_x9lite.cpp @@ -320,9 +320,8 @@ static const struct YamlNode struct_string_24[] = { YAML_END }; static const struct YamlNode struct_RadioData[] = { - YAML_UNSIGNED( "version", 8 ), + YAML_CUSTOM("semver",nullptr,w_semver), YAML_CUSTOM("board",nullptr,w_board), - YAML_PADDING( 16 ), YAML_ARRAY("calib", 48, 5, struct_CalibData, NULL), YAML_PADDING( 16 ), YAML_SIGNED( "currModel", 8 ), @@ -784,6 +783,7 @@ static const struct YamlNode struct_TelemetryScreenData[] = { YAML_END }; static const struct YamlNode struct_ModelData[] = { + YAML_CUSTOM("semver",nullptr,w_semver), YAML_STRUCT("header", 96, struct_ModelHeader, NULL), YAML_ARRAY("timers", 88, 3, struct_TimerData, NULL), YAML_UNSIGNED( "telemetryProtocol", 3 ), diff --git a/radio/src/storage/yaml/yaml_datastructs_x9lites.cpp b/radio/src/storage/yaml/yaml_datastructs_x9lites.cpp index 63740f7c0..5525f76e2 100644 --- a/radio/src/storage/yaml/yaml_datastructs_x9lites.cpp +++ b/radio/src/storage/yaml/yaml_datastructs_x9lites.cpp @@ -328,9 +328,8 @@ static const struct YamlNode struct_string_24[] = { YAML_END }; static const struct YamlNode struct_RadioData[] = { - YAML_UNSIGNED( "version", 8 ), + YAML_CUSTOM("semver",nullptr,w_semver), YAML_CUSTOM("board",nullptr,w_board), - YAML_PADDING( 16 ), YAML_ARRAY("calib", 48, 5, struct_CalibData, NULL), YAML_PADDING( 16 ), YAML_SIGNED( "currModel", 8 ), @@ -794,6 +793,7 @@ static const struct YamlNode struct_TelemetryScreenData[] = { YAML_END }; static const struct YamlNode struct_ModelData[] = { + YAML_CUSTOM("semver",nullptr,w_semver), YAML_STRUCT("header", 96, struct_ModelHeader, NULL), YAML_ARRAY("timers", 88, 3, struct_TimerData, NULL), YAML_UNSIGNED( "telemetryProtocol", 3 ), diff --git a/radio/src/storage/yaml/yaml_datastructs_xlite.cpp b/radio/src/storage/yaml/yaml_datastructs_xlite.cpp index 50ab1f38a..43a739635 100644 --- a/radio/src/storage/yaml/yaml_datastructs_xlite.cpp +++ b/radio/src/storage/yaml/yaml_datastructs_xlite.cpp @@ -325,9 +325,8 @@ static const struct YamlNode struct_string_24[] = { YAML_END }; static const struct YamlNode struct_RadioData[] = { - YAML_UNSIGNED( "version", 8 ), + YAML_CUSTOM("semver",nullptr,w_semver), YAML_CUSTOM("board",nullptr,w_board), - YAML_PADDING( 16 ), YAML_ARRAY("calib", 48, 6, struct_CalibData, NULL), YAML_PADDING( 16 ), YAML_SIGNED( "currModel", 8 ), @@ -791,6 +790,7 @@ static const struct YamlNode struct_TelemetryScreenData[] = { YAML_END }; static const struct YamlNode struct_ModelData[] = { + YAML_CUSTOM("semver",nullptr,w_semver), YAML_STRUCT("header", 96, struct_ModelHeader, NULL), YAML_ARRAY("timers", 88, 3, struct_TimerData, NULL), YAML_UNSIGNED( "telemetryProtocol", 3 ), diff --git a/radio/src/storage/yaml/yaml_datastructs_xlites.cpp b/radio/src/storage/yaml/yaml_datastructs_xlites.cpp index 5d4037bdd..83806d6be 100644 --- a/radio/src/storage/yaml/yaml_datastructs_xlites.cpp +++ b/radio/src/storage/yaml/yaml_datastructs_xlites.cpp @@ -327,9 +327,8 @@ static const struct YamlNode struct_string_24[] = { YAML_END }; static const struct YamlNode struct_RadioData[] = { - YAML_UNSIGNED( "version", 8 ), + YAML_CUSTOM("semver",nullptr,w_semver), YAML_CUSTOM("board",nullptr,w_board), - YAML_PADDING( 16 ), YAML_ARRAY("calib", 48, 6, struct_CalibData, NULL), YAML_PADDING( 16 ), YAML_SIGNED( "currModel", 8 ), @@ -795,6 +794,7 @@ static const struct YamlNode struct_TelemetryScreenData[] = { YAML_END }; static const struct YamlNode struct_ModelData[] = { + YAML_CUSTOM("semver",nullptr,w_semver), YAML_STRUCT("header", 96, struct_ModelHeader, NULL), YAML_ARRAY("timers", 88, 3, struct_TimerData, NULL), YAML_UNSIGNED( "telemetryProtocol", 3 ), diff --git a/radio/src/storage/yaml/yaml_datastructs_zorro.cpp b/radio/src/storage/yaml/yaml_datastructs_zorro.cpp index 3f72c9327..22bf075d3 100644 --- a/radio/src/storage/yaml/yaml_datastructs_zorro.cpp +++ b/radio/src/storage/yaml/yaml_datastructs_zorro.cpp @@ -333,9 +333,8 @@ static const struct YamlNode struct_string_24[] = { YAML_END }; static const struct YamlNode struct_RadioData[] = { - YAML_UNSIGNED( "version", 8 ), + YAML_CUSTOM("semver",nullptr,w_semver), YAML_CUSTOM("board",nullptr,w_board), - YAML_PADDING( 16 ), YAML_ARRAY("calib", 48, 6, struct_CalibData, NULL), YAML_PADDING( 16 ), YAML_SIGNED( "currModel", 8 ), @@ -799,6 +798,7 @@ static const struct YamlNode struct_TelemetryScreenData[] = { YAML_END }; static const struct YamlNode struct_ModelData[] = { + YAML_CUSTOM("semver",nullptr,w_semver), YAML_STRUCT("header", 96, struct_ModelHeader, NULL), YAML_ARRAY("timers", 88, 3, struct_TimerData, NULL), YAML_UNSIGNED( "telemetryProtocol", 3 ), diff --git a/radio/src/tests/conversions.cpp b/radio/src/tests/conversions.cpp index 8bcb1d263..0e74e88f5 100644 --- a/radio/src/tests/conversions.cpp +++ b/radio/src/tests/conversions.cpp @@ -310,8 +310,6 @@ TEST(Conversions, ConversionX10From23) convertBinModelData(modelname, 219); loadModel(modelname); - EXPECT_EQ(221, g_eeGeneral.version); - EXPECT_EQ(100, g_eeGeneral.calib[CALIBRATED_SLIDER_REAR_LEFT].spanNeg); EXPECT_EQ(500, g_eeGeneral.calib[CALIBRATED_SLIDER_REAR_LEFT].mid); EXPECT_EQ(900, g_eeGeneral.calib[CALIBRATED_SLIDER_REAR_LEFT].spanPos); @@ -384,7 +382,6 @@ TEST(Conversions, ConversionX12SFrom23) convertBinModelData(modelname, 219); loadModel(modelname); - EXPECT_EQ(221, g_eeGeneral.version); EXPECT_EQ(-30, g_eeGeneral.vBatMin); EXPECT_EQ(8, g_eeGeneral.speakerVolume); EXPECT_STRNEQ("en", g_eeGeneral.ttsLanguage); @@ -449,7 +446,6 @@ TEST(Conversions, ConversionTX16SFrom25) convertBinModelData(modelname, 220); loadModel(modelname); - EXPECT_EQ(221, g_eeGeneral.version); EXPECT_EQ(-23, g_eeGeneral.vBatMin); EXPECT_EQ(0, g_eeGeneral.speakerVolume); EXPECT_STRNEQ("en", g_eeGeneral.ttsLanguage);