1
0
Fork 0
mirror of https://github.com/opentx/opentx.git synced 2025-07-20 23:05:12 +03:00

EEPROM support in Companion for the 6pos pots on Taranis

This commit is contained in:
Bertrand Songis 2014-01-31 17:19:21 +01:00
parent 1cef62df48
commit 8ef1456fe9
6 changed files with 82 additions and 33 deletions

View file

@ -842,6 +842,8 @@ void populateSwitchCB(QComboBox *b, const RawSwitch & value, unsigned long attr,
return;
}
#if 0
// TODO check ... I removed negative toggle switches in the FW, no?
if (attr & POPULATE_MSWITCHES) {
if (attr & POPULATE_ONOFF) {
item = RawSwitch(SWITCH_TYPE_ONM, 1);
@ -860,6 +862,7 @@ void populateSwitchCB(QComboBox *b, const RawSwitch & value, unsigned long attr,
if (item == value) b->setCurrentIndex(b->count()-1);
}
}
#endif
if (attr & POPULATE_ONOFF) {
item = RawSwitch(SWITCH_TYPE_OFF);
@ -905,6 +908,14 @@ void populateSwitchCB(QComboBox *b, const RawSwitch & value, unsigned long attr,
if (item == value) b->setCurrentIndex(b->count()-1);
}
if (IS_TARANIS(GetEepromInterface()->getBoard())) {
for (int i=0; i<GetEepromInterface()->getCapability(MultiposPots) * GetEepromInterface()->getCapability(MultiposPotsPositions); i++) {
item = RawSwitch(SWITCH_TYPE_MULTIPOS_POT, i);
b->addItem(item.toString(), item.toValue());
if (item == value) b->setCurrentIndex(b->count()-1);
}
}
if (attr & POPULATE_ONOFF) {
item = RawSwitch(SWITCH_TYPE_ON);
b->addItem(item.toString(), item.toValue());