feat(colorlcd): Special Function to set main screen (#2160)
* Special Function to set main screen (#2135) * chore: Add new SF to LUA constants list * Companion support * Formatting * get rid of magic number * Add function to get the number of custom screens * Change screen numbering from 0-based to 1-based. * Allow SetScreen custom function for Color LCD only * add range protection * cleanup * yet, range protection once again * fix: paintSpecialFunctionLine can't alter SF param data * Fix screen initialization in companion * move screen switching to the UI * Trigger view change from guiMain() * chore: Change "SET" to "Set" for consistency * fix: Somehow missed extra comma in `TW` Co-authored-by: Peter Feerick <peter.feerick@gmail.com> Co-authored-by: elecpower <neilh713@tpg.com.au> Co-authored-by: Raphael Coeffic <raphael.coeffic@frafos.com>
This commit is contained in:
co-authored by
Peter Feerick
elecpower
Raphael Coeffic
parent
b0c1315f61
commit
4e49ac68be
@@ -123,6 +123,8 @@ QString CustomFunctionData::funcToString(const AssignFunc func, const ModelData
|
||||
return tr("Racing Mode");
|
||||
else if (func == FuncDisableTouch)
|
||||
return tr("Disable Touch");
|
||||
else if (func == FuncSetScreen)
|
||||
return tr("Set Main Screen");
|
||||
else {
|
||||
return QString(CPN_STR_UNKNOWN_ITEM);
|
||||
}
|
||||
@@ -149,6 +151,9 @@ QString CustomFunctionData::paramToString(const ModelData * model) const
|
||||
else if (func == FuncVolume || func == FuncPlayValue || func == FuncBacklight) {
|
||||
return RawSource(param).toString(model);
|
||||
}
|
||||
else if (func ==FuncSetScreen) {
|
||||
return QString("%1").arg(param);
|
||||
}
|
||||
else if (func == FuncPlayPrompt || func == FuncPlayBoth) {
|
||||
if ( getCurrentFirmware()->getCapability(VoicesAsNumbers)) {
|
||||
return QString("%1").arg(param);
|
||||
@@ -223,7 +228,8 @@ bool CustomFunctionData::isFuncAvailable(const int index)
|
||||
((index == FuncScreenshot) && !IS_HORUS_OR_TARANIS(fw->getBoard())) ||
|
||||
((index >= FuncRangeCheckInternalModule && index <= FuncBindExternalModule) && !fw->getCapability(DangerousFunctions)) ||
|
||||
((index >= FuncAdjustGV1 && index <= FuncAdjustGVLast) && !fw->getCapability(Gvars)) ||
|
||||
((index == FuncDisableTouch) && !IS_HORUS_OR_TARANIS(fw->getBoard()))
|
||||
((index == FuncDisableTouch) && !IS_HORUS_OR_TARANIS(fw->getBoard())) ||
|
||||
((index == FuncSetScreen && !Boards::getCapability(fw->getBoard(), Board::HasColorLcd)))
|
||||
);
|
||||
return !ret;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user