Add radio tools to all radio (#6525)

Add radio tools to all radio
This commit is contained in:
Bertrand Songis
2019-06-27 22:30:25 +02:00
committed by GitHub
parent 9841b1ed2c
commit 87a1afb748
71 changed files with 1183 additions and 17 deletions
-4
View File
@@ -52,9 +52,7 @@ enum MenuRadioIndexes
{
MENU_RADIO_SETUP,
CASE_SDCARD(MENU_RADIO_SD_MANAGER)
#if defined(PXX2)
MENU_RADIO_TOOLS,
#endif
MENU_RADIO_SPECIAL_FUNCTIONS,
MENU_RADIO_TRAINER,
MENU_RADIO_HARDWARE,
@@ -78,9 +76,7 @@ void menuRadioCalibration(event_t event);
static const MenuHandlerFunc menuTabGeneral[MENU_RADIO_PAGES_COUNT] = {
menuRadioSetup,
CASE_SDCARD(menuRadioSdManager)
#if defined(PXX2)
menuRadioTools,
#endif
menuRadioSpecialFunctions,
menuRadioTrainer,
menuRadioHardware,
-2
View File
@@ -23,9 +23,7 @@
const MenuHandlerFunc menuTabGeneral[MENU_RADIO_PAGES_COUNT] = {
menuRadioSetup,
menuRadioSdManager,
#if defined(PXX2)
menuRadioTools,
#endif
menuRadioSpecialFunctions,
menuRadioTrainer,
menuRadioHardware,
-2
View File
@@ -54,9 +54,7 @@ void menuTraceBuffer(event_t event);
enum MenuRadioIndexes {
MENU_RADIO_SETUP,
MENU_RADIO_SD_MANAGER,
#if defined(PXX2)
MENU_RADIO_TOOLS,
#endif
MENU_RADIO_SPECIAL_FUNCTIONS,
MENU_RADIO_TRAINER,
MENU_RADIO_HARDWARE,
+1 -1
View File
@@ -12,6 +12,7 @@ set(GUI_SRC
../common/stdlcd/model_receiver_options.cpp
../common/stdlcd/model_notes.cpp
../common/stdlcd/model_curves.cpp
../common/stdlcd/radio_tools.cpp
model_curve_edit.cpp
)
@@ -29,7 +30,6 @@ endif()
if(PXX2)
set(GUI_SRC
${GUI_SRC}
../common/stdlcd/radio_tools.cpp
../common/stdlcd/radio_spectrum_analyser.cpp
../common/stdlcd/radio_power_meter.cpp
)
+11 -7
View File
@@ -86,20 +86,17 @@ bool readToolName(const char * filename, char * name)
return true;
}
void addRadioScriptTool(uint8_t index, const char * filename)
void addRadioScriptTool(uint8_t index, const char * path)
{
TCHAR path[_MAX_LFN+1] = SCRIPTS_TOOLS_PATH "/";
strcat(path, filename);
char toolName[TOOL_NAME_MAXLEN + 1];
const char * label;
if (readToolName(path, toolName)) {
label = toolName;
}
else {
char * ext = (char *)getFileExtension(filename);
char * ext = (char *)getFileExtension(path);
*ext = '\0';
label = filename;
label = getBasename(path);
}
if (addRadioTool(index, label)) {
@@ -150,17 +147,24 @@ void menuRadioTools(event_t event)
FILINFO fno;
DIR dir;
#if defined(CROSSFIRE)
if(isFileAvailable(SCRIPTS_TOOLS_PATH "/CROSSFIRE/crossfire.lua"))
addRadioScriptTool(index++, SCRIPTS_TOOLS_PATH "/CROSSFIRE/crossfire.lua");
#endif
FRESULT res = f_opendir(&dir, SCRIPTS_TOOLS_PATH);
if (res == FR_OK) {
for (;;) {
TCHAR path[_MAX_LFN+1] = SCRIPTS_TOOLS_PATH "/";
res = f_readdir(&dir, &fno); /* Read a directory item */
if (res != FR_OK || fno.fname[0] == 0) break; /* Break on error or end of dir */
if (fno.fattrib & AM_DIR) continue; /* Skip subfolders */
if (fno.fattrib & AM_HID) continue; /* Skip hidden files */
if (fno.fattrib & AM_SYS) continue; /* Skip system files */
strcat(path, fno.fname);
if (isRadioScriptTool(fno.fname))
addRadioScriptTool(index++, fno.fname);
addRadioScriptTool(index++, path);
}
}
#endif