Allow longer toolsname on wide screens (#6805)
This commit is contained in:
@@ -49,7 +49,7 @@ void addRadioModuleTool(uint8_t index, const char * label, bool (* tool)(event_t
|
||||
#if defined(LUA)
|
||||
void addRadioScriptTool(uint8_t index, const char * path)
|
||||
{
|
||||
char toolName[TOOL_NAME_MAXLEN + 1];
|
||||
char toolName[RADIO_TOOL_NAME_MAXLEN + 1];
|
||||
const char * label;
|
||||
char * ext = (char *)getFileExtension(path);
|
||||
if (readToolName(toolName, path)) {
|
||||
|
||||
@@ -46,15 +46,13 @@ void addRadioModuleTool(uint8_t index, const char * label, void (* tool)(event_t
|
||||
}
|
||||
}
|
||||
|
||||
#define TOOL_NAME_MAXLEN 16
|
||||
|
||||
#if defined(LUA)
|
||||
void addRadioScriptTool(uint8_t index, const char * path)
|
||||
{
|
||||
char toolName[TOOL_NAME_MAXLEN + 1];
|
||||
char toolName[RADIO_TOOL_NAME_MAXLEN + 1];
|
||||
|
||||
if (!readToolName(toolName, path)) {
|
||||
strAppendFilename(toolName, getBasename(path), TOOL_NAME_MAXLEN);
|
||||
strAppendFilename(toolName, getBasename(path), RADIO_TOOL_NAME_MAXLEN);
|
||||
}
|
||||
|
||||
if (addRadioTool(index, toolName)) {
|
||||
|
||||
@@ -1150,11 +1150,11 @@ bool readToolName(char * toolName, const char * filename)
|
||||
return false;
|
||||
|
||||
uint8_t len = end - start;
|
||||
if (len > TOOL_NAME_MAXLEN)
|
||||
if (len > RADIO_TOOL_NAME_MAXLEN)
|
||||
return false;
|
||||
|
||||
strncpy(toolName, start, len);
|
||||
memclear(toolName + len, TOOL_NAME_MAXLEN + 1 - len);
|
||||
memclear(toolName + len, RADIO_TOOL_NAME_MAXLEN + 1 - len);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -171,7 +171,12 @@ void registerBitmapClass(lua_State * L);
|
||||
void luaSetInstructionsLimit(lua_State* L, int count);
|
||||
int luaLoadScriptFileToState(lua_State * L, const char * filename, const char * mode);
|
||||
|
||||
#define TOOL_NAME_MAXLEN 16
|
||||
#if LCD_W > 350
|
||||
#define RADIO_TOOL_NAME_MAXLEN 40
|
||||
#else
|
||||
#define RADIO_TOOL_NAME_MAXLEN 16
|
||||
#endif
|
||||
|
||||
bool readToolName(char * toolName, const char * filename);
|
||||
bool isRadioScriptTool(const char * filename);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user