3djc/enhance companion get capability (#4243)
* Add info on switches/sliders/pots setup when delivered from factory (other calls return user installed max possible) * Fix * getCapability() : Refine actoryInstalledSwitches, add NumTrimSwitches, remove FactoryInstalledPots & FactoryInstalledSliders; GeneralSettings() initialization : Use `FactoryInstalledSwitches` count instead of `Switches` for default setup, and also set up correct number of sliders for X9E (4) and X7 (0). * Enum order cosmetics. [ci skip]
This commit is contained in:
@@ -1093,31 +1093,36 @@ GeneralSettings::GeneralSettings()
|
||||
calibSpanPos[i] = 0x180;
|
||||
}
|
||||
|
||||
for (int i=0; i<GetCurrentFirmware()->getCapability(Switches); i++) {
|
||||
for (int i=0; i<GetCurrentFirmware()->getCapability(FactoryInstalledSwitches); i++) {
|
||||
switchConfig[i] = GetCurrentFirmware()->getSwitch(i).type;
|
||||
}
|
||||
|
||||
BoardEnum board = GetEepromInterface()->getBoard();
|
||||
if (board == BOARD_HORUS) {
|
||||
if (IS_HORUS(board)) {
|
||||
potConfig[0] = POT_WITH_DETENT;
|
||||
potConfig[1] = POT_MULTIPOS_SWITCH;
|
||||
potConfig[2] = POT_WITH_DETENT;
|
||||
}
|
||||
else if (IS_TARANIS(board)) {
|
||||
potConfig[0] = POT_WITH_DETENT;
|
||||
potConfig[1] = POT_WITH_DETENT;
|
||||
}
|
||||
else {
|
||||
potConfig[0] = POT_WITHOUT_DETENT;
|
||||
potConfig[1] = POT_WITHOUT_DETENT;
|
||||
potConfig[2] = POT_WITHOUT_DETENT;
|
||||
}
|
||||
|
||||
if (IS_HORUS(board) || IS_TARANIS_X9E(board)) {
|
||||
sliderConfig[0] = SLIDER_WITH_DETENT;
|
||||
sliderConfig[1] = SLIDER_WITH_DETENT;
|
||||
sliderConfig[2] = SLIDER_WITH_DETENT;
|
||||
sliderConfig[3] = SLIDER_WITH_DETENT;
|
||||
}
|
||||
else if (IS_TARANIS(board)) {
|
||||
potConfig[0] = POT_WITH_DETENT;
|
||||
potConfig[1] = POT_WITH_DETENT;
|
||||
else if (IS_TARANIS(board) && !IS_TARANIS_X7(board)) {
|
||||
sliderConfig[0] = SLIDER_WITH_DETENT;
|
||||
sliderConfig[1] = SLIDER_WITH_DETENT;
|
||||
}
|
||||
else {
|
||||
for (int i=0; i<3; i++) {
|
||||
potConfig[i] = POT_WITHOUT_DETENT;
|
||||
}
|
||||
}
|
||||
|
||||
if (IS_ARM(board)) {
|
||||
speakerVolume = 12;
|
||||
|
||||
@@ -80,8 +80,6 @@ enum Capability {
|
||||
Mixes,
|
||||
Timers,
|
||||
TimersName,
|
||||
CustomFunctions,
|
||||
SafetyChannelCustomFunction,
|
||||
VoicesAsNumbers,
|
||||
VoicesMaxLength,
|
||||
MultiLangVoice,
|
||||
@@ -89,7 +87,11 @@ enum Capability {
|
||||
Pots,
|
||||
Sliders,
|
||||
Switches,
|
||||
FactoryInstalledSwitches,
|
||||
SwitchesPositions,
|
||||
NumTrimSwitches,
|
||||
CustomFunctions,
|
||||
SafetyChannelCustomFunction,
|
||||
LogicalSwitches,
|
||||
CustomAndSwitches,
|
||||
HasNegAndSwitches,
|
||||
|
||||
@@ -530,7 +530,7 @@ int OpenTxFirmware::getCapability(Capability capability)
|
||||
else if (IS_TARANIS_X9E(board))
|
||||
return 4;
|
||||
else if (IS_TARANIS(board))
|
||||
return 3; // Taranis has only 2 pots but still has a placeholder in settings for 3 pots
|
||||
return 3;
|
||||
else
|
||||
return 3;
|
||||
case Sliders:
|
||||
@@ -553,15 +553,21 @@ int OpenTxFirmware::getCapability(Capability capability)
|
||||
return 8;
|
||||
else
|
||||
return 7;
|
||||
case SwitchesPositions:
|
||||
case FactoryInstalledSwitches:
|
||||
if (IS_TARANIS_X9E(board))
|
||||
return 18 * 3;
|
||||
else if (IS_TARANIS_X7(board))
|
||||
return 6 * 3;
|
||||
else if (IS_HORUS_OR_TARANIS(board))
|
||||
return 8 * 3;
|
||||
return 8;
|
||||
else
|
||||
return getCapability(Switches);
|
||||
case SwitchesPositions:
|
||||
if (IS_HORUS_OR_TARANIS(board))
|
||||
return getCapability(Switches) * 3;
|
||||
else
|
||||
return 9;
|
||||
case NumTrimSwitches:
|
||||
if (IS_HORUS(board))
|
||||
return 12;
|
||||
else
|
||||
return 8;
|
||||
case CustomFunctions:
|
||||
if (IS_ARM(board))
|
||||
return 64;
|
||||
|
||||
Reference in New Issue
Block a user