diff --git a/companion/src/firmwares/customfunctiondata.cpp b/companion/src/firmwares/customfunctiondata.cpp index b765f02af98..c1547ab2993 100644 --- a/companion/src/firmwares/customfunctiondata.cpp +++ b/companion/src/firmwares/customfunctiondata.cpp @@ -423,6 +423,19 @@ AbstractStaticItemModel * CustomFunctionData::repeatLuaItemModel() return mdl; } +// static +AbstractStaticItemModel * CustomFunctionData::repeatSetScreenItemModel() +{ + AbstractStaticItemModel * mdl = new AbstractStaticItemModel(); + mdl->setName("customfunctiondata.repeatSetScreen"); + + mdl->appendToItemList(repeatToString(-1, false), -1); + mdl->appendToItemList(repeatToString(0, false), 0); + + mdl->loadItemList(); + return mdl; +} + // static AbstractStaticItemModel * CustomFunctionData::playSoundItemModel() { diff --git a/companion/src/firmwares/customfunctiondata.h b/companion/src/firmwares/customfunctiondata.h index 0e82b3ad581..d4f824e8898 100644 --- a/companion/src/firmwares/customfunctiondata.h +++ b/companion/src/firmwares/customfunctiondata.h @@ -141,6 +141,7 @@ class CustomFunctionData { static QString gvarAdjustModeToString(const int value); static AbstractStaticItemModel * repeatItemModel(); static AbstractStaticItemModel * repeatLuaItemModel(); + static AbstractStaticItemModel * repeatSetScreenItemModel(); static AbstractStaticItemModel * playSoundItemModel(); static AbstractStaticItemModel * harpicItemModel(); static AbstractStaticItemModel * gvarAdjustModeItemModel(); diff --git a/companion/src/modeledit/customfunctions.cpp b/companion/src/modeledit/customfunctions.cpp index 6c96f38fef5..5d0e8e8ca23 100644 --- a/companion/src/modeledit/customfunctions.cpp +++ b/companion/src/modeledit/customfunctions.cpp @@ -41,6 +41,7 @@ CustomFunctionsPanel::CustomFunctionsPanel(QWidget * parent, ModelData * model, harpicId = tabModelFactory->registerItemModel(CustomFunctionData::harpicItemModel()); repeatId = tabModelFactory->registerItemModel(CustomFunctionData::repeatItemModel()); repeatLuaId = tabModelFactory->registerItemModel(CustomFunctionData::repeatLuaItemModel()); + repeatSetScreenId = tabModelFactory->registerItemModel(CustomFunctionData::repeatSetScreenItemModel()); gvarAdjustModeId = tabModelFactory->registerItemModel(CustomFunctionData::gvarAdjustModeItemModel()); tabFilterFactory = new FilteredItemModelFactory(); @@ -209,6 +210,8 @@ CustomFunctionsPanel::CustomFunctionsPanel(QWidget * parent, ModelData * model, fswtchRepeat[i]->setProperty("index", i); if (functions[i].func == FuncPlayScript || functions[i].func == FuncRGBLed) fswtchRepeat[i]->setModel(tabModelFactory->getItemModel(repeatLuaId)); + else if (functions[i].func == FuncSetScreen && !Boards::getCapability(firmware->getBoard(), Board::HasColorLcd)) + fswtchRepeat[i]->setModel(tabModelFactory->getItemModel(repeatSetScreenId)); else fswtchRepeat[i]->setModel(tabModelFactory->getItemModel(repeatId)); fswtchRepeat[i]->setSizePolicy(QSizePolicy::Maximum, QSizePolicy::Fixed); @@ -356,6 +359,8 @@ void CustomFunctionsPanel::functionEdited() functions[index].enabled = true; if (functions[index].func == FuncPlayScript || functions[index].func == FuncRGBLed) fswtchRepeat[index]->setModel(tabModelFactory->getItemModel(repeatLuaId)); + else if (functions[index].func == FuncSetScreen && !Boards::getCapability(firmware->getBoard(), Board::HasColorLcd)) + fswtchRepeat[index]->setModel(tabModelFactory->getItemModel(repeatSetScreenId)); else fswtchRepeat[index]->setModel(tabModelFactory->getItemModel(repeatId)); if (functions[index].func == FuncLogs) diff --git a/companion/src/modeledit/customfunctions.h b/companion/src/modeledit/customfunctions.h index a629a7fc143..c64ef860cf6 100644 --- a/companion/src/modeledit/customfunctions.h +++ b/companion/src/modeledit/customfunctions.h @@ -89,6 +89,7 @@ class CustomFunctionsPanel : public GenericPanel int harpicId; int repeatId; int repeatLuaId; + int repeatSetScreenId; int gvarAdjustModeId; QSet tracksSet; diff --git a/radio/src/gui/128x64/model_special_functions.cpp b/radio/src/gui/128x64/model_special_functions.cpp index ab360439e32..f5eac658b94 100644 --- a/radio/src/gui/128x64/model_special_functions.cpp +++ b/radio/src/gui/128x64/model_special_functions.cpp @@ -501,7 +501,11 @@ void menuSpecialFunctions(event_t event, CustomFunctionData * functions, CustomF else { lcdDrawNumber(MODEL_SPECIAL_FUNC_4TH_COLUMN+2+FW, y, CFN_PLAY_REPEAT(cfn)*CFN_PLAY_REPEAT_MUL, RIGHT | attr); } - if (active) CFN_PLAY_REPEAT(cfn) = checkIncDec(event, CFN_PLAY_REPEAT(cfn)==CFN_PLAY_REPEAT_NOSTART?-1:CFN_PLAY_REPEAT(cfn), -1, 60/CFN_PLAY_REPEAT_MUL, eeFlags); + if (active) + CFN_PLAY_REPEAT(cfn) = checkIncDec(event, CFN_PLAY_REPEAT(cfn)==CFN_PLAY_REPEAT_NOSTART?-1:CFN_PLAY_REPEAT(cfn), + -1, + (func == FUNC_SET_SCREEN ? 0 : 60/CFN_PLAY_REPEAT_MUL), + eeFlags); } } else if (attr) { diff --git a/radio/src/gui/212x64/model_special_functions.cpp b/radio/src/gui/212x64/model_special_functions.cpp index dcd8c35d5e1..c6287e922b6 100644 --- a/radio/src/gui/212x64/model_special_functions.cpp +++ b/radio/src/gui/212x64/model_special_functions.cpp @@ -452,7 +452,11 @@ void menuSpecialFunctions(event_t event, CustomFunctionData * functions, CustomF lcdDrawNumber(MODEL_SPECIAL_FUNC_4TH_COLUMN+2+FW, y, CFN_PLAY_REPEAT(cfn)*CFN_PLAY_REPEAT_MUL, attr|RIGHT); lcdDrawChar(MODEL_SPECIAL_FUNC_4TH_COLUMN+2+FW, y, 's', attr); } - if (active) CFN_PLAY_REPEAT(cfn) = checkIncDec(event, CFN_PLAY_REPEAT(cfn)==CFN_PLAY_REPEAT_NOSTART?-1:CFN_PLAY_REPEAT(cfn), -1, 60/CFN_PLAY_REPEAT_MUL, eeFlags); + if (active) + CFN_PLAY_REPEAT(cfn) = checkIncDec(event, CFN_PLAY_REPEAT(cfn)==CFN_PLAY_REPEAT_NOSTART?-1:CFN_PLAY_REPEAT(cfn), + -1, + (func == FUNC_SET_SCREEN ? 0 : 60/CFN_PLAY_REPEAT_MUL), + eeFlags); } } else if (attr) {