[Companion] Refactoring - fixes the X9E=>X7 conversion segfault

This commit is contained in:
Bertrand Songis
2017-01-24 20:08:48 +01:00
parent 8f970fdbbf
commit 57aafeb062
19 changed files with 289 additions and 208 deletions
@@ -818,51 +818,6 @@ QString OpenTxFirmware::getAnalogInputName(unsigned int index)
}
}
Firmware::Switch OpenTxFirmware::getSwitch(unsigned int index)
{
typedef GeneralSettings::SwitchConfig sc;
if (board == BOARD_TARANIS_X7) {
const Switch switches[] = {{sc::SWITCH_3POS, "SA"},
{sc::SWITCH_3POS, "SB"},
{sc::SWITCH_3POS, "SC"},
{sc::SWITCH_3POS, "SD"},
{sc::SWITCH_2POS, "SF"},
{sc::SWITCH_TOGGLE, "SH"}};
return switches[index];
}
else if (IS_HORUS_OR_TARANIS(board)) {
const Switch switches[] = {{sc::SWITCH_3POS, "SA"},
{sc::SWITCH_3POS, "SB"},
{sc::SWITCH_3POS, "SC"},
{sc::SWITCH_3POS, "SD"},
{sc::SWITCH_3POS, "SE"},
{sc::SWITCH_2POS, "SF"},
{sc::SWITCH_3POS, "SG"},
{sc::SWITCH_TOGGLE, "SH"},
{sc::SWITCH_3POS, "SI"},
{sc::SWITCH_3POS, "SJ"},
{sc::SWITCH_3POS, "SK"},
{sc::SWITCH_3POS, "SL"},
{sc::SWITCH_3POS, "SM"},
{sc::SWITCH_3POS, "SN"},
{sc::SWITCH_3POS, "SO"},
{sc::SWITCH_3POS, "SP"},
{sc::SWITCH_3POS, "SQ"},
{sc::SWITCH_3POS, "SR"}};
return switches[index];
}
else {
const Switch switches[] = {{sc::SWITCH_2POS, "THR"},
{sc::SWITCH_2POS, "RUD"},
{sc::SWITCH_2POS, "ELE"},
{sc::SWITCH_3POS, "3POS"},
{sc::SWITCH_2POS, "AIL"},
{sc::SWITCH_2POS, "GEA"},
{sc::SWITCH_TOGGLE, "TRN"}};
return switches[index];
}
}
QTime OpenTxFirmware::getMaxTimerStart()
{
if (IS_HORUS_OR_TARANIS(board))