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;
|
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;
|
switchConfig[i] = GetCurrentFirmware()->getSwitch(i).type;
|
||||||
}
|
}
|
||||||
|
|
||||||
BoardEnum board = GetEepromInterface()->getBoard();
|
BoardEnum board = GetEepromInterface()->getBoard();
|
||||||
if (board == BOARD_HORUS) {
|
if (IS_HORUS(board)) {
|
||||||
potConfig[0] = POT_WITH_DETENT;
|
potConfig[0] = POT_WITH_DETENT;
|
||||||
potConfig[1] = POT_MULTIPOS_SWITCH;
|
potConfig[1] = POT_MULTIPOS_SWITCH;
|
||||||
potConfig[2] = POT_WITH_DETENT;
|
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[0] = SLIDER_WITH_DETENT;
|
||||||
sliderConfig[1] = SLIDER_WITH_DETENT;
|
sliderConfig[1] = SLIDER_WITH_DETENT;
|
||||||
sliderConfig[2] = SLIDER_WITH_DETENT;
|
sliderConfig[2] = SLIDER_WITH_DETENT;
|
||||||
sliderConfig[3] = SLIDER_WITH_DETENT;
|
sliderConfig[3] = SLIDER_WITH_DETENT;
|
||||||
}
|
}
|
||||||
else if (IS_TARANIS(board)) {
|
else if (IS_TARANIS(board) && !IS_TARANIS_X7(board)) {
|
||||||
potConfig[0] = POT_WITH_DETENT;
|
|
||||||
potConfig[1] = POT_WITH_DETENT;
|
|
||||||
sliderConfig[0] = SLIDER_WITH_DETENT;
|
sliderConfig[0] = SLIDER_WITH_DETENT;
|
||||||
sliderConfig[1] = 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)) {
|
if (IS_ARM(board)) {
|
||||||
speakerVolume = 12;
|
speakerVolume = 12;
|
||||||
|
|||||||
@@ -80,8 +80,6 @@ enum Capability {
|
|||||||
Mixes,
|
Mixes,
|
||||||
Timers,
|
Timers,
|
||||||
TimersName,
|
TimersName,
|
||||||
CustomFunctions,
|
|
||||||
SafetyChannelCustomFunction,
|
|
||||||
VoicesAsNumbers,
|
VoicesAsNumbers,
|
||||||
VoicesMaxLength,
|
VoicesMaxLength,
|
||||||
MultiLangVoice,
|
MultiLangVoice,
|
||||||
@@ -89,7 +87,11 @@ enum Capability {
|
|||||||
Pots,
|
Pots,
|
||||||
Sliders,
|
Sliders,
|
||||||
Switches,
|
Switches,
|
||||||
|
FactoryInstalledSwitches,
|
||||||
SwitchesPositions,
|
SwitchesPositions,
|
||||||
|
NumTrimSwitches,
|
||||||
|
CustomFunctions,
|
||||||
|
SafetyChannelCustomFunction,
|
||||||
LogicalSwitches,
|
LogicalSwitches,
|
||||||
CustomAndSwitches,
|
CustomAndSwitches,
|
||||||
HasNegAndSwitches,
|
HasNegAndSwitches,
|
||||||
|
|||||||
@@ -530,7 +530,7 @@ int OpenTxFirmware::getCapability(Capability capability)
|
|||||||
else if (IS_TARANIS_X9E(board))
|
else if (IS_TARANIS_X9E(board))
|
||||||
return 4;
|
return 4;
|
||||||
else if (IS_TARANIS(board))
|
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
|
else
|
||||||
return 3;
|
return 3;
|
||||||
case Sliders:
|
case Sliders:
|
||||||
@@ -553,15 +553,21 @@ int OpenTxFirmware::getCapability(Capability capability)
|
|||||||
return 8;
|
return 8;
|
||||||
else
|
else
|
||||||
return 7;
|
return 7;
|
||||||
case SwitchesPositions:
|
case FactoryInstalledSwitches:
|
||||||
if (IS_TARANIS_X9E(board))
|
if (IS_TARANIS_X9E(board))
|
||||||
return 18 * 3;
|
return 8;
|
||||||
else if (IS_TARANIS_X7(board))
|
else
|
||||||
return 6 * 3;
|
return getCapability(Switches);
|
||||||
else if (IS_HORUS_OR_TARANIS(board))
|
case SwitchesPositions:
|
||||||
return 8 * 3;
|
if (IS_HORUS_OR_TARANIS(board))
|
||||||
|
return getCapability(Switches) * 3;
|
||||||
else
|
else
|
||||||
return 9;
|
return 9;
|
||||||
|
case NumTrimSwitches:
|
||||||
|
if (IS_HORUS(board))
|
||||||
|
return 12;
|
||||||
|
else
|
||||||
|
return 8;
|
||||||
case CustomFunctions:
|
case CustomFunctions:
|
||||||
if (IS_ARM(board))
|
if (IS_ARM(board))
|
||||||
return 64;
|
return 64;
|
||||||
|
|||||||
Reference in New Issue
Block a user