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:
Stephen Mose Aaskov
2022-08-31 12:56:17 +10:00
committed by GitHub
co-authored by gagarinlg Peter Feerick
parent e6697bca89
commit e576925bee
47 changed files with 594 additions and 43 deletions
+10 -10
View File
@@ -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
+2
View File
@@ -804,6 +804,8 @@ PACK(struct TrainerData {
PACK(struct RadioData {
// Real attributes
NOBACKUP(uint8_t manuallyEdited:1);
NOBACKUP(int8_t spare0:7 SKIP);
CUST_ATTR(semver,nullptr,w_semver);
CUST_ATTR(board,nullptr,w_board);
CalibData calib[NUM_STICKS + STORAGE_NUM_POTS + STORAGE_NUM_SLIDERS + STORAGE_NUM_MOUSE_ANALOGS] NO_IDX;
+5
View File
@@ -44,3 +44,8 @@ RadioMenu::RadioMenu():
addTab(new RadioHardwarePage());
addTab(new RadioVersionPage());
}
RadioMenu::~RadioMenu()
{
storageCheck(true);
}
+1
View File
@@ -27,6 +27,7 @@
class RadioMenu: public TabsGroup {
public:
RadioMenu();
~RadioMenu();
};
#endif // _MENU_RADIO_H_
+4
View File
@@ -68,6 +68,10 @@ const char RADIO_SETTINGS_PATH[] = RADIO_PATH PATH_SEPARATOR RADIO_FILENAME;
const char MODELSLIST_YAML_PATH[] = MODELS_PATH PATH_SEPARATOR "models.yml";
const char FALLBACK_MODELSLIST_YAML_PATH[] = RADIO_PATH PATH_SEPARATOR "models.yml";
const char RADIO_SETTINGS_YAML_PATH[] = RADIO_PATH PATH_SEPARATOR "radio.yml";
const char RADIO_SETTINGS_TMPFILE_YAML_PATH[] = RADIO_PATH PATH_SEPARATOR "radio_new.yml";
const char RADIO_SETTINGS_ERRORFILE_YAML_PATH[] = RADIO_PATH PATH_SEPARATOR "radio_error.yml";
const char YAMLFILE_CHECKSUM_TAG_NAME[] = "checksum";
#endif
#define SPLASH_FILE "splash.png"
#endif
@@ -58,6 +58,7 @@ static const char* convertData_220_to_221(
memset(data, 0, size);
uint8_t version;
const char* error = loadFileBin(path, data, size, &version);
if (!error) {
if (patchBinary) patchBinary(data);
@@ -65,9 +66,11 @@ static const char* convertData_220_to_221(
char output_fname[FF_MAX_LFN+1];
strncpy(output_fname, path, FF_MAX_LFN);
output_fname[FF_MAX_LFN] = '\0';
uint16_t file_checksum = 0;
YamlFileChecksum(root_node, data, &file_checksum);
patchFilenameToYaml(output_fname);
error = writeFileYaml(output_fname, root_node, data);
error = writeFileYaml(output_fname, root_node, data, file_checksum);
}
free(data);
@@ -157,7 +160,7 @@ const char* convertModelData_220_to_221(uint8_t id)
char model_idx[MODELIDX_STRLEN + sizeof(YAML_EXT)];
getModelNumberStr(id, model_idx);
GET_FILENAME(path, MODELS_PATH, model_idx, YAML_EXT);
error = writeFileYaml(path, yaml_conv_220::get_modeldata_nodes(), data);
error = writeFileYaml(path, yaml_conv_220::get_modeldata_nodes(), data, 0);
} else {
// ERROR: size mismatch !!!
}
@@ -174,9 +177,13 @@ const char* convertRadioData_220_to_221()
const char* error = nullptr;
uint16_t read = eeLoadGeneralSettingsData(data, size);
uint16_t file_checksum = 0;
YamlFileChecksum(yaml_conv_220::get_radiodata_nodes(), data, &file_checksum);
if (read == size) {
error = writeFileYaml(RADIO_SETTINGS_YAML_PATH,
yaml_conv_220::get_radiodata_nodes(), data);
yaml_conv_220::get_radiodata_nodes(), data, file_checksum);
} else {
// ERROR: size mismatch !!!
}
+1 -1
View File
@@ -53,7 +53,7 @@ const char *loadFileBin(const char *fullpath, uint8_t *data,
// writes a complete YAML file
struct YamlNode;
const char* writeFileYaml(const char* path, const YamlNode* root_node, uint8_t* data);
const char* writeFileYaml(const char* path, const YamlNode* root_node, uint8_t* data, uint16_t checksum);
void getModelPath(char * path, const char * filename, const char* pathName = STR_MODELS_PATH);
+183 -24
View File
@@ -30,6 +30,8 @@
#include "yaml/yaml_tree_walker.h"
#include "yaml/yaml_parser.h"
#include "yaml/yaml_datastructs.h"
#include "yaml/yaml_bits.h"
#if defined(EEPROM_RLC)
#include "storage/eeprom_common.h"
@@ -38,32 +40,85 @@
#include "storage/conversions/conversions.h"
const char * readYamlFile(const char* fullpath, const YamlParserCalls* calls, void* parser_ctx)
const char * readYamlFile(const char* fullpath, const YamlParserCalls* calls, void* parser_ctx, ChecksumResult* checksum_result)
{
FIL file;
UINT bytes_read;
UINT total_bytes = 0;
FRESULT result = f_open(&file, fullpath, FA_OPEN_EXISTING | FA_READ);
if (result != FR_OK) {
return SDCARD_ERROR(result);
}
YamlParser yp; //TODO: move to re-usable buffer
yp.init(calls, parser_ctx);
char buffer[32];
while (f_read(&file, buffer, sizeof(buffer), &bytes_read) == FR_OK) {
uint16_t calculated_checksum = 0xFFFF;
uint16_t file_checksum = 0;
// reached EOF?
if (bytes_read == 0)
bool first_block = true;
char buffer[32];
while (f_read(&file, buffer, sizeof(buffer)-1, &bytes_read) == FR_OK) {
if (bytes_read == 0) // EOF
break;
total_bytes += bytes_read;
uint16_t skip = 0;
if(first_block) {
// Get the 'checksum' value and skip from further YAML processing
// The checksum must be first in the first buffer read from file
first_block = false;
const char *skipValue = "checksum: ";
if(strncmp(buffer, skipValue, strlen(skipValue)) == 0) {
skip = 10;
char* startPos = buffer + strlen(skipValue);
char* endPos = startPos;
// Advance through the value
while((*endPos != '\r') && (*endPos != '\n')) {
if (endPos > buffer + bytes_read) {
return SDCARD_ERROR( FR_INT_ERR );
}
endPos++;
}
// Skip trailing newline
while((*endPos == '\r') || (*endPos == '\n')) {
*endPos = 0;
endPos++;
}
file_checksum = atoi(startPos);
skip = endPos - buffer;
}
}
// Calculate checksum on read block only if we are called with a pointer to write the resulting checksum
if (checksum_result != NULL) {
calculated_checksum = crc16(0, (const uint8_t *)buffer + skip, bytes_read - skip, calculated_checksum);
}
if (f_eof(&file)) yp.set_eof();
if (yp.parse(buffer, bytes_read) != YamlParser::CONTINUE_PARSING)
if (yp.parse(buffer + skip, bytes_read - skip) != YamlParser::CONTINUE_PARSING)
break;
}
f_close(&file);
if (checksum_result != NULL) {
// Special case to handle "old" files with no checksum field
// 25 was arbitrarily chosen as the minimum realistic file size
// - The issue is to allow old files to pass, while still detecting garbled files
if ( (file_checksum == 0) && (total_bytes > 25) ) {
*checksum_result = ChecksumResult::Success;
} else {
// Normal case - compare read and calculated checksum
if (calculated_checksum == file_checksum) {
*checksum_result = ChecksumResult::Success;
} else {
*checksum_result = ChecksumResult::Failed;
}
}
}
return NULL;
}
@@ -92,21 +147,57 @@ void storageCreateModelsList()
// SDCARD storage interface
//
static const char * attemptLoad(const char *filename, ChecksumResult* checksum_status)
{
YamlTreeWalker tree;
tree.reset(get_radiodata_nodes(), (uint8_t*)&g_eeGeneral);
return readYamlFile(filename, YamlTreeWalker::get_parser_calls(), &tree, checksum_status);
}
const char * loadRadioSettingsYaml()
{
// YAML reader
TRACE("YAML radio settings reader");
YamlTreeWalker tree;
tree.reset(get_radiodata_nodes(), (uint8_t*)&g_eeGeneral);
ChecksumResult checksum_status;
const char* p = attemptLoad(RADIO_SETTINGS_YAML_PATH, &checksum_status);
return readYamlFile(RADIO_SETTINGS_YAML_PATH, YamlTreeWalker::get_parser_calls(), &tree);
if((p != NULL) || (checksum_status != ChecksumResult::Success) ) {
// Read failed or checksum check failed
FRESULT result = FR_OK;
TRACE("radio settings: Reading failed");
if ( (p == NULL) && g_eeGeneral.manuallyEdited) {
// Read sussessfull, checksum failed, manuallyEdited set
TRACE("File has been manually edited - ignoring checksum mismatch");
g_eeGeneral.manuallyEdited = 0;
storageDirty(EE_GENERAL); // Trigger a save on sucessfull recovery
} else {
TRACE("File is corrupted, attempting alternative file");
f_unlink(RADIO_SETTINGS_ERRORFILE_YAML_PATH);
result = f_rename(RADIO_SETTINGS_YAML_PATH, RADIO_SETTINGS_ERRORFILE_YAML_PATH); // Save corrupted file for later analysis
p = attemptLoad(RADIO_SETTINGS_TMPFILE_YAML_PATH, &checksum_status);
if (p == NULL && (checksum_status == ChecksumResult::Success)) {
f_unlink(RADIO_SETTINGS_YAML_PATH);
result = f_rename(RADIO_SETTINGS_TMPFILE_YAML_PATH, RADIO_SETTINGS_YAML_PATH); // Rename previously saved file to active file
if (result != FR_OK) {
ALERT(STR_STORAGE_WARNING, TR_RADIO_DATA_UNRECOVERABLE, AU_BAD_RADIODATA);
return SDCARD_ERROR(result);
}
}
TRACE("Unable to recover radio data");
ALERT(STR_STORAGE_WARNING, p == NULL ? TR_RADIO_DATA_RECOVERED : TR_RADIO_DATA_UNRECOVERABLE, AU_BAD_RADIODATA);
}
}
return p;
}
const char * loadRadioSettings()
{
FILINFO fno;
if (f_stat(RADIO_SETTINGS_YAML_PATH, &fno) != FR_OK) {
if ( (f_stat(RADIO_SETTINGS_YAML_PATH, &fno) != FR_OK) && ((f_stat(RADIO_SETTINGS_TMPFILE_YAML_PATH, &fno) != FR_OK)) ) {
// If neither the radio configuraion YAML file or the temporary file generated on write exist, this must be a first run with YAML support.
// - thus requiring a conversion from binary to YAML.
#if STORAGE_CONVERSIONS < 221
#if defined(STORAGE_MODELSLIST)
uint8_t version;
@@ -142,6 +233,47 @@ const char * loadRadioSettings()
return error;
}
struct yaml_checksummer_ctx {
FRESULT result;
uint16_t checksum;
bool checksum_invalid;
};
static bool yaml_checksummer(void* opaque, const char* str, size_t len)
{
yaml_checksummer_ctx* ctx = (yaml_checksummer_ctx*)opaque;
ctx->checksum = crc16(0, (const uint8_t *) str, len, ctx->checksum);
return true;
}
bool YamlFileChecksum(const YamlNode* root_node, uint8_t* data, uint16_t* checksum)
{
YamlTreeWalker tree;
tree.reset(root_node, data);
yaml_checksummer_ctx ctx;
ctx.result = FR_OK;
ctx.checksum = 0xFFFF;
ctx.checksum_invalid = false;
if (!tree.generate(yaml_checksummer, &ctx)) {
if (ctx.result != FR_OK) {
ctx.checksum_invalid = true;
return false;
}
}
if(checksum != NULL) {
*checksum = ctx.checksum;
}
return true;
}
struct yaml_writer_ctx {
FIL* file;
FRESULT result;
@@ -160,7 +292,7 @@ static bool yaml_writer(void* opaque, const char* str, size_t len)
return (ctx->result == FR_OK) && (bytes_written == len);
}
const char* writeFileYaml(const char* path, const YamlNode* root_node, uint8_t* data)
const char* writeFileYaml(const char* path, const YamlNode* root_node, uint8_t* data, uint16_t checksum)
{
FIL file;
@@ -168,14 +300,24 @@ const char* writeFileYaml(const char* path, const YamlNode* root_node, uint8_t*
if (result != FR_OK) {
return SDCARD_ERROR(result);
}
YamlTreeWalker tree;
tree.reset(root_node, data);
yaml_writer_ctx ctx;
ctx.file = &file;
ctx.result = FR_OK;
// Try to add CRC
if (checksum != 0) {
if (!yaml_writer(&ctx, YAMLFILE_CHECKSUM_TAG_NAME, strlen(YAMLFILE_CHECKSUM_TAG_NAME))) return NULL;
if (!yaml_writer(&ctx, ": ", 2)) return SDCARD_ERROR(FR_INVALID_PARAMETER);
const char* p_out = NULL;
p_out = yaml_unsigned2str((int)checksum);
if (p_out && !yaml_writer(&ctx, p_out, strlen(p_out))) return SDCARD_ERROR(FR_INVALID_PARAMETER);
yaml_writer(&ctx, "\r\n", 2);
}
if (!tree.generate(yaml_writer, &ctx)) {
if (ctx.result != FR_OK) {
f_close(&file);
@@ -190,8 +332,25 @@ const char* writeFileYaml(const char* path, const YamlNode* root_node, uint8_t*
const char * writeGeneralSettings()
{
TRACE("YAML radio settings writer");
return writeFileYaml(RADIO_SETTINGS_YAML_PATH, get_radiodata_nodes(),
(uint8_t*)&g_eeGeneral);
uint16_t file_checksum = 0;
YamlFileChecksum(get_radiodata_nodes(), (uint8_t*)&g_eeGeneral, &file_checksum);
g_eeGeneral.manuallyEdited = false;
const char *p = writeFileYaml(RADIO_SETTINGS_TMPFILE_YAML_PATH, get_radiodata_nodes(),
(uint8_t*)&g_eeGeneral, file_checksum);
TRACE("generalSettings written with checksum %u", file_checksum);
if (p != NULL) {
return p;
}
f_unlink(RADIO_SETTINGS_YAML_PATH);
FRESULT result = f_rename(RADIO_SETTINGS_TMPFILE_YAML_PATH, RADIO_SETTINGS_YAML_PATH);
if(result != FR_OK)
return SDCARD_ERROR(result);
return nullptr;
}
@@ -213,7 +372,7 @@ const char * readModelYaml(const char * filename, uint8_t * buffer, uint32_t siz
TRACE("cannot find YAML data nodes for object size (size=%d)", size);
return "YAML size error";
}
char path[256];
getModelPath(path, filename, pathName);
@@ -241,7 +400,7 @@ const char * readModelYaml(const char * filename, uint8_t * buffer, uint32_t siz
// md->swashR.elevatorWeight = 100;
}
return readYamlFile(path, YamlTreeWalker::get_parser_calls(), &tree);
return readYamlFile(path, YamlTreeWalker::get_parser_calls(), &tree, NULL);
}
static const char _wrongExtentionError[] = "wrong file extension";
@@ -261,7 +420,7 @@ const char * writeModelYaml(const char* filename)
TRACE("YAML model writer");
char path[256];
getModelPath(path, filename);
return writeFileYaml(path, get_modeldata_nodes(), (uint8_t*)&g_model);
return writeFileYaml(path, get_modeldata_nodes(), (uint8_t*)&g_model,0 );
}
#if !defined(STORAGE_MODELSLIST)
@@ -329,7 +488,7 @@ bool copyModel(uint8_t dst, uint8_t src)
char model_idx_dst[MODELIDX_STRLEN];
getModelNumberStr(src, model_idx_src);
getModelNumberStr(dst, model_idx_dst);
GET_FILENAME(fname_src, MODELS_PATH, model_idx_src, YAML_EXT);
GET_FILENAME(fname_dst, MODELS_PATH, model_idx_dst, YAML_EXT);
@@ -350,7 +509,7 @@ void swapModels(uint8_t id1, uint8_t id2)
char model_idx_2[MODELIDX_STRLEN];
getModelNumberStr(id1, model_idx_1);
getModelNumberStr(id2, model_idx_2);
GET_FILENAME(fname1, MODELS_PATH, model_idx_1, YAML_EXT);
GET_FILENAME(fname1_tmp, MODELS_PATH, model_idx_1, ".tmp");
GET_FILENAME(fname2, MODELS_PATH, model_idx_2, YAML_EXT);
@@ -451,7 +610,7 @@ const char * backupModel(uint8_t idx)
char model_idx[MODELIDX_STRLEN + sizeof(YAML_EXT)];
getModelNumberStr(idx, model_idx);
strcat(model_idx, STR_YAML_EXT);
return sdCopyFile(model_idx, STR_MODELS_PATH, buf, STR_BACKUP_PATH);
}
+5
View File
@@ -20,9 +20,14 @@
*/
#pragma once
enum class ChecksumResult {Success, Failed, None};
constexpr uint8_t MODELIDX_STRLEN = sizeof(MODEL_FILENAME_PREFIX "00");
const char * loadRadioSettingsYaml();
const char * writeModelYaml(const char* filename);
const char * readModelYaml(const char * filename, uint8_t * buffer, uint32_t size, const char* pathName = STR_MODELS_PATH);
bool YamlFileChecksum(const YamlNode* root_node, uint8_t* data, uint16_t* checksum);
void getModelNumberStr(uint8_t idx, char* model_idx);
@@ -355,6 +355,8 @@ static const struct YamlNode struct_OpenTxTheme__PersistentData[] = {
YAML_END
};
static const struct YamlNode struct_RadioData[] = {
YAML_UNSIGNED( "manuallyEdited", 1 ),
YAML_PADDING( 7 ),
YAML_CUSTOM("semver",nullptr,w_semver),
YAML_CUSTOM("board",nullptr,w_board),
YAML_ARRAY("calib", 48, 9, struct_CalibData, NULL),
@@ -326,6 +326,8 @@ static const struct YamlNode struct_string_24[] = {
YAML_END
};
static const struct YamlNode struct_RadioData[] = {
YAML_UNSIGNED( "manuallyEdited", 1 ),
YAML_PADDING( 7 ),
YAML_CUSTOM("semver",nullptr,w_semver),
YAML_CUSTOM("board",nullptr,w_board),
YAML_ARRAY("calib", 48, 6, struct_CalibData, NULL),
@@ -326,6 +326,8 @@ static const struct YamlNode struct_string_24[] = {
YAML_END
};
static const struct YamlNode struct_RadioData[] = {
YAML_UNSIGNED( "manuallyEdited", 1 ),
YAML_PADDING( 7 ),
YAML_CUSTOM("semver",nullptr,w_semver),
YAML_CUSTOM("board",nullptr,w_board),
YAML_ARRAY("calib", 48, 6, struct_CalibData, NULL),
@@ -326,6 +326,8 @@ static const struct YamlNode struct_string_24[] = {
YAML_END
};
static const struct YamlNode struct_RadioData[] = {
YAML_UNSIGNED( "manuallyEdited", 1 ),
YAML_PADDING( 7 ),
YAML_CUSTOM("semver",nullptr,w_semver),
YAML_CUSTOM("board",nullptr,w_board),
YAML_ARRAY("calib", 48, 6, struct_CalibData, NULL),
@@ -334,6 +334,8 @@ static const struct YamlNode struct_string_24[] = {
YAML_END
};
static const struct YamlNode struct_RadioData[] = {
YAML_UNSIGNED( "manuallyEdited", 1 ),
YAML_PADDING( 7 ),
YAML_CUSTOM("semver",nullptr,w_semver),
YAML_CUSTOM("board",nullptr,w_board),
YAML_ARRAY("calib", 48, 6, struct_CalibData, NULL),
@@ -326,6 +326,8 @@ static const struct YamlNode struct_string_24[] = {
YAML_END
};
static const struct YamlNode struct_RadioData[] = {
YAML_UNSIGNED( "manuallyEdited", 1 ),
YAML_PADDING( 7 ),
YAML_CUSTOM("semver",nullptr,w_semver),
YAML_CUSTOM("board",nullptr,w_board),
YAML_ARRAY("calib", 48, 6, struct_CalibData, NULL),
@@ -326,6 +326,8 @@ static const struct YamlNode struct_string_24[] = {
YAML_END
};
static const struct YamlNode struct_RadioData[] = {
YAML_UNSIGNED( "manuallyEdited", 1 ),
YAML_PADDING( 7 ),
YAML_CUSTOM("semver",nullptr,w_semver),
YAML_CUSTOM("board",nullptr,w_board),
YAML_ARRAY("calib", 48, 6, struct_CalibData, NULL),
@@ -380,6 +380,8 @@ static const struct YamlNode struct_OpenTxTheme__PersistentData[] = {
YAML_END
};
static const struct YamlNode struct_RadioData[] = {
YAML_UNSIGNED( "manuallyEdited", 1 ),
YAML_PADDING( 7 ),
YAML_CUSTOM("semver",nullptr,w_semver),
YAML_CUSTOM("board",nullptr,w_board),
YAML_ARRAY("calib", 48, 17, struct_CalibData, NULL),
@@ -378,6 +378,8 @@ static const struct YamlNode struct_OpenTxTheme__PersistentData[] = {
YAML_END
};
static const struct YamlNode struct_RadioData[] = {
YAML_UNSIGNED( "manuallyEdited", 1 ),
YAML_PADDING( 7 ),
YAML_CUSTOM("semver",nullptr,w_semver),
YAML_CUSTOM("board",nullptr,w_board),
YAML_ARRAY("calib", 48, 15, struct_CalibData, NULL),
@@ -326,6 +326,8 @@ static const struct YamlNode struct_string_24[] = {
YAML_END
};
static const struct YamlNode struct_RadioData[] = {
YAML_UNSIGNED( "manuallyEdited", 1 ),
YAML_PADDING( 7 ),
YAML_CUSTOM("semver",nullptr,w_semver),
YAML_CUSTOM("board",nullptr,w_board),
YAML_ARRAY("calib", 48, 6, struct_CalibData, NULL),
@@ -333,6 +333,8 @@ static const struct YamlNode struct_string_24[] = {
YAML_END
};
static const struct YamlNode struct_RadioData[] = {
YAML_UNSIGNED( "manuallyEdited", 1 ),
YAML_PADDING( 7 ),
YAML_CUSTOM("semver",nullptr,w_semver),
YAML_CUSTOM("board",nullptr,w_board),
YAML_ARRAY("calib", 48, 9, struct_CalibData, NULL),
@@ -372,6 +372,8 @@ static const struct YamlNode struct_string_24[] = {
YAML_END
};
static const struct YamlNode struct_RadioData[] = {
YAML_UNSIGNED( "manuallyEdited", 1 ),
YAML_PADDING( 7 ),
YAML_CUSTOM("semver",nullptr,w_semver),
YAML_CUSTOM("board",nullptr,w_board),
YAML_ARRAY("calib", 48, 12, struct_CalibData, NULL),
@@ -313,6 +313,8 @@ static const struct YamlNode struct_string_24[] = {
YAML_END
};
static const struct YamlNode struct_RadioData[] = {
YAML_UNSIGNED( "manuallyEdited", 1 ),
YAML_PADDING( 7 ),
YAML_CUSTOM("semver",nullptr,w_semver),
YAML_CUSTOM("board",nullptr,w_board),
YAML_ARRAY("calib", 48, 5, struct_CalibData, NULL),
@@ -321,6 +321,8 @@ static const struct YamlNode struct_string_24[] = {
YAML_END
};
static const struct YamlNode struct_RadioData[] = {
YAML_UNSIGNED( "manuallyEdited", 1 ),
YAML_PADDING( 7 ),
YAML_CUSTOM("semver",nullptr,w_semver),
YAML_CUSTOM("board",nullptr,w_board),
YAML_ARRAY("calib", 48, 5, struct_CalibData, NULL),
@@ -318,6 +318,8 @@ static const struct YamlNode struct_string_24[] = {
YAML_END
};
static const struct YamlNode struct_RadioData[] = {
YAML_UNSIGNED( "manuallyEdited", 1 ),
YAML_PADDING( 7 ),
YAML_CUSTOM("semver",nullptr,w_semver),
YAML_CUSTOM("board",nullptr,w_board),
YAML_ARRAY("calib", 48, 6, struct_CalibData, NULL),
@@ -320,6 +320,8 @@ static const struct YamlNode struct_string_24[] = {
YAML_END
};
static const struct YamlNode struct_RadioData[] = {
YAML_UNSIGNED( "manuallyEdited", 1 ),
YAML_PADDING( 7 ),
YAML_CUSTOM("semver",nullptr,w_semver),
YAML_CUSTOM("board",nullptr,w_board),
YAML_ARRAY("calib", 48, 6, struct_CalibData, NULL),
@@ -326,6 +326,8 @@ static const struct YamlNode struct_string_24[] = {
YAML_END
};
static const struct YamlNode struct_RadioData[] = {
YAML_UNSIGNED( "manuallyEdited", 1 ),
YAML_PADDING( 7 ),
YAML_CUSTOM("semver",nullptr,w_semver),
YAML_CUSTOM("board",nullptr,w_board),
YAML_ARRAY("calib", 48, 6, struct_CalibData, NULL),
+1 -1
View File
@@ -134,7 +134,7 @@ bool redirectToSettingsDirectory(const std::string & path)
#endif
#endif
#if defined(SDCARD_YAML)
if (path == MODELSLIST_YAML_PATH || path == RADIO_SETTINGS_YAML_PATH)
if (path == MODELSLIST_YAML_PATH || path == RADIO_SETTINGS_YAML_PATH || path == RADIO_SETTINGS_TMPFILE_YAML_PATH || path == RADIO_SETTINGS_ERRORFILE_YAML_PATH)
return true;
if (startsWith(path, MODELS_PATH) && endsWith(path, YAML_EXT)) return true;
#endif
+2
View File
@@ -859,6 +859,8 @@ const char STR_STORAGE_WARNING[] = TR_STORAGE_WARNING;
const char STR_STORAGE_FORMAT[] = TR_STORAGE_FORMAT;
const char STR_SDCARD_CONVERSION_REQUIRE[] = TR_SDCARD_CONVERSION_REQUIRE;
const char STR_CONVERTING[] = TR_CONVERTING;
const char STR_RADIO_DATA_UNRECOVERABLE[] = TR_RADIO_DATA_UNRECOVERABLE;
const char STR_RADIO_DATA_RECOVERED[] = TR_RADIO_DATA_RECOVERED;
#endif
const char STR_EEPROMOVERFLOW[] = TR_EEPROMOVERFLOW;
const char STR_EEPROM_CONVERTING[] = TR_EEPROM_CONVERTING;
+2
View File
@@ -403,6 +403,8 @@ extern const char STR_THROTTLE_NOT_IDLE[];
extern const char STR_ALARMSDISABLED[];
extern const char STR_PRESSANYKEY[];
extern const char STR_BAD_RADIO_DATA[];
extern const char STR_RADIO_DATA_UNRECOVERABLE[];
extern const char STR_RADIO_DATA_RECOVERED[];
extern const char STR_STORAGE_FORMAT[];
extern const char STR_EEPROMOVERFLOW[];
extern const char STR_TRIMS2OFFSETS[];
+2
View File
@@ -517,6 +517,8 @@
#define TR_PRESSANYKEY TR("\010按任意键", "按任意键")
#define TR_BADEEPROMDATA "存储数据错误"
#define TR_BAD_RADIO_DATA "系统数据错误"
#define TR_RADIO_DATA_RECOVERED TR3("Using backup radio data","Using backup radio settings","Radio settings recovered from backup")
#define TR_RADIO_DATA_UNRECOVERABLE TR3("Radio settings invalid","Radio settings not valid", "Unable to read valid radio settings")
#define TR_EEPROMFORMATTING "格式化存储"
#define TR_STORAGE_FORMAT "存储准备"
#define TR_EEPROMOVERFLOW "存储超限"
+2
View File
@@ -538,6 +538,8 @@
#define TR_PRESSANYKEY TR("\006Stiskni klávesu", "Stiskni klávesu")
#define TR_BADEEPROMDATA TR("\006Chyba dat EEPROM", "Chyba dat EEPROM")
#define TR_BAD_RADIO_DATA "Chybná data rádia"
#define TR_RADIO_DATA_RECOVERED TR3("Using backup radio data","Using backup radio settings","Radio settings recovered from backup")
#define TR_RADIO_DATA_UNRECOVERABLE TR3("Radio settings invalid","Radio settings not valid", "Unable to read valid radio settings")
#define TR_EEPROMFORMATTING TR("\004Formatování EEPROM", "Formatování EEPROM")
#define TR_STORAGE_FORMAT "Storage Preparation"
#define TR_EEPROMOVERFLOW "Přetekla EEPROM"
+2
View File
@@ -518,6 +518,8 @@
#define TR_PRESSANYKEY TR("\010Tryk en tast", "Tryk en tast")
#define TR_BADEEPROMDATA "Dårlig EEprom data"
#define TR_BAD_RADIO_DATA "Dårlig radio data"
#define TR_RADIO_DATA_RECOVERED TR3("Using backup radio data","Using backup radio settings","Radio settings recovered from backup")
#define TR_RADIO_DATA_UNRECOVERABLE TR3("Radio settings invalid","Radio settings not valid", "Unable to read valid radio settings")
#define TR_EEPROMFORMATTING "Formaterer EEPROM"
#define TR_STORAGE_FORMAT "Lager klargøres"
#define TR_EEPROMOVERFLOW "EEPROM overflow"
+2
View File
@@ -523,6 +523,8 @@
#define TR_PRESSANYKEY TR("Taste drücken",CENTER"Taste drücken")
#define TR_BADEEPROMDATA "EEPROM ungültig"
#define TR_BAD_RADIO_DATA "Bad Radio Data"
#define TR_RADIO_DATA_RECOVERED TR3("Using backup radio data","Using backup radio settings","Radio settings recovered from backup")
#define TR_RADIO_DATA_UNRECOVERABLE TR3("Radio settings invalid","Radio settings not valid", "Unable to read valid radio settings")
#define TR_EEPROMFORMATTING "EEPROM Initialisieren"
#define TR_STORAGE_FORMAT "Speicher Vorbereiten"
#define TR_EEPROMOVERFLOW "EEPROM Überlauf"
+2
View File
@@ -517,6 +517,8 @@
#define TR_PRESSANYKEY TR("\010Press any Key", "Press any key")
#define TR_BADEEPROMDATA "Bad EEprom data"
#define TR_BAD_RADIO_DATA "Bad radio data"
#define TR_RADIO_DATA_RECOVERED TR3("Using backup radio data","Using backup radio settings","Radio settings recovered from backup")
#define TR_RADIO_DATA_UNRECOVERABLE TR3("Radio settings invalid","Radio settings not valid", "Unable to read valid radio settings")
#define TR_EEPROMFORMATTING "Formatting EEPROM"
#define TR_STORAGE_FORMAT "Storage preparation"
#define TR_EEPROMOVERFLOW "EEPROM overflow"
+2
View File
@@ -513,6 +513,8 @@
#define TR_PRESSANYKEY TR("\010Pulsa una tecla", "Pulsa una tecla")
#define TR_BADEEPROMDATA "Error datos EEPROM"
#define TR_BAD_RADIO_DATA "Error datos radio"
#define TR_RADIO_DATA_RECOVERED TR3("Using backup radio data","Using backup radio settings","Radio settings recovered from backup")
#define TR_RADIO_DATA_UNRECOVERABLE TR3("Radio settings invalid","Radio settings not valid", "Unable to read valid radio settings")
#define TR_EEPROMFORMATTING "Formateo EEPROM"
#define TR_STORAGE_FORMAT "Preparación alamacenamiento"
#define TR_EEPROMOVERFLOW "Desborde EEPROM"
+2
View File
@@ -528,6 +528,8 @@
#define TR_PRESSANYKEY TR("\010Press any Key", "Press any Key")
#define TR_BADEEPROMDATA "Bad EEPROM Data"
#define TR_BAD_RADIO_DATA "Bad Radio Data"
#define TR_RADIO_DATA_RECOVERED TR3("Using backup radio data","Using backup radio settings","Radio settings recovered from backup")
#define TR_RADIO_DATA_UNRECOVERABLE TR3("Radio settings invalid","Radio settings not valid", "Unable to read valid radio settings")
#define TR_EEPROMFORMATTING "Formatting EEPROM"
#define TR_STORAGE_FORMAT "Storage Preparation"
#define TR_EEPROMOVERFLOW "EEPROM overflow"
+2
View File
@@ -542,6 +542,8 @@
#define TR_PRESSANYKEY TR("Touche pour continuer", "Touche pour continuer")
#define TR_BADEEPROMDATA "EEPROM corrompue"
#define TR_BAD_RADIO_DATA "Réglages radio corrompus"
#define TR_RADIO_DATA_RECOVERED TR3("Using backup radio data","Using backup radio settings","Radio settings recovered from backup")
#define TR_RADIO_DATA_UNRECOVERABLE TR3("Radio settings invalid","Radio settings not valid", "Unable to read valid radio settings")
#define TR_EEPROMFORMATTING "Formatage EEPROM"
#define TR_STORAGE_FORMAT "Préparation stockage"
#define TR_EEPROMOVERFLOW "Dépassement EEPROM"
+2
View File
@@ -522,6 +522,8 @@
#define TR_PRESSANYKEY "\010Premi un tasto"
#define TR_BADEEPROMDATA "Dati corrotti!"
#define TR_BAD_RADIO_DATA "Dati radio errati"
#define TR_RADIO_DATA_RECOVERED TR3("Using backup radio data","Using backup radio settings","Radio settings recovered from backup")
#define TR_RADIO_DATA_UNRECOVERABLE TR3("Radio settings invalid","Radio settings not valid", "Unable to read valid radio settings")
#define TR_EEPROMFORMATTING "Formatto EEPROM..."
#define TR_STORAGE_FORMAT "Preparazione storage"
#define TR_EEPROMOVERFLOW "EEPROM Piena"
+2
View File
@@ -524,6 +524,8 @@
#define TR_PRESSANYKEY TR("\010Druk een Toets", "Druk een Toets")
#define TR_BADEEPROMDATA "EEPROM Ongeldig"
#define TR_BAD_RADIO_DATA "Bad Radio Data"
#define TR_RADIO_DATA_RECOVERED TR3("Using backup radio data","Using backup radio settings","Radio settings recovered from backup")
#define TR_RADIO_DATA_UNRECOVERABLE TR3("Radio settings invalid","Radio settings not valid", "Unable to read valid radio settings")
#define TR_EEPROMFORMATTING "EEPROM Initialiseren"
#define TR_STORAGE_FORMAT "Storage Preparation"
#define TR_EEPROMOVERFLOW "EEPROM Overflow"
+2
View File
@@ -518,6 +518,8 @@
#define TR_PRESSANYKEY TR("\010Wciśnij jakiś klawisz","Wciśnij jakiś klawisz")
#define TR_BADEEPROMDATA "\006Błąd danych EEPROM"
#define TR_BAD_RADIO_DATA "Bad Radio Data"
#define TR_RADIO_DATA_RECOVERED TR3("Using backup radio data","Using backup radio settings","Radio settings recovered from backup")
#define TR_RADIO_DATA_UNRECOVERABLE TR3("Radio settings invalid","Radio settings not valid", "Unable to read valid radio settings")
#define TR_EEPROMFORMATTING "\004Formatowanie EEPROM"
#define TR_STORAGE_FORMAT "Storage Preparation"
#define TR_EEPROMOVERFLOW "Przeładowany EEPROM"
+2
View File
@@ -515,6 +515,8 @@
#define TR_PRESSANYKEY "\010Pressione Tecla"
#define TR_BADEEPROMDATA "EEPRON INVALIDA"
#define TR_BAD_RADIO_DATA "Bad Radio Data"
#define TR_RADIO_DATA_RECOVERED TR3("Using backup radio data","Using backup radio settings","Radio settings recovered from backup")
#define TR_RADIO_DATA_UNRECOVERABLE TR3("Radio settings invalid","Radio settings not valid", "Unable to read valid radio settings")
#define TR_EEPROMFORMATTING "Formatando EEPROM"
#define TR_STORAGE_FORMAT "Storage Preparation"
#define TR_EEPROMOVERFLOW "EEPROM CHEIA"
+2
View File
@@ -549,6 +549,8 @@
#define TR_PRESSANYKEY TR("\010Tryck på en knapp", "Tryck på valfri knapp")
#define TR_BADEEPROMDATA "Minnet kan inte tolkas"
#define TR_BAD_RADIO_DATA "Data från radion kan inte tolkas"
#define TR_RADIO_DATA_RECOVERED TR3("Using backup radio data","Using backup radio settings","Radio settings recovered from backup")
#define TR_RADIO_DATA_UNRECOVERABLE TR3("Radio settings invalid","Radio settings not valid", "Unable to read valid radio settings")
#define TR_EEPROMFORMATTING "Minnet formateras"
#define TR_STORAGE_FORMAT "SD-Lagring förbereds"
#define TR_EEPROMOVERFLOW "Minnesfel"
+2
View File
@@ -517,6 +517,8 @@
#define TR_PRESSANYKEY TR("\010按任意鍵", "按任意鍵")
#define TR_BADEEPROMDATA "存儲數據錯誤"
#define TR_BAD_RADIO_DATA "系統數據錯誤"
#define TR_RADIO_DATA_RECOVERED TR3("Using backup radio data","Using backup radio settings","Radio settings recovered from backup")
#define TR_RADIO_DATA_UNRECOVERABLE TR3("Radio settings invalid","Radio settings not valid", "Unable to read valid radio settings")
#define TR_EEPROMFORMATTING "格式化存儲"
#define TR_STORAGE_FORMAT "存儲準備"
#define TR_EEPROMOVERFLOW "存儲超限"