Fixes compilation for color lcd
This commit is contained in:
@@ -126,7 +126,7 @@ void convertBinRadioData(const char * path, int version)
|
||||
}
|
||||
|
||||
#if defined(SDCARD_YAML) || defined(STORAGE_MODELSLIST)
|
||||
modelslist.save(ModelsList::Format::yaml);
|
||||
modelslist.save();
|
||||
#endif
|
||||
|
||||
// reload models list
|
||||
|
||||
@@ -37,7 +37,7 @@ void patchFilenameToYaml(char* str)
|
||||
constexpr unsigned yml_len = sizeof(YAML_EXT) - 1;
|
||||
|
||||
// patch file extension
|
||||
const char* ext = strrchr(path, '.');
|
||||
const char* ext = strrchr(str, '.');
|
||||
if (ext && (strlen(ext) == bin_len) &&
|
||||
!strncmp(ext, STR_MODELS_EXT, bin_len)) {
|
||||
memcpy((void*)ext, (void*)STR_YAML_EXT, yml_len + 1);
|
||||
@@ -56,8 +56,12 @@ static const char* convertData_220_to_221(
|
||||
if (!error) {
|
||||
if (patchBinary) patchBinary(data);
|
||||
|
||||
patchFilenameToYaml(path);
|
||||
error = writeFileYaml(path, root_node, data);
|
||||
char output_fname[FF_MAX_LFN+1];
|
||||
strncpy(output_fname, path, FF_MAX_LFN);
|
||||
output_fname[FF_MAX_LFN] = '\0';
|
||||
|
||||
patchFilenameToYaml(output_fname);
|
||||
error = writeFileYaml(output_fname, root_node, data);
|
||||
}
|
||||
|
||||
free(data);
|
||||
|
||||
@@ -370,17 +370,20 @@ bool ModelsList::loadYaml()
|
||||
}
|
||||
#endif
|
||||
|
||||
bool ModelsList::load()
|
||||
bool ModelsList::load(Format fmt)
|
||||
{
|
||||
if (loaded)
|
||||
return true;
|
||||
|
||||
bool res = false;
|
||||
#if !defined(SDCARD_YAML)
|
||||
(void)fmt;
|
||||
res = loadTxt();
|
||||
#else
|
||||
FILINFO fno;
|
||||
if (f_stat(RADIO_MODELSLIST_YAML_PATH, &fno) != FR_OK) {
|
||||
if (fmt == Format::txt ||
|
||||
(fmt == Format::yaml_txt &&
|
||||
f_stat(RADIO_MODELSLIST_YAML_PATH, &fno) != FR_OK)) {
|
||||
res = loadTxt();
|
||||
} else {
|
||||
res = loadYaml();
|
||||
|
||||
@@ -104,10 +104,8 @@ public:
|
||||
yaml,
|
||||
yaml_txt,
|
||||
load_default = yaml_txt,
|
||||
save_default = yaml,
|
||||
#else
|
||||
load_default = txt,
|
||||
save_default = txt,
|
||||
#endif
|
||||
};
|
||||
|
||||
@@ -115,7 +113,7 @@ public:
|
||||
~ModelsList();
|
||||
|
||||
bool load(Format fmt = Format::load_default);
|
||||
void save(Format fmt = Format::save_default);
|
||||
void save();
|
||||
void clear();
|
||||
|
||||
const std::list<ModelsCategory *> & getCategories() const
|
||||
|
||||
Reference in New Issue
Block a user