mirror of
https://github.com/EdgeTX/edgetx.git
synced 2025-07-25 01:05:08 +03:00
Fixes #2472
This commit is contained in:
parent
b639466a4f
commit
92b5b72350
1 changed files with 16 additions and 5 deletions
|
@ -44,8 +44,19 @@
|
||||||
void onCustomFunctionsFileSelectionMenu(const char *result)
|
void onCustomFunctionsFileSelectionMenu(const char *result)
|
||||||
{
|
{
|
||||||
int sub = m_posVert;
|
int sub = m_posVert;
|
||||||
CustomFunctionData * cf = &g_model.customFn[sub];
|
CustomFunctionData * cfn;
|
||||||
uint8_t func = CFN_FUNC(cf);
|
uint8_t eeFlags;
|
||||||
|
|
||||||
|
if (g_menuStack[g_menuStackPtr] == menuModelCustomFunctions) {
|
||||||
|
cfn = &g_model.customFn[sub];
|
||||||
|
eeFlags = EE_MODEL;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
cfn = &g_eeGeneral.customFn[sub];
|
||||||
|
eeFlags = EE_GENERAL;
|
||||||
|
}
|
||||||
|
|
||||||
|
uint8_t func = CFN_FUNC(cfn);
|
||||||
|
|
||||||
if (result == STR_UPDATE_LIST) {
|
if (result == STR_UPDATE_LIST) {
|
||||||
char directory[256];
|
char directory[256];
|
||||||
|
@ -56,15 +67,15 @@ void onCustomFunctionsFileSelectionMenu(const char *result)
|
||||||
strcpy(directory, SOUNDS_PATH);
|
strcpy(directory, SOUNDS_PATH);
|
||||||
strncpy(directory+SOUNDS_PATH_LNG_OFS, currentLanguagePack->id, 2);
|
strncpy(directory+SOUNDS_PATH_LNG_OFS, currentLanguagePack->id, 2);
|
||||||
}
|
}
|
||||||
if (!listSdFiles(directory, func==FUNC_PLAY_SCRIPT ? SCRIPTS_EXT : SOUNDS_EXT, sizeof(cf->play.name), NULL)) {
|
if (!listSdFiles(directory, func==FUNC_PLAY_SCRIPT ? SCRIPTS_EXT : SOUNDS_EXT, sizeof(cfn->play.name), NULL)) {
|
||||||
POPUP_WARNING(func==FUNC_PLAY_SCRIPT ? STR_NO_SCRIPTS_ON_SD : STR_NO_SOUNDS_ON_SD);
|
POPUP_WARNING(func==FUNC_PLAY_SCRIPT ? STR_NO_SCRIPTS_ON_SD : STR_NO_SOUNDS_ON_SD);
|
||||||
s_menu_flags = 0;
|
s_menu_flags = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
// The user choosed a file in the list
|
// The user choosed a file in the list
|
||||||
memcpy(cf->play.name, result, sizeof(cf->play.name));
|
memcpy(cfn->play.name, result, sizeof(cfn->play.name));
|
||||||
eeDirty(EE_MODEL);
|
eeDirty(eeFlags);
|
||||||
if (func == FUNC_PLAY_SCRIPT) {
|
if (func == FUNC_PLAY_SCRIPT) {
|
||||||
LUA_LOAD_MODEL_SCRIPTS();
|
LUA_LOAD_MODEL_SCRIPTS();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue