feat: Reduce risk of corrupt radio.yml (#1481)
* reduce risk of corrupt radio.yml #1412 Adds CRC16 checksum to radio.yml when saved. Adds save to temporary file, folowed by rename to radio.yml Adds check on load, with fall-back to temporary file * Made sure that only the first read block of radio.yml is checked for the 'checksum' value. Added checksum generation on radio.yml produced by conversion. * Added namespace. Github actions triggered build failed on this - compiler difference. * Fixed typo in code not run locally. * Made checksum result code a enum class. Fixed null-poionter dereference bug. * Added check and handling for radio.yml file not read (will be handled as if checksum failed) Added evaluation of checksum when radio_new.yml is read. Added f_unlink() calls before f_rename() to ensure the target filename does not exist. * Added radio.yml cheksum handling to Simulator/Companion. Cleaned radio firmware handling of checksum field up to be newline agnostic. * Added handling of files without checksum. - Letting files pass the check if no checksum field is present (old files) and the size is realistic (25 bytes) * Fixed bug causing new conversion from binary if no radio.yml BUT a radio_new.yaml is present in the filesystem. Now the conversion is only performed if neither file exsits. * repair rebase problems * rerun yaml generator * fix another rebase problem * update text in companion to be more meaningful when the radio.yml file has a checksum error fix wrong error message in trace * add trigger to check radio config when leavin menu_radio * fix: add handling for temporary and error yaml radio settings files to simu/simulator/libsimulator * fix corner cases when comverting non crc-ed files * chore: Tweak radio data warnings for screen sizes - Changed the define to be a little shorter - Added missing define for TW - Three string lengths to suit 128, 212 and basically colorlcd Co-authored-by: gagarinlg <malte@langermann.net> Co-authored-by: Peter Feerick <peter.feerick@gmail.com>
This commit is contained in:
co-authored by
gagarinlg
Peter Feerick
parent
e6697bca89
commit
e576925bee
+10
-10
@@ -105,7 +105,7 @@ static inline void check_struct()
|
||||
CHKSIZE(TimerData, 3);
|
||||
|
||||
CHKSIZE(FlightModeData, 30);
|
||||
CHKSIZE(RadioData, 85);
|
||||
CHKSIZE(RadioData, 86);
|
||||
|
||||
#endif /* board specific ifdefs*/
|
||||
|
||||
@@ -117,33 +117,33 @@ static inline void check_struct()
|
||||
CHKSIZE(TrainerData, 16);
|
||||
|
||||
#if defined(PCBXLITES)
|
||||
CHKSIZE(RadioData, 861);
|
||||
CHKSIZE(RadioData, 862);
|
||||
CHKSIZE(ModelData, 6164);
|
||||
#elif defined(PCBXLITE)
|
||||
CHKSIZE(RadioData, 859);
|
||||
CHKSIZE(RadioData, 860);
|
||||
CHKSIZE(ModelData, 6164);
|
||||
#elif defined(RADIO_TPRO)
|
||||
CHKSIZE(RadioData, 842);
|
||||
CHKSIZE(RadioData, 843);
|
||||
CHKSIZE(ModelData, 6189);
|
||||
#elif defined(PCBX7)
|
||||
CHKSIZE(RadioData, 865);
|
||||
CHKSIZE(RadioData, 866);
|
||||
CHKSIZE(ModelData, 6164);
|
||||
#elif defined(PCBX9E)
|
||||
CHKSIZE(RadioData, 955);
|
||||
CHKSIZE(RadioData, 956);
|
||||
CHKSIZE(ModelData, 6616);
|
||||
#elif defined(PCBX9D) || defined(PCBX9DP)
|
||||
CHKSIZE(RadioData, 897);
|
||||
CHKSIZE(RadioData, 898);
|
||||
CHKSIZE(ModelData, 6608);
|
||||
#elif defined(PCBHORUS)
|
||||
#if defined(PCBX10)
|
||||
CHKSIZE(RadioData, 923);
|
||||
CHKSIZE(RadioData, 924);
|
||||
CHKSIZE(ModelData, 11028);
|
||||
#else
|
||||
CHKSIZE(RadioData, 905);
|
||||
CHKSIZE(RadioData, 906);
|
||||
CHKSIZE(ModelData, 11026);
|
||||
#endif
|
||||
#elif defined(PCBNV14)
|
||||
CHKSIZE(RadioData, 851);
|
||||
CHKSIZE(RadioData, 852);
|
||||
CHKSIZE(ModelData, 10842);
|
||||
#endif
|
||||
|
||||
|
||||
Reference in New Issue
Block a user