This commit is contained in:
Raphael Coeffic
2021-11-10 11:06:59 +01:00
parent 5a367a5221
commit 985a8760bb
11 changed files with 550 additions and 11 deletions
@@ -22,7 +22,7 @@
#include "opentx.h"
#include "conversions.h"
#if defined(COLORLCD)
#if defined(SDCARD_RAW) || defined(SDCARD_YAML)
#include "storage/modelslist.h"
#include "storage/sdcard_common.h"
#include "storage/sdcard_raw.h"
+20
View File
@@ -26,6 +26,10 @@
#include "conversions/conversions.h"
#include "model_init.h"
//#if !defined(EEPROM_SDCARD)
ModelHeader modelHeaders[MAX_MODELS];
//#endif
// defined either in sdcard_raw.cpp or sdcard_yaml.cpp
void storageCreateModelsList();
@@ -183,3 +187,19 @@ void storageReadAll()
}
}
void checkModelIdUnique(uint8_t index, uint8_t module)
{
if (isModuleXJTD8(module))
return;
char * warn_buf = reusableBuffer.moduleSetup.msg;
// cannot rely exactly on WARNING_LINE_LEN so using WARNING_LINE_LEN-2
size_t warn_buf_len = sizeof(reusableBuffer.moduleSetup.msg) - WARNING_LINE_LEN - 2;
if (!modelslist.isModelIdUnique(module,warn_buf,warn_buf_len)) {
if (warn_buf[0] != 0) {
POPUP_WARNING(STR_MODELIDUSED);
SET_WARNING_INFO(warn_buf, sizeof(reusableBuffer.moduleSetup.msg), 0);
}
}
}
+7
View File
@@ -34,6 +34,10 @@
#define MODEL_FILENAME_PATTERN "model.yml"
#endif
//#if !defined(EEPROM)
extern ModelHeader modelHeaders[MAX_MODELS];
//#endif
// opens radio.bin or model file
const char* openFileBin(const char* fullpath, FIL* file, uint16_t* size,
uint8_t* version);
@@ -53,4 +57,7 @@ const char * writeGeneralSettings();
const char * loadRadioSettings(const char * path);
const char * loadRadioSettings();
void checkModelIdUnique(uint8_t index, uint8_t module);
#endif // _SDCARD_RAW_H_
@@ -261,8 +261,7 @@ static const struct YamlNode struct_RadioData[] = {
YAML_UNSIGNED( "adjustRTC", 1 ),
YAML_UNSIGNED( "inactivityTimer", 8 ),
YAML_UNSIGNED( "telemetryBaudrate", 3 ),
YAML_UNSIGNED( "splashMode", 1 ),
YAML_PADDING( 2 ),
YAML_SIGNED( "splashMode", 3 ),
YAML_SIGNED( "hapticMode", 2 ),
YAML_SIGNED( "switchesDelay", 8 ),
YAML_UNSIGNED( "lightAutoOff", 8 ),
@@ -310,6 +309,8 @@ static const struct YamlNode struct_RadioData[] = {
YAML_PADDING( 8 ),
YAML_STRING("bluetoothName", 10),
YAML_STRING("ownerRegistrationID", 8),
YAML_SIGNED( "uartSampleMode", 2 ),
YAML_STRING("currModelFilename", 17),
YAML_END
};
static const struct YamlNode struct_unsigned_8[] = {