@@ -25,6 +25,7 @@
|
|||||||
#include "opentx.h"
|
#include "opentx.h"
|
||||||
#include "libopenui.h"
|
#include "libopenui.h"
|
||||||
#include "lua/lua_api.h"
|
#include "lua/lua_api.h"
|
||||||
|
#include "standalone_lua.h"
|
||||||
|
|
||||||
extern uint8_t g_moduleIdx;
|
extern uint8_t g_moduleIdx;
|
||||||
|
|
||||||
@@ -106,7 +107,7 @@ void RadioToolsPage::rebuild(FormWindow * window)
|
|||||||
char toolName[TOOL_NAME_MAXLEN + 1];
|
char toolName[TOOL_NAME_MAXLEN + 1];
|
||||||
const char * label;
|
const char * label;
|
||||||
char * ext = (char *)getFileExtension(path);
|
char * ext = (char *)getFileExtension(path);
|
||||||
if (readToolName(path, toolName)) {
|
if (readToolName(toolName, path)) {
|
||||||
label = toolName;
|
label = toolName;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@@ -114,11 +115,18 @@ void RadioToolsPage::rebuild(FormWindow * window)
|
|||||||
label = getBasename(path);
|
label = getBasename(path);
|
||||||
}
|
}
|
||||||
new StaticText(window, grid.getLabelSlot(), "lua", BUTTON_BACKGROUND, CENTERED);
|
new StaticText(window, grid.getLabelSlot(), "lua", BUTTON_BACKGROUND, CENTERED);
|
||||||
new TextButton(window, grid.getFieldSlot(1), label, [=]() -> uint8_t {
|
|
||||||
f_chdir("/SCRIPTS/TOOLS/");
|
std::string path_str(path);
|
||||||
//luaExec(path);
|
new TextButton(
|
||||||
return 0;
|
window, grid.getFieldSlot(1), label,
|
||||||
}, 0);
|
[window, path_str]() -> uint8_t {
|
||||||
|
f_chdir("/SCRIPTS/TOOLS/");
|
||||||
|
luaExec(path_str.c_str());
|
||||||
|
// TODO: check 'luaState'
|
||||||
|
new StandaloneLuaWindow(window);
|
||||||
|
return 0;
|
||||||
|
},
|
||||||
|
0);
|
||||||
grid.nextLine();
|
grid.nextLine();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -187,4 +195,4 @@ void RadioToolsPage::rebuild(FormWindow * window)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
window->setInnerHeight(grid.getWindowHeight());
|
window->setInnerHeight(grid.getWindowHeight());
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user