From ee73e9507768ef830138c1bf3afcde3965e14e41 Mon Sep 17 00:00:00 2001 From: philmoz Date: Fri, 6 Oct 2023 11:52:30 +1100 Subject: [PATCH] feat(color): Add Enable/Disable option to SF/GF popup menu (#4157) --- radio/src/gui/colorlcd/special_functions.cpp | 17 +++++++++++++++++ radio/src/targets/nv14/bootloader/boot_menu.cpp | 2 +- radio/src/translations.cpp | 1 + radio/src/translations.h | 1 + radio/src/translations/cn.h | 3 +-- radio/src/translations/cz.h | 3 +-- radio/src/translations/da.h | 3 +-- radio/src/translations/de.h | 3 +-- radio/src/translations/en.h | 3 +-- radio/src/translations/es.h | 7 +++---- radio/src/translations/fi.h | 3 +-- radio/src/translations/fr.h | 3 +-- radio/src/translations/he.h | 3 +-- radio/src/translations/it.h | 3 +-- radio/src/translations/jp.h | 3 +-- radio/src/translations/nl.h | 7 +++---- radio/src/translations/pl.h | 3 +-- radio/src/translations/pt.h | 3 +-- radio/src/translations/se.h | 3 +-- radio/src/translations/tw.h | 3 +-- 20 files changed, 40 insertions(+), 37 deletions(-) diff --git a/radio/src/gui/colorlcd/special_functions.cpp b/radio/src/gui/colorlcd/special_functions.cpp index 9ee93642e..1b0b83d2b 100644 --- a/radio/src/gui/colorlcd/special_functions.cpp +++ b/radio/src/gui/colorlcd/special_functions.cpp @@ -865,6 +865,23 @@ void SpecialFunctionsPage::build(FormWindow *window) pasteSpecialFunction(window, i, button); }); } + CustomFunctionData *cfn = &functions[i]; + uint8_t func = CFN_FUNC(cfn); + if (HAS_ENABLE_PARAM(func)) { + if (CFN_ACTIVE(cfn)) { + menu->addLine(STR_DISABLE, [=]() { + CFN_ACTIVE(cfn) = 0; + SET_DIRTY(); + rebuild(window); + }); + } else { + menu->addLine(STR_ENABLE, [=]() { + CFN_ACTIVE(cfn) = 1; + SET_DIRTY(); + rebuild(window); + }); + } + } if (functions[MAX_SPECIAL_FUNCTIONS - 1].isEmpty()) { for (int j = i; j < MAX_SPECIAL_FUNCTIONS; j++) { if (!functions[j].isEmpty()) { diff --git a/radio/src/targets/nv14/bootloader/boot_menu.cpp b/radio/src/targets/nv14/bootloader/boot_menu.cpp index 1280f0223..1ae6c9dfc 100644 --- a/radio/src/targets/nv14/bootloader/boot_menu.cpp +++ b/radio/src/targets/nv14/bootloader/boot_menu.cpp @@ -216,7 +216,7 @@ void bootloaderDrawScreen(BootloaderState st, int opt, const char* str) bootloaderDrawTitle(TR_BL_RF_USB_ACCESS); lcd->drawText(62, 75, LV_SYMBOL_USB, BL_FOREGROUND); - coord_t pos = lcd->drawText(84, 75, rfUsbAccess ? TR_BL_DISABLE : TR_BL_ENABLE, BL_FOREGROUND); + coord_t pos = lcd->drawText(84, 75, rfUsbAccess ? TR_DISABLE : TR_ENABLE, BL_FOREGROUND); pos += 8; lcd->drawText(60, 110, LV_SYMBOL_NEW_LINE, BL_FOREGROUND); diff --git a/radio/src/translations.cpp b/radio/src/translations.cpp index 44c5d4498..0a49935ab 100644 --- a/radio/src/translations.cpp +++ b/radio/src/translations.cpp @@ -629,6 +629,7 @@ const char STR_PERIOD[] = TR_PERIOD; const char STR_INTERVAL[] = TR_INTERVAL; const char STR_REPEAT[] = TR_REPEAT; const char STR_ENABLE[] = TR_ENABLE; +const char STR_DISABLE[] = TR_DISABLE; const char STR_TOPLCDTIMER[] = TR_TOPLCDTIMER; const char STR_UNIT[] = TR_UNIT; const char STR_TELEMETRY_NEWSENSOR[] = TR_TELEMETRY_NEWSENSOR; diff --git a/radio/src/translations.h b/radio/src/translations.h index 02a310fb1..4aae4ec82 100644 --- a/radio/src/translations.h +++ b/radio/src/translations.h @@ -1029,6 +1029,7 @@ extern const char STR_PERIOD[]; extern const char STR_INTERVAL[]; extern const char STR_REPEAT[]; extern const char STR_ENABLE[]; +extern const char STR_DISABLE[]; extern const char STR_TOPLCDTIMER[]; extern const char STR_UNIT[]; ; extern const char STR_TELEMETRY_NEWSENSOR[]; diff --git a/radio/src/translations/cn.h b/radio/src/translations/cn.h index f99c28d53..663e5a5b7 100644 --- a/radio/src/translations/cn.h +++ b/radio/src/translations/cn.h @@ -867,6 +867,7 @@ #define TR_INTERVAL "间隔" #define TR_REPEAT "循环" #define TR_ENABLE "启用" +#define TR_DISABLE "Disable" #define TR_TOPLCDTIMER "Top LCD Timer" #define TR_UNIT "单位" #define TR_TELEMETRY_NEWSENSOR INDENT "添加新传感器..." @@ -1033,8 +1034,6 @@ #define TR_BL_SELECT_KEY "[R TRIM] to select file" #define TR_BL_FLASH_KEY "Hold [R TRIM] long to flash" #define TR_BL_EXIT_KEY " [L TRIM] to exit" - #define TR_BL_ENABLE "Enable" - #define TR_BL_DISABLE "Disable" #endif // About screen diff --git a/radio/src/translations/cz.h b/radio/src/translations/cz.h index 947ac6ad5..1adb2c94c 100644 --- a/radio/src/translations/cz.h +++ b/radio/src/translations/cz.h @@ -884,6 +884,7 @@ #define TR_INTERVAL "Interval" #define TR_REPEAT "Opakovat" #define TR_ENABLE "Povoleno" +#define TR_DISABLE "Zakazano" #define TR_TOPLCDTIMER "Stopky horního LCD" #define TR_UNIT "Jednotky" #define TR_TELEMETRY_NEWSENSOR INDENT "Přidat senzor ručně" @@ -1055,8 +1056,6 @@ #define TR_BL_SELECT_KEY "[R TRIM] pro vybrani souboru" #define TR_BL_FLASH_KEY "Drzet dlouze [R TRIM] pro nahrani" #define TR_BL_EXIT_KEY " [L TRIM] pro ukonceni" - #define TR_BL_ENABLE "Povoleno" - #define TR_BL_DISABLE "Zakazano" #endif // About screen diff --git a/radio/src/translations/da.h b/radio/src/translations/da.h index c46c9bd2b..3fb36648e 100644 --- a/radio/src/translations/da.h +++ b/radio/src/translations/da.h @@ -883,6 +883,7 @@ #define TR_INTERVAL "Interval" #define TR_REPEAT "Gentag" #define TR_ENABLE "Aktiver" +#define TR_DISABLE "Deaktiver" #define TR_TOPLCDTIMER "Top LCD ur" #define TR_UNIT "Enhed" #define TR_TELEMETRY_NEWSENSOR INDENT "Tilføj ny" @@ -1048,8 +1049,6 @@ #define TR_BL_SELECT_KEY "[R TRIM] for at bruge fil" #define TR_BL_FLASH_KEY "[R TRIM] lang til for at starte" #define TR_BL_EXIT_KEY "[L TRIM] for at forlade" - #define TR_BL_ENABLE "Aktiver" - #define TR_BL_DISABLE "Deaktiver" #endif // About screen diff --git a/radio/src/translations/de.h b/radio/src/translations/de.h index 699025d6e..12196407d 100644 --- a/radio/src/translations/de.h +++ b/radio/src/translations/de.h @@ -873,6 +873,7 @@ #define TR_INTERVAL "Intervall" #define TR_REPEAT "Wiederholung" #define TR_ENABLE "Aktivieren" +#define TR_DISABLE "Deaktivieren" #define TR_TOPLCDTIMER "oberer LCD Timer" #define TR_UNIT "Einheit" #define TR_TELEMETRY_NEWSENSOR INDENT "Sensor hinzufügen ..." @@ -1031,8 +1032,6 @@ #define TR_BL_SELECT_KEY "[R TRIM] um Datei auszuwählen" #define TR_BL_FLASH_KEY "Halte [R TRIM] gedrückt, zum schreiben" #define TR_BL_EXIT_KEY " [L TRIM] zum beenden" - #define TR_BL_ENABLE "Aktivieren" - #define TR_BL_DISABLE "Deaktivieren" #endif // Taranis Info Zeile Anzeigen diff --git a/radio/src/translations/en.h b/radio/src/translations/en.h index ea23ceec8..5d0d2aecb 100644 --- a/radio/src/translations/en.h +++ b/radio/src/translations/en.h @@ -878,6 +878,7 @@ #define TR_INTERVAL "Interval" #define TR_REPEAT "Repeat" #define TR_ENABLE "Enable" +#define TR_DISABLE "Disable" #define TR_TOPLCDTIMER "Top LCD Timer" #define TR_UNIT "Unit" #define TR_TELEMETRY_NEWSENSOR INDENT "Add new" @@ -1044,8 +1045,6 @@ #define TR_BL_SELECT_KEY "[R TRIM] to select file" #define TR_BL_FLASH_KEY "Hold [R TRIM] long to flash" #define TR_BL_EXIT_KEY " [L TRIM] to exit" - #define TR_BL_ENABLE "Enable" - #define TR_BL_DISABLE "Disable" #endif // About screen diff --git a/radio/src/translations/es.h b/radio/src/translations/es.h index b37455ead..c7cf257ed 100644 --- a/radio/src/translations/es.h +++ b/radio/src/translations/es.h @@ -872,8 +872,9 @@ #define TR_VALUE "Valor" #define TR_PERIOD "Period" #define TR_INTERVAL "Interval" -#define TR_REPEAT "Repeat" -#define TR_ENABLE "Enable" +#define TR_REPEAT "Repeat" +#define TR_ENABLE "Enable" +#define TR_DISABLE "Disable" #define TR_TOPLCDTIMER "Timer LCD superior" #define TR_UNIT "Unidad" #define TR_TELEMETRY_NEWSENSOR INDENT "Añadir sensor..." @@ -1046,8 +1047,6 @@ #define TR_BL_SELECT_KEY "[R TRIM] to select file" #define TR_BL_FLASH_KEY "Hold [R TRIM] long to flash" #define TR_BL_EXIT_KEY " [L TRIM] to exit" - #define TR_BL_ENABLE "Enable" - #define TR_BL_DISABLE "Disable" #endif // About screen diff --git a/radio/src/translations/fi.h b/radio/src/translations/fi.h index ec6793cef..caa5b61d1 100644 --- a/radio/src/translations/fi.h +++ b/radio/src/translations/fi.h @@ -888,6 +888,7 @@ #define TR_INTERVAL "Interval" #define TR_REPEAT "Repeat" #define TR_ENABLE "Enable" +#define TR_DISABLE "Disable" #define TR_TOPLCDTIMER "Top LCD Timer" #define TR_UNIT "Unit" #define TR_TELEMETRY_NEWSENSOR INDENT "Add a new sensor..." @@ -1059,8 +1060,6 @@ #define TR_BL_SELECT_KEY "[R TRIM] to select file" #define TR_BL_FLASH_KEY "Hold [R TRIM] long to flash" #define TR_BL_EXIT_KEY " [L TRIM] to exit" - #define TR_BL_ENABLE "Enable" - #define TR_BL_DISABLE "Disable" #endif // About screen diff --git a/radio/src/translations/fr.h b/radio/src/translations/fr.h index 0cc1eeb9a..79efc0757 100644 --- a/radio/src/translations/fr.h +++ b/radio/src/translations/fr.h @@ -884,6 +884,7 @@ #define TR_INTERVAL "Intervalle" #define TR_REPEAT "Répéter" #define TR_ENABLE "Activer" +#define TR_DISABLE "Désactiver" #define TR_TOPLCDTIMER "Chrono LCD haut" #define TR_UNIT "Unité" #define TR_TELEMETRY_NEWSENSOR TR(INDENT"Nouveau capteur...", INDENT "Ajouter nouveau") @@ -1063,8 +1064,6 @@ #define TR_BL_SELECT_KEY "[R TRIM] pour sélect. fichier" #define TR_BL_FLASH_KEY "Appui long [R TRIM] pour flasher" #define TR_BL_EXIT_KEY " [L TRIM] pour quitter" - #define TR_BL_ENABLE "Activer" - #define TR_BL_DISABLE "Désactiver" #endif // About screen diff --git a/radio/src/translations/he.h b/radio/src/translations/he.h index e9d2b1a49..d12921701 100644 --- a/radio/src/translations/he.h +++ b/radio/src/translations/he.h @@ -883,6 +883,7 @@ #define TR_INTERVAL "Interval" #define TR_REPEAT "מספר חזרות" #define TR_ENABLE "זמין" +#define TR_DISABLE "אל תאפשר" #define TR_TOPLCDTIMER "Top LCD Timer" #define TR_UNIT "יחידה" #define TR_TELEMETRY_NEWSENSOR INDENT "הוסף חדש" @@ -1053,8 +1054,6 @@ #define TR_BL_SELECT_KEY "[R TRIM] to select file" #define TR_BL_FLASH_KEY "Hold [R TRIM] long to flash" #define TR_BL_EXIT_KEY " [L TRIM] ליציאה" - #define TR_BL_ENABLE "אפשר" - #define TR_BL_DISABLE "אל תאפשר" #endif // About screen diff --git a/radio/src/translations/it.h b/radio/src/translations/it.h index f1aced39b..ae817e416 100644 --- a/radio/src/translations/it.h +++ b/radio/src/translations/it.h @@ -877,6 +877,7 @@ #define TR_INTERVAL "Intervallo" #define TR_REPEAT "Ripeti" #define TR_ENABLE "Abilita" +#define TR_DISABLE "Disabilita" #define TR_TOPLCDTIMER "Timer LCD Su" #define TR_UNIT "Unità" #define TR_TELEMETRY_NEWSENSOR INDENT "Aggiungi sensore" @@ -1043,8 +1044,6 @@ #define TR_BL_SELECT_KEY "[R TRIM] per scegliere il file" #define TR_BL_FLASH_KEY "Tener premuto [R TRIM] per scrivere" #define TR_BL_EXIT_KEY " [L TRIM] per uscire" - #define TR_BL_ENABLE "Abilita" - #define TR_BL_DISABLE "Disabilita" #endif // About screen diff --git a/radio/src/translations/jp.h b/radio/src/translations/jp.h index 66b1aad2c..2fc30fc08 100644 --- a/radio/src/translations/jp.h +++ b/radio/src/translations/jp.h @@ -873,6 +873,7 @@ #define TR_INTERVAL "インターバル" #define TR_REPEAT "リピート" #define TR_ENABLE "有効" +#define TR_DISABLE "Disable" #define TR_TOPLCDTIMER "上部LCDタイマー" #define TR_UNIT "ユニット" #define TR_TELEMETRY_NEWSENSOR INDENT "新規追加" @@ -1039,8 +1040,6 @@ #define TR_BL_SELECT_KEY "[R TRIM] to select file" #define TR_BL_FLASH_KEY "Hold [R TRIM] long to flash" #define TR_BL_EXIT_KEY " [L TRIM] to exit" - #define TR_BL_ENABLE "Enable" - #define TR_BL_DISABLE "Disable" #endif // About screen diff --git a/radio/src/translations/nl.h b/radio/src/translations/nl.h index 6a24954e9..bd9c477a4 100644 --- a/radio/src/translations/nl.h +++ b/radio/src/translations/nl.h @@ -872,8 +872,9 @@ #define TR_VALUE "Waarde" #define TR_PERIOD "Period" #define TR_INTERVAL "Interval" -#define TR_REPEAT "Repeat" -#define TR_ENABLE "Enable" +#define TR_REPEAT "Repeat" +#define TR_ENABLE "Enable" +#define TR_DISABLE "Disable" #define TR_TOPLCDTIMER "Top LCD Timer" #define TR_UNIT "Eenheid" #define TR_TELEMETRY_NEWSENSOR INDENT "Sensor toevoegen ..." @@ -1051,8 +1052,6 @@ #define TR_BL_SELECT_KEY "[R TRIM] to select file" #define TR_BL_FLASH_KEY "Hold [R TRIM] long to flash" #define TR_BL_EXIT_KEY " [L TRIM] to exit" - #define TR_BL_ENABLE "Enable" - #define TR_BL_DISABLE "Disable" #endif // About screen diff --git a/radio/src/translations/pl.h b/radio/src/translations/pl.h index 602221b01..f4bd540c6 100644 --- a/radio/src/translations/pl.h +++ b/radio/src/translations/pl.h @@ -870,6 +870,7 @@ #define TR_INTERVAL "Interwał" #define TR_REPEAT "Powtórz" #define TR_ENABLE "Włącz" +#define TR_DISABLE "Wyłączać" #define TR_TOPLCDTIMER "Top LCD Timer" #define TR_UNIT "Jednostka" #define TR_TELEMETRY_NEWSENSOR INDENT "Dodaj nowy czujnik..." @@ -1041,8 +1042,6 @@ #define TR_BL_SELECT_KEY "[R TRIM] aby wybrac plik" #define TR_BL_FLASH_KEY "Przytrzymaj [R TRIM] aby flashowac" #define TR_BL_EXIT_KEY " [L TRIM] aby wyjsc" - #define TR_BL_ENABLE "Włącz" - #define TR_BL_DISABLE "Wyłączać" #endif // About screen diff --git a/radio/src/translations/pt.h b/radio/src/translations/pt.h index 2a389987d..cf8176410 100644 --- a/radio/src/translations/pt.h +++ b/radio/src/translations/pt.h @@ -881,6 +881,7 @@ #define TR_INTERVAL "Interval" #define TR_REPEAT "Repeat" #define TR_ENABLE "Enable" +#define TR_DISABLE "Disable" #define TR_TOPLCDTIMER "Top LCD Timer" #define TR_UNIT "Unit" #define TR_TELEMETRY_NEWSENSOR INDENT "Adic Sensor" @@ -1047,8 +1048,6 @@ #define TR_BL_SELECT_KEY "[R TRIM] to select file" #define TR_BL_FLASH_KEY "Hold [R TRIM] long to flash" #define TR_BL_EXIT_KEY " [L TRIM] to exit" - #define TR_BL_ENABLE "Enable" - #define TR_BL_DISABLE "Disable" #endif // About screen diff --git a/radio/src/translations/se.h b/radio/src/translations/se.h index ebc7ca5f4..2d72ba38d 100644 --- a/radio/src/translations/se.h +++ b/radio/src/translations/se.h @@ -899,6 +899,7 @@ #define TR_INTERVAL "Intervall" #define TR_REPEAT "Upprepa" #define TR_ENABLE "Aktivera" +#define TR_DISABLE "Inaktivera" #define TR_TOPLCDTIMER "Översta LCD timer" #define TR_UNIT "Enhet" #define TR_TELEMETRY_NEWSENSOR INDENT "Lägg till..." @@ -1072,8 +1073,6 @@ #define TR_BL_SELECT_KEY "[R TRIM] foer att vaelja fil" #define TR_BL_FLASH_KEY "Tryck [R TRIM] foer att flasha" #define TR_BL_EXIT_KEY " [L TRIM] för att avsluta" - #define TR_BL_ENABLE "Aktivera" - #define TR_BL_DISABLE "Inaktivera" #endif // About screen diff --git a/radio/src/translations/tw.h b/radio/src/translations/tw.h index 3bdab141a..a317452c4 100644 --- a/radio/src/translations/tw.h +++ b/radio/src/translations/tw.h @@ -873,6 +873,7 @@ #define TR_INTERVAL "間隔" #define TR_REPEAT "循環" #define TR_ENABLE "啟用" +#define TR_DISABLE "Disable" #define TR_TOPLCDTIMER "Top LCD Timer" #define TR_UNIT "單位" #define TR_TELEMETRY_NEWSENSOR INDENT "添加新傳感器..." @@ -1039,8 +1040,6 @@ #define TR_BL_SELECT_KEY "[R TRIM] to select file" #define TR_BL_FLASH_KEY "Hold [R TRIM] long to flash" #define TR_BL_EXIT_KEY " [L TRIM] to exit" - #define TR_BL_ENABLE "Enable" - #define TR_BL_DISABLE "Disable" #endif // About screen