fix(sim): flight mode name incorrect in the simulator window title bar (#5854)

This commit is contained in:
philmoz
2025-02-03 09:38:07 +10:00
committed by GitHub
parent 615f966bc2
commit b4a7960696
5 changed files with 27 additions and 91 deletions
+25 -5
View File
@@ -56,15 +56,35 @@ typedef union {
TimerDisplayOptions displayOptions;
} TimerOptions;
uint8_t zlen(const char *str, uint8_t size);
bool zexist(const char *str, uint8_t size);
char * strcat_zchar(char *dest, const char *name, uint8_t size, const char spaceSym = 0, const char *defaultName=nullptr, uint8_t defaultNameSize=0, uint8_t defaultIdx=0);
#define strcatFlightmodeName(dest, idx) strcat_zchar(dest, g_model.flightModeData[idx].name, LEN_FLIGHT_MODE_NAME, 0, STR_FM, PSIZE(TR_FM), idx+1)
#if !defined(STORAGE_MODELSLIST)
#define strcat_modelname(dest, idx, spaceSym) \
strcat_zchar(dest, modelHeaders[idx].name, LEN_MODEL_NAME, spaceSym, STR_MODEL, \
PSIZE(TR_MODEL), idx + 1)
#define strcat_currentmodelname(dest, spaceSym) \
strcat_modelname(dest, g_eeGeneral.currModel, spaceSym)
#else
#define strcat_currentmodelname(dest, spaceSym) \
strcat_zchar(dest, g_model.header.name, LEN_MODEL_NAME, spaceSym)
#endif
#define ZLEN(s) zlen(s, sizeof(s))
#define ZEXIST(s) zexist(s, sizeof(s))
const char* sanitizeForFilename(const char* name, int len);
char hex2zchar(uint8_t hex);
char hex2char(uint8_t hex);
char zchar2char(int8_t idx);
char char2lower(char c);
int8_t char2zchar(char c);
void str2zchar(char *dest, const char *src, int size);
int zchar2str(char *dest, const char *src, int size);
int strnlen(const char *src, int max_size);
unsigned int effectiveLen(const char *str, unsigned int size);