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