From d94bc3321cab35d12f578ae824b853a090e50608 Mon Sep 17 00:00:00 2001 From: philmoz Date: Fri, 22 Nov 2024 08:44:05 +1100 Subject: [PATCH] feat(radio): add repeat option for 'RGB Led' SF (#5677) Co-authored-by: Peter Feerick --- companion/src/firmwares/boards.cpp | 4 ++-- radio/src/gui/128x64/model_special_functions.cpp | 4 ++-- radio/src/gui/212x64/model_special_functions.cpp | 2 +- radio/src/gui/colorlcd/model/special_functions.cpp | 4 ++-- radio/src/myeeprom.h | 2 +- radio/src/storage/yaml/yaml_datastructs_funcs.cpp | 4 ++-- 6 files changed, 10 insertions(+), 10 deletions(-) diff --git a/companion/src/firmwares/boards.cpp b/companion/src/firmwares/boards.cpp index 40370f90c..7fde1b117 100644 --- a/companion/src/firmwares/boards.cpp +++ b/companion/src/firmwares/boards.cpp @@ -332,8 +332,8 @@ int Boards::getCapability(Board::Type board, Board::Capability capability) return (IS_STM32(board) && !IS_TARANIS_X9(board)); case HasLedStripGPIO: - // No current radio do support that feature - return false; + return (IS_RADIOMASTER_MT12(board) || IS_FLYSKY_PL18(board) || + IS_HELLORADIOSKY_V16(board)); case HasSDCard: return IS_STM32(board); diff --git a/radio/src/gui/128x64/model_special_functions.cpp b/radio/src/gui/128x64/model_special_functions.cpp index 107402d06..e30f0db9a 100644 --- a/radio/src/gui/128x64/model_special_functions.cpp +++ b/radio/src/gui/128x64/model_special_functions.cpp @@ -343,7 +343,7 @@ void menuSpecialFunctions(event_t event, CustomFunctionData * functions, CustomF x = x - 5 * FW; else if (func == FUNC_PLAY_TRACK) x = x - 3 * FW; - else if (func == FUNC_BACKGND_MUSIC) + else if (func == FUNC_BACKGND_MUSIC || func == FUNC_RGB_LED) x = x - 2 * FW; if (ZEXIST(cfn->play.name)) lcdDrawSizedText(x, y, cfn->play.name, sizeof(cfn->play.name), attr); @@ -487,7 +487,7 @@ void menuSpecialFunctions(event_t event, CustomFunctionData * functions, CustomF case 4: if (HAS_REPEAT_PARAM(func)) { - if (func == FUNC_PLAY_SCRIPT) { + if (func == FUNC_PLAY_SCRIPT || func == FUNC_RGB_LED) { lcdDrawText(MODEL_SPECIAL_FUNC_4TH_COLUMN_ONOFF-3, y, (CFN_PLAY_REPEAT(cfn) == 0) ? "On" : "1x", attr); if (active) CFN_PLAY_REPEAT(cfn) = checkIncDec(event, CFN_PLAY_REPEAT(cfn), 0, 1, eeFlags); } diff --git a/radio/src/gui/212x64/model_special_functions.cpp b/radio/src/gui/212x64/model_special_functions.cpp index 792689fe6..f6efa708e 100644 --- a/radio/src/gui/212x64/model_special_functions.cpp +++ b/radio/src/gui/212x64/model_special_functions.cpp @@ -436,7 +436,7 @@ void menuSpecialFunctions(event_t event, CustomFunctionData * functions, CustomF case ITEM_CUSTOM_FUNCTIONS_REPEAT: if (HAS_REPEAT_PARAM(func)) { - if (func == FUNC_PLAY_SCRIPT) { + if (func == FUNC_PLAY_SCRIPT || func == FUNC_RGB_LED) { lcdDrawText(MODEL_SPECIAL_FUNC_4TH_COLUMN+2, y, (CFN_PLAY_REPEAT(cfn) == 0) ? "On" : "1x", attr); if (active) CFN_PLAY_REPEAT(cfn) = checkIncDec(event, CFN_PLAY_REPEAT(cfn), 0, 1, eeFlags); } diff --git a/radio/src/gui/colorlcd/model/special_functions.cpp b/radio/src/gui/colorlcd/model/special_functions.cpp index 50d7041e3..b73969a89 100644 --- a/radio/src/gui/colorlcd/model/special_functions.cpp +++ b/radio/src/gui/colorlcd/model/special_functions.cpp @@ -264,7 +264,7 @@ void FunctionLineButton::refresh() lv_obj_clear_state(sfEnable, LV_STATE_CHECKED); if (HAS_REPEAT_PARAM(func)) { - if (func == FUNC_PLAY_SCRIPT) { + if (func == FUNC_PLAY_SCRIPT || func == FUNC_RGB_LED) { sprintf(s, "(%s)", (CFN_PLAY_REPEAT(cfn) == 0) ? "On" : "1x"); } else { sprintf( @@ -614,7 +614,7 @@ void FunctionEditPage::updateSpecialFunctionOneWindow() if (HAS_REPEAT_PARAM(func)) { // !1x 1x 1s 2s 3s ... line = specialFunctionOneWindow->newLine(grid); new StaticText(line, rect_t{}, STR_REPEAT); - if (func == FUNC_PLAY_SCRIPT) { + if (func == FUNC_PLAY_SCRIPT || func == FUNC_RGB_LED) { auto repeat = new Choice(line, rect_t{}, 0, 1, GET_DEFAULT((int8_t)CFN_PLAY_REPEAT(cfn)), SET_DEFAULT(CFN_PLAY_REPEAT(cfn))); diff --git a/radio/src/myeeprom.h b/radio/src/myeeprom.h index 3100f4813..fcdf7019c 100644 --- a/radio/src/myeeprom.h +++ b/radio/src/myeeprom.h @@ -47,7 +47,7 @@ #define IS_HAPTIC_FUNC(func) (0) #endif -#define HAS_REPEAT_PARAM(func) (IS_PLAY_FUNC(func) || IS_HAPTIC_FUNC(func) || func == FUNC_PLAY_SCRIPT || func == FUNC_SET_SCREEN) +#define HAS_REPEAT_PARAM(func) (IS_PLAY_FUNC(func) || IS_HAPTIC_FUNC(func) || func == FUNC_PLAY_SCRIPT || func == FUNC_RGB_LED || func == FUNC_SET_SCREEN) #define CFN_EMPTY(p) (!(p)->swtch) #define CFN_SWITCH(p) ((p)->swtch) diff --git a/radio/src/storage/yaml/yaml_datastructs_funcs.cpp b/radio/src/storage/yaml/yaml_datastructs_funcs.cpp index 6e62f7d6f..f36a63a7f 100644 --- a/radio/src/storage/yaml/yaml_datastructs_funcs.cpp +++ b/radio/src/storage/yaml/yaml_datastructs_funcs.cpp @@ -1724,7 +1724,7 @@ static void r_customFn(void* user, uint8_t* data, uint32_t bitoffs, } if (HAS_REPEAT_PARAM(func)) { - if (func == FUNC_PLAY_SCRIPT) { + if (func == FUNC_PLAY_SCRIPT || func == FUNC_RGB_LED) { if (val_len == 2 && val[0] == '1' && val[1] == 'x') CFN_PLAY_REPEAT(cfn) = 1; else @@ -1887,7 +1887,7 @@ static bool w_customFn(void* user, uint8_t* data, uint32_t bitoffs, // "," if (!wf(opaque,",",1)) return false; - if (func == FUNC_PLAY_SCRIPT) { + if (func == FUNC_PLAY_SCRIPT || func == FUNC_RGB_LED) { if (!wf(opaque,(CFN_PLAY_REPEAT(cfn) == 0) ? "On" : "1x",2)) return false; } else if (CFN_PLAY_REPEAT(cfn) == 0) { // "1x"