@@ -23,7 +23,7 @@
|
||||
|
||||
// TODO here we will move a lot of functions from eeprominterface.cpp when no merge risk
|
||||
|
||||
void RawSource::convert(Board::Type before, Board::Type after)
|
||||
RawSource RawSource::convert(Board::Type before, Board::Type after)
|
||||
{
|
||||
if (type == SOURCE_TYPE_STICK && index >= 4 + getBoardCapability(before, Board::Pots)) {
|
||||
// 1st slider alignment
|
||||
@@ -57,11 +57,79 @@ void RawSource::convert(Board::Type before, Board::Type after)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
RawSwitch RawSwitch::convert(Board::Type before, Board::Type after)
|
||||
{
|
||||
// SWI to SWR don't exist on !X9E board
|
||||
if (!IS_TARANIS_X9E(after) && IS_TARANIS_X9E(before)) {
|
||||
if (type == SWITCH_TYPE_SWITCH && index >= 24) {
|
||||
index = index % 24;
|
||||
}
|
||||
}
|
||||
|
||||
// No SE and SG on X7 board
|
||||
if (IS_TARANIS_X7(after)) {
|
||||
if (IS_TARANIS_X9(before) || IS_HORUS(before)) {
|
||||
if (type == SWITCH_TYPE_SWITCH && index >= 18) {
|
||||
index -= 6;
|
||||
}
|
||||
else if (type == SWITCH_TYPE_SWITCH && index >= 12) {
|
||||
index -= 3;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
void ExpoData::convert(Board::Type before, Board::Type after)
|
||||
{
|
||||
swtch.convert(before, after);
|
||||
}
|
||||
|
||||
void MixData::convert(Board::Type before, Board::Type after)
|
||||
{
|
||||
srcRaw.convert(before, after);
|
||||
swtch.convert(before, after);
|
||||
}
|
||||
|
||||
void LogicalSwitchData::convert(Board::Type before, Board::Type after)
|
||||
{
|
||||
CSFunctionFamily family = getFunctionFamily();
|
||||
switch(family) {
|
||||
case LS_FAMILY_VOFS:
|
||||
val1 = RawSource(val1).convert(before, after).toValue();
|
||||
break;
|
||||
case LS_FAMILY_STICKY:
|
||||
case LS_FAMILY_VBOOL:
|
||||
val1 = RawSwitch(val1).convert(before, after).toValue();
|
||||
val2 = RawSwitch(val2).convert(before, after).toValue();
|
||||
break;
|
||||
case LS_FAMILY_EDGE:
|
||||
val1 = RawSwitch(val1).convert(before, after).toValue();
|
||||
break;
|
||||
case LS_FAMILY_VCOMP:
|
||||
val1 = RawSource(val1).convert(before, after).toValue();
|
||||
val2 = RawSource(val2).convert(before, after).toValue();
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
andsw = RawSwitch(andsw).convert(before, after).toValue();
|
||||
}
|
||||
|
||||
void CustomFunctionData::convert(Board::Type before, Board::Type after)
|
||||
{
|
||||
swtch.convert(before, after);
|
||||
}
|
||||
|
||||
void FlightModeData::convert(Board::Type before, Board::Type after)
|
||||
{
|
||||
swtch.convert(before, after);
|
||||
}
|
||||
|
||||
void ModelData::convert(Board::Type before, Board::Type after)
|
||||
@@ -70,11 +138,37 @@ void ModelData::convert(Board::Type before, Board::Type after)
|
||||
for (int i=0; i<CPN_MAX_MIXERS; i++) {
|
||||
mixData[i].convert(before, after);
|
||||
}
|
||||
|
||||
for (int i=0; i<CPN_MAX_EXPOS; i++) {
|
||||
expoData[i].convert(before, after);
|
||||
}
|
||||
|
||||
for (int i=0; i<CPN_MAX_LOGICAL_SWITCHES; i++) {
|
||||
logicalSw[i].convert(before, after);
|
||||
}
|
||||
|
||||
for (int i=0; i<CPN_MAX_SPECIAL_FUNCTIONS; i++) {
|
||||
customFn[i].convert(before, after);
|
||||
}
|
||||
|
||||
for (int i=0; i<CPN_MAX_FLIGHT_MODES; i++) {
|
||||
flightModeData[i].convert(before, after);
|
||||
}
|
||||
}
|
||||
|
||||
void GeneralSettings::convert(Board::Type before, Board::Type after)
|
||||
{
|
||||
// Here we can add explicit conversions when moving from one board to another
|
||||
|
||||
// No SE and SG on X7 board
|
||||
if (IS_TARANIS_X7(after)) {
|
||||
if (IS_TARANIS_X9(before) || IS_HORUS(before)) {
|
||||
switchConfig[4] = switchConfig[5];
|
||||
memcpy(switchName[4], switchName[5], sizeof(switchName[4]));
|
||||
switchConfig[5] = switchConfig[7];
|
||||
memcpy(switchName[5], switchName[7], sizeof(switchName[5]));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void RadioData::setCurrentModel(unsigned int index)
|
||||
|
||||
Reference in New Issue
Block a user