From c473b8e105563c72713a291d49b1e160d4b53e64 Mon Sep 17 00:00:00 2001 From: Bertrand Songis Date: Wed, 5 Feb 2014 22:31:43 +0100 Subject: [PATCH] Issue #592 - Support for Sticky Switches in Companion --- companion/src/comparedialog.cpp | 8 +- companion/src/eepromimportexport.h | 19 +- companion/src/eeprominterface.cpp | 271 +++++++-- companion/src/eeprominterface.h | 102 ++-- companion/src/firmwares/er9x/er9xeeprom.cpp | 8 +- .../src/firmwares/er9x/er9xinterface.cpp | 2 +- .../src/firmwares/ersky9x/ersky9xeeprom.cpp | 4 +- .../firmwares/ersky9x/ersky9xinterface.cpp | 4 +- .../firmwares/opentx/open9xSky9xeeprom.cpp | 10 +- .../firmwares/opentx/open9xStockeeprom.cpp | 10 +- .../src/firmwares/opentx/opentxeeprom.cpp | 557 +++++++++++------- companion/src/helpers.cpp | 276 +-------- companion/src/helpers.h | 6 - companion/src/modeledit/curves.cpp | 7 + companion/src/modeledit/customfunctions.cpp | 2 +- companion/src/modeledit/customswitches.cpp | 65 +- companion/src/modeledit/customswitches.h | 3 + companion/src/modeledit/telemetry.cpp | 2 +- companion/src/printdialog.cpp | 4 +- radio/src/translations/cz.h.txt | 4 +- radio/src/translations/de.h.txt | 4 +- radio/src/translations/en.h | 4 +- radio/src/translations/es.h.txt | 4 +- radio/src/translations/fr.h.txt | 4 +- radio/src/translations/it.h.txt | 2 +- radio/src/translations/pl.h.txt | 4 +- radio/src/translations/pt.h.txt | 4 +- radio/src/translations/se.h.txt | 4 +- 28 files changed, 767 insertions(+), 627 deletions(-) diff --git a/companion/src/comparedialog.cpp b/companion/src/comparedialog.cpp index e24f636c4..9a50f283c 100644 --- a/companion/src/comparedialog.cpp +++ b/companion/src/comparedialog.cpp @@ -1040,8 +1040,8 @@ void compareDialog::printSwitches() str.append("

"+tr("Logical Switches")+"

"); str.append(""); for (int i=0; igetCapability(CustomSwitches); i++) { - QString sw1 = getCustomSwitchStr(&g_model1->customSw[i], *g_model1); - QString sw2 = getCustomSwitchStr(&g_model2->customSw[i], *g_model2); + QString sw1 = g_model1->customSw[i].toString(*g_model1); + QString sw2 = g_model2->customSw[i].toString(*g_model2); if (!(sw1.isEmpty() && sw2.isEmpty())) { str.append(""); color=getColor1(sw1,sw2); @@ -1095,7 +1095,7 @@ void compareDialog::printFSwitches() str.append(""); if (g_model1->funcSw[i].swtch.type) { str.append(doTC(g_model1->funcSw[i].swtch.toString(),color1)); - str.append(doTC(getFuncName(g_model1->funcSw[i].func),color1)); + str.append(doTC(g_model1->funcSw[i].funcToString(),color1)); str.append(doTC(g_model1->funcSw[i].paramToString(),color1)); int index=g_model1->funcSw[i].func; if (index==FuncPlaySound || index==FuncPlayHaptic || index==FuncPlayValue || index==FuncPlayPrompt || index==FuncPlayBoth || index==FuncBackgroundMusic) { @@ -1114,7 +1114,7 @@ void compareDialog::printFSwitches() str.append(doTC(tr("CF")+QString("%1").arg(i+1),"",true)); if (g_model2->funcSw[i].swtch.type) { str.append(doTC(g_model2->funcSw[i].swtch.toString(),color2)); - str.append(doTC(getFuncName(g_model2->funcSw[i].func),color2)); + str.append(doTC(g_model2->funcSw[i].funcToString(),color2)); str.append(doTC(g_model2->funcSw[i].paramToString(),color2)); int index=g_model2->funcSw[i].func; if (index==FuncPlaySound || index==FuncPlayHaptic || index==FuncPlayValue || index==FuncPlayPrompt || index==FuncPlayBoth || index==FuncBackgroundMusic) { diff --git a/companion/src/eepromimportexport.h b/companion/src/eepromimportexport.h index ed5ab9ff5..91eda318c 100644 --- a/companion/src/eepromimportexport.h +++ b/companion/src/eepromimportexport.h @@ -93,6 +93,17 @@ class DataField { const char *name; }; +class ProxyField: public DataField { + public: + ProxyField(): + DataField("Proxy") + { + } + + virtual DataField * getField() = 0; + +}; + template class UnsignedField: public DataField { public: @@ -273,9 +284,10 @@ class SpareBitsField: public UnsignedField { template class CharField: public DataField { public: - CharField(char *field): + CharField(char *field, bool truncate=true): DataField("Char"), - field(field) + field(field), + truncate(truncate) { } @@ -283,7 +295,7 @@ class CharField: public DataField { { output.resize(N*8); int b = 0; - int len = strlen(field); + int len = truncate ? strlen(field) : N; for (int i=0; i=len ? 0 : field[i]); for (int j=0; j<8; j++, b++) { @@ -313,6 +325,7 @@ class CharField: public DataField { protected: char * field; + bool truncate; }; int8_t char2idx(char c); diff --git a/companion/src/eeprominterface.cpp b/companion/src/eeprominterface.cpp index cf5b22675..cd6843d5a 100644 --- a/companion/src/eeprominterface.cpp +++ b/companion/src/eeprominterface.cpp @@ -280,45 +280,8 @@ QString RawSwitch::toString() return CHECK_IN_ARRAY(multiposPots, index); case SWITCH_TYPE_ON: return QObject::tr("ON"); - case SWITCH_TYPE_ONM: - if (index==0) { - return QObject::tr("ONE"); - } - else if (index==1) { - return QObject::tr("!ONE"); - } - break; - case SWITCH_TYPE_TRN: - if (index==0) { - if (IS_TARANIS(GetEepromInterface()->getBoard())) - return SwitchDn('H')+"s"; - else - return QObject::tr("TRNs"); - } else if (index==1) { - if (IS_TARANIS(GetEepromInterface()->getBoard())) - return SwitchDn('H')+"l"; - else - return QObject::tr("TRNl"); - } - break; - case SWITCH_TYPE_REA: - if (index==0) { - if (GetEepromInterface()->getBoard() == BOARD_SKY9X) - return QObject::tr("REAs"); - } else if (index==1) { - if (GetEepromInterface()->getBoard() == BOARD_SKY9X) - return QObject::tr("REAl"); - } - break; case SWITCH_TYPE_OFF: return QObject::tr("OFF"); - case SWITCH_TYPE_MOMENT_SWITCH: - if (IS_TARANIS(GetEepromInterface()->getBoard())) - return index > 0 ? CHECK_IN_ARRAY(switchesX9D, index-1)+QString("t") : QString("!")+CHECK_IN_ARRAY(switchesX9D, -index-1)+QString("t"); - else - return index > 0 ? CHECK_IN_ARRAY(switches9X, index-1)+QString("t") : QString("!")+CHECK_IN_ARRAY(switches9X, -index-1)+QString("t"); - case SWITCH_TYPE_MOMENT_VIRTUAL: - return index > 0 ? CHECK_IN_ARRAY(virtualSwitches, index-1)+QString("t") : QString("!")+CHECK_IN_ARRAY(virtualSwitches, -index-1)+QString("t"); default: break; } @@ -345,6 +308,170 @@ QString CurveReference::toString() } } +CSFunctionFamily CustomSwData::getFunctionFamily() +{ + if (func == CS_FN_TIMER) + return CS_FAMILY_TIMER; + else if (func == CS_FN_STICKY) + return CS_FAMILY_STICKY; + else if (func < CS_FN_AND || func > CS_FN_ELESS) + return CS_FAMILY_VOFS; + else if (func < CS_FN_EQUAL) + return CS_FAMILY_VBOOL; + else + return CS_FAMILY_VCOMP; +} + +QString CustomSwData::funcToString() +{ + switch (func) { + case CS_FN_OFF: + return QObject::tr("---"); + case CS_FN_VPOS: + return QObject::tr("a>x"); + case CS_FN_VNEG: + return QObject::tr("ax"); + case CS_FN_ANEG: + return QObject::tr("|a|b"); + case CS_FN_LESS: + return QObject::tr("a=b"); + case CS_FN_ELESS: + return QObject::tr("a<=b"); + case CS_FN_DPOS: + return QObject::tr("d>=x"); + case CS_FN_DAPOS: + return QObject::tr("|d|>=x"); + case CS_FN_VEQUAL: + return QObject::tr("a~x"); + case CS_FN_TIMER: + return QObject::tr("Timer"); + case CS_FN_STICKY: + return QObject::tr("Sticky"); + default: + return QObject::tr("Unknown"); + } +} + +QString CustomSwData::toString(const ModelData & model) +{ + QString result = ""; + + if (!func) + return result; + + if (andsw!=0) { + result +="( "; + } + switch (getFunctionFamily()) { + case CS_FAMILY_STICKY: + result = QObject::tr("STICKY(%1 , %2)").arg(RawSwitch(val1).toString()).arg(RawSwitch(val2).toString()); + break; + case CS_FAMILY_TIMER: + result = QObject::tr("TIMER(%1 , %2)").arg(ValToTim(val1)).arg(ValToTim(val2)); + break; + case CS_FAMILY_VOFS: { + RawSource source = RawSource(val1, &model); + RawSourceRange range = source.getRange(); + if (val1) + result += source.toString(); + else + result += "0"; + result.remove(" "); + if (func == CS_FN_APOS || func == CS_FN_ANEG) + result = "|" + result + "|"; + else if (func == CS_FN_DAPOS) + result = "|d(" + result + ")|"; + else if (func == CS_FN_DPOS) result = "d(" + result + ")"; + if (func == CS_FN_APOS || func == CS_FN_VPOS || func == CS_FN_DAPOS || func == CS_FN_DPOS) + result += " > "; + else if (func == CS_FN_ANEG || func == CS_FN_VNEG) + result += " < "; + result += QString::number(range.step * (val2 /*TODO+ source.getRawOffset(model)*/) + range.offset); + break; + } + case CS_FAMILY_VBOOL: + result = RawSwitch(val1).toString(); + switch (func) { + case CS_FN_AND: + result += " AND "; + break; + case CS_FN_OR: + result += " OR "; + break; + case CS_FN_XOR: + result += " XOR "; + break; + default: + break; + } + result += RawSwitch(val2).toString(); + break; + + case CS_FAMILY_VCOMP: + if (val1) + result += RawSource(val1).toString(); + else + result += "0"; + switch (func) { + case CS_FN_EQUAL: + result += " = "; + break; + case CS_FN_NEQUAL: + result += " != "; + break; + case CS_FN_GREATER: + result += " > "; + break; + case CS_FN_LESS: + result += " < "; + break; + case CS_FN_EGREATER: + result += " >= "; + break; + case CS_FN_ELESS: + result += " <= "; + break; + default: + break; + } + if (val2) + result += RawSource(val2).toString(); + else + result += "0"; + break; + } + + if (andsw!=0) { + result +=" ) AND "; + result += RawSwitch(andsw).toString(); + } + + if (GetEepromInterface()->getCapability(CustomSwitchesExt)) { + if (delay) + result += QObject::tr(" Delay %1 sec").arg(delay/2.0); + if (duration) + result += QObject::tr(" Duration %1 sec").arg(duration/2.0); + } + + return result; +} + #if 0 QStringList FuncSwData::toStringList() { @@ -416,10 +543,69 @@ QStringList FuncSwData::toStringList() break; } } + + if (func==FuncPlaySound || func==FuncPlayHaptic || func==FuncPlayValue || func==FuncPlayPrompt || func==FuncPlayBoth || func==FuncBackgroundMusic) { + str.append(doTC(QString("%1").arg(g_model->funcSw[i].repeatParam),"green")); + } else { + str.append(doTC( " ","green")); + } + if ((index<=FuncInstantTrim) || (index>FuncBackgroundMusicPause)) { + str.append(doTC((g_model->funcSw[i].enabled ? "ON" : "OFF"),"green")); + } else { + str.append(doTC( "---","green")); + } + return result; } #endif +QString FuncSwData::funcToString() +{ + if (func >= FuncSafetyCh1 && func <= FuncSafetyCh32) + return QObject::tr("Safety %1").arg(RawSource(SOURCE_TYPE_CH, func).toString()); + else if (func == FuncTrainer) + return QObject::tr("Trainer"); + else if (func == FuncTrainerRUD) + return QObject::tr("Trainer RUD"); + else if (func == FuncTrainerELE) + return QObject::tr("Trainer ELE"); + else if (func == FuncTrainerTHR) + return QObject::tr("Trainer THR"); + else if (func == FuncTrainerAIL) + return QObject::tr("Trainer AIL"); + else if (func == FuncInstantTrim) + return QObject::tr("Instant Trim"); + else if (func == FuncPlaySound) + return QObject::tr("Play Sound"); + else if (func == FuncPlayHaptic) + return QObject::tr("Play Haptic"); + else if (func == FuncReset) + return QObject::tr("Reset"); + else if (func == FuncVario) + return QObject::tr("Vario"); + else if (func == FuncPlayPrompt) + return QObject::tr("Play Track"); + else if (func == FuncPlayBoth) + return QObject::tr("Play Both"); + else if (func == FuncPlayValue) + return QObject::tr("Play Value"); + else if (func == FuncLogs) + return QObject::tr("Start Logs"); + else if (func == FuncVolume) + return QObject::tr("Volume"); + else if (func == FuncBacklight) + return QObject::tr("Backlight"); + else if (func == FuncBackgroundMusic) + return QObject::tr("Background Music"); + else if (func == FuncBackgroundMusicPause) + return QObject::tr("Background Music Pause"); + else if (func >= FuncAdjustGV1 && func <= FuncAdjustGVLast) + return QObject::tr("Adjust GV%1").arg(func-FuncAdjustGV1+1); + else { + return QString("???"); // Highlight unknown functions with output of question marks.(BTW should not happen that we do not know what a function is) + } +} + QString FuncSwData::paramToString() { QStringList qs; @@ -488,6 +674,17 @@ QString FuncSwData::paramToString() return ""; } +QString FuncSwData::repeatToString() +{ + if (repeatParam==0) { + return QObject::tr("No repeat"); + } + else { + unsigned int step = IS_ARM(GetEepromInterface()->getBoard()) ? 5 : 10; + return QObject::tr("%1 sec").arg(step*repeatParam); + } +} + GeneralSettings::GeneralSettings() { memset(this, 0, sizeof(GeneralSettings)); diff --git a/companion/src/eeprominterface.h b/companion/src/eeprominterface.h index 77fe50322..9525b47d6 100644 --- a/companion/src/eeprominterface.h +++ b/companion/src/eeprominterface.h @@ -146,44 +146,6 @@ enum EnumKeys { #endif }; -enum CSFunction { - CS_FN_OFF, - CS_FN_VPOS, - CS_FN_VNEG, - CS_FN_APOS, - CS_FN_ANEG, - CS_FN_AND, - CS_FN_OR, - CS_FN_XOR, - CS_FN_EQUAL, - CS_FN_NEQUAL, - CS_FN_GREATER, - CS_FN_LESS, - CS_FN_EGREATER, - CS_FN_ELESS, - CS_FN_DPOS, - CS_FN_DAPOS, - CS_FN_VEQUAL, // added at the end to avoid everything renumbered - CS_FN_TIM, - CS_FN_MAXF -}; - -enum CSFunctionFamily { - CS_FAMILY_VOFS, - CS_FAMILY_VBOOL, - CS_FAMILY_VCOMP, - CS_FAMILY_TIMERS -}; - -inline CSFunctionFamily getCSFunctionFamily(int fn) -{ - if (fn==CS_FN_TIM) { - return (CS_FAMILY_TIMERS); - } else { - return ((fnCS_FN_ELESS) ? CS_FAMILY_VOFS : (fnfunc = func; + } unsigned int func; + int val1; + int val2; unsigned int delay; unsigned int duration; unsigned int andsw; void clear() { memset(this, 0, sizeof(CustomSwData)); } + CSFunctionFamily getFunctionFamily(); + QString funcToString(); + QString toString(const ModelData & model); }; enum AssignFunc { @@ -656,7 +651,7 @@ enum AssignFunc { class FuncSwData { // Function Switches data public: - FuncSwData() { clear(); } + FuncSwData(AssignFunc func=FuncSafetyCh1) { clear(); this->func = func; } RawSwitch swtch; AssignFunc func; int param; @@ -665,7 +660,9 @@ class FuncSwData { // Function Switches data unsigned int adjustMode; int repeatParam; void clear() { memset(this, 0, sizeof(FuncSwData)); } + QString funcToString(); QString paramToString(); + QString repeatToString(); QStringList toStringList(); }; @@ -807,12 +804,9 @@ enum TimerMode { TMRMODE_THp, TMRMODE_THt, TMRMODE_FIRST_SWITCH, - TMRMODE_FIRST_MOMENT_SWITCH = TMRMODE_FIRST_SWITCH+64, - TMRMODE_FIRST_CHPERC = TMRMODE_FIRST_MOMENT_SWITCH+64, - + TMRMODE_FIRST_CHPERC = TMRMODE_FIRST_SWITCH+64, TMRMODE_FIRST_NEG_SWITCH=-TMRMODE_FIRST_SWITCH, - TMRMODE_FIRST_NEG_MOMENT_SWITCH=-TMRMODE_FIRST_MOMENT_SWITCH, - /* sw/!sw, !m_sw/!m_sw */ + /* sw/!sw, !m_sw/!m_sw */ }; class TimerData { @@ -1174,7 +1168,7 @@ inline void applyStickModeToModel(ModelData &model, unsigned int mode) // virtual switches for (int i=0; i 0 ? sw-22 : sw+22); + return RawSwitch(SWITCH_TYPE_SWITCH, sw > 0 ? sw-22 : sw+22); else - return RawSwitch(SWITCH_TYPE_MOMENT_VIRTUAL, sw > 0 ? sw-22-9 : sw+22+9); + return RawSwitch(SWITCH_TYPE_VIRTUAL, sw > 0 ? sw-22-9 : sw+22+9); } t_Er9xTrainerMix::t_Er9xTrainerMix() @@ -338,7 +338,7 @@ t_Er9xFrSkyData::operator FrSkyData () TimerMode getEr9xTimerMode(int mode) { if (mode <= -33) - return TimerMode(TMRMODE_FIRST_NEG_MOMENT_SWITCH+(mode+33)); + return TimerMode(TMRMODE_FIRST_NEG_SWITCH+(mode+33)); else if (mode <= -1) return TimerMode(TMRMODE_FIRST_NEG_SWITCH+(mode+1)); else if (mode < 16) @@ -346,7 +346,7 @@ TimerMode getEr9xTimerMode(int mode) else if (mode < 16+21) return TimerMode(TMRMODE_FIRST_SWITCH+(mode-16)); else - return TimerMode(TMRMODE_FIRST_MOMENT_SWITCH+(mode-16-21)); + return TimerMode(TMRMODE_FIRST_SWITCH+(mode-16-21)); } t_Er9xModelData::operator ModelData () diff --git a/companion/src/firmwares/er9x/er9xinterface.cpp b/companion/src/firmwares/er9x/er9xinterface.cpp index 2ddb828e6..9bbf4f0b3 100644 --- a/companion/src/firmwares/er9x/er9xinterface.cpp +++ b/companion/src/firmwares/er9x/er9xinterface.cpp @@ -75,7 +75,7 @@ inline void applyStickModeToModel(Er9xModelData & model, unsigned int mode) for (int i=0; i 0 ? sw-34 : sw+34); + return RawSwitch(SWITCH_TYPE_SWITCH, sw > 0 ? sw-34 : sw+34); else - return RawSwitch(SWITCH_TYPE_MOMENT_VIRTUAL, sw > 0 ? sw-34-9 : sw+34+9); + return RawSwitch(SWITCH_TYPE_VIRTUAL, sw > 0 ? sw-34-9 : sw+34+9); } t_Ersky9xTrainerMix::t_Ersky9xTrainerMix() diff --git a/companion/src/firmwares/ersky9x/ersky9xinterface.cpp b/companion/src/firmwares/ersky9x/ersky9xinterface.cpp index 8405bff8f..6ee792a51 100644 --- a/companion/src/firmwares/ersky9x/ersky9xinterface.cpp +++ b/companion/src/firmwares/ersky9x/ersky9xinterface.cpp @@ -74,7 +74,7 @@ inline void applyStickModeToModel(Ersky9xModelData_v10 & model, unsigned int mod for (int i=0; i 0 ? sw-42 : sw+42); + return RawSwitch(SWITCH_TYPE_SWITCH, sw > 0 ? sw-42 : sw+42); else - return RawSwitch(SWITCH_TYPE_MOMENT_VIRTUAL, sw > 0 ? sw-42-9 : sw+42+9); + return RawSwitch(SWITCH_TYPE_VIRTUAL, sw > 0 ? sw-42-9 : sw+42+9); } RawSource open9xArm208ToSource(int8_t value) @@ -126,7 +126,7 @@ t_Open9xArmTimerData_v202::operator TimerData () TimerData c9x; if (mode <= -42) - c9x.mode = TimerMode(TMRMODE_FIRST_NEG_MOMENT_SWITCH+(mode+22)); + c9x.mode = TimerMode(TMRMODE_FIRST_NEG_SWITCH+(mode+22)); else if (mode <= -1) c9x.mode = TimerMode(TMRMODE_FIRST_NEG_SWITCH+(mode+1)); else if (mode < 5) @@ -134,7 +134,7 @@ t_Open9xArmTimerData_v202::operator TimerData () else if (mode < 5+41) c9x.mode = TimerMode(TMRMODE_FIRST_SWITCH+(mode-5)); else - c9x.mode = TimerMode(TMRMODE_FIRST_MOMENT_SWITCH+(mode-5-21)); + c9x.mode = TimerMode(TMRMODE_FIRST_SWITCH+(mode-5-21)); c9x.val = val; c9x.persistent = false; diff --git a/companion/src/firmwares/opentx/open9xStockeeprom.cpp b/companion/src/firmwares/opentx/open9xStockeeprom.cpp index 18a203700..1791d78cd 100644 --- a/companion/src/firmwares/opentx/open9xStockeeprom.cpp +++ b/companion/src/firmwares/opentx/open9xStockeeprom.cpp @@ -74,13 +74,13 @@ RawSwitch open9xStockToSwitch(int8_t sw) else if (sw == 22) return RawSwitch(SWITCH_TYPE_ON); else if (sw == 44) - return RawSwitch(SWITCH_TYPE_ONM); + return RawSwitch(SWITCH_TYPE_ON); else if (sw == -22) return RawSwitch(SWITCH_TYPE_OFF); else if (swa <= 22+9) - return RawSwitch(SWITCH_TYPE_MOMENT_SWITCH, sw > 0 ? sw-22 : sw+22); + return RawSwitch(SWITCH_TYPE_SWITCH, sw > 0 ? sw-22 : sw+22); else - return RawSwitch(SWITCH_TYPE_MOMENT_VIRTUAL, sw > 0 ? sw-22-9 : sw+22+9); + return RawSwitch(SWITCH_TYPE_VIRTUAL, sw > 0 ? sw-22-9 : sw+22+9); } t_Open9xExpoData_v201::operator ExpoData () @@ -713,7 +713,7 @@ t_Open9xTimerData_v202::operator TimerData () TimerData c9x; if (mode <= -22) - c9x.mode = TimerMode(TMRMODE_FIRST_NEG_MOMENT_SWITCH+(mode+22)); + c9x.mode = TimerMode(TMRMODE_FIRST_NEG_SWITCH+(mode+22)); else if (mode <= -1) c9x.mode = TimerMode(TMRMODE_FIRST_NEG_SWITCH+(mode+1)); else if (mode < 5) @@ -721,7 +721,7 @@ t_Open9xTimerData_v202::operator TimerData () else if (mode < 5+21) c9x.mode = TimerMode(TMRMODE_FIRST_SWITCH+(mode-5)); else - c9x.mode = TimerMode(TMRMODE_FIRST_MOMENT_SWITCH+(mode-5-21)); + c9x.mode = TimerMode(TMRMODE_FIRST_SWITCH+(mode-5-21)); c9x.val = val; c9x.persistent = false; diff --git a/companion/src/firmwares/opentx/opentxeeprom.cpp b/companion/src/firmwares/opentx/opentxeeprom.cpp index f74fb1106..b0d2cab59 100644 --- a/companion/src/firmwares/opentx/opentxeeprom.cpp +++ b/companion/src/firmwares/opentx/opentxeeprom.cpp @@ -67,23 +67,20 @@ class SwitchesConversionTable: public ConversionTable { addConversion(RawSwitch(SWITCH_TYPE_OFF), -val); addConversion(RawSwitch(SWITCH_TYPE_ON), val++); - for (int i=1; i<=MAX_SWITCHES_POSITION(board); i++) { - int s = switchIndex(i, board, version); - // addConversion(RawSwitch(SWITCH_TYPE_MOMENT_SWITCH, -s), -val); - addConversion(RawSwitch(SWITCH_TYPE_MOMENT_SWITCH, s), val++); - } + if (version < 216) { + // previous "moment" switches + for (int i=1; i<=MAX_SWITCHES_POSITION(board); i++) { + int s = switchIndex(i, board, version); + addConversion(RawSwitch(SWITCH_TYPE_SWITCH, s), val++); + } - for (int i=1; i<=MAX_CUSTOM_SWITCHES(board, version); i++) { - // addConversion(RawSwitch(SWITCH_TYPE_MOMENT_VIRTUAL, -i), -val); - addConversion(RawSwitch(SWITCH_TYPE_MOMENT_VIRTUAL, i), val++); - } + for (int i=1; i<=MAX_CUSTOM_SWITCHES(board, version); i++) { + addConversion(RawSwitch(SWITCH_TYPE_VIRTUAL, i), val++); + } - // addConversion(RawSwitch(SWITCH_TYPE_ONM, 1 ), -val); - addConversion(RawSwitch(SWITCH_TYPE_ONM, 0 ), val++); - addConversion(RawSwitch(SWITCH_TYPE_TRN, 0), val++); - addConversion(RawSwitch(SWITCH_TYPE_TRN, 1), val++); - addConversion(RawSwitch(SWITCH_TYPE_REA, 0), val++); - addConversion(RawSwitch(SWITCH_TYPE_REA, 1), val++); + // previous "One" switch + addConversion(RawSwitch(SWITCH_TYPE_ON), val++); + } } protected: @@ -282,9 +279,9 @@ class TimerModeConversionTable: public ConversionTable { for (int i=0; i= 216) + addConversion(CS_FN_STICKY, val++); } }; @@ -1180,40 +1179,40 @@ class CustomSwitchField: public TransformedField { virtual void beforeExport() { - v1 = csw.val1; - v2 = csw.val2; - - if ((csw.func >= CS_FN_VPOS && csw.func <= CS_FN_ANEG) || (csw.func >= CS_FN_EQUAL && csw.func!=CS_FN_TIM)) { - sourcesConversionTable->exportValue(csw.val1, v1); - } - - if (csw.func >= CS_FN_EQUAL && csw.func <= CS_FN_ELESS) { - sourcesConversionTable->exportValue(csw.val2, v2); - } - - if (csw.func >= CS_FN_AND && csw.func <= CS_FN_XOR) { + if ((csw.func >= CS_FN_AND && csw.func <= CS_FN_XOR) || csw.func == CS_FN_STICKY) { switchesConversionTable->exportValue(csw.val1, v1); switchesConversionTable->exportValue(csw.val2, v2); } + else if (csw.func >= CS_FN_EQUAL && csw.func <= CS_FN_ELESS) { + sourcesConversionTable->exportValue(csw.val1, v1); + sourcesConversionTable->exportValue(csw.val2, v2); + } + else { + if ((csw.func >= CS_FN_VPOS && csw.func <= CS_FN_ANEG) || (csw.func >= CS_FN_EQUAL && csw.func!=CS_FN_TIMER)) + sourcesConversionTable->exportValue(csw.val1, v1); + else + v1 = csw.val1; + v2 = csw.val2; + } } virtual void afterImport() { - csw.val1 = v1; - csw.val2 = v2; - - if ((csw.func >= CS_FN_VPOS && csw.func <= CS_FN_ANEG) || (csw.func >= CS_FN_EQUAL && csw.func!=CS_FN_TIM)) { - sourcesConversionTable->importValue(v1, csw.val1); - } - - if (csw.func >= CS_FN_EQUAL && csw.func <= CS_FN_ELESS) { - sourcesConversionTable->importValue(v2, csw.val2); - } - - if (csw.func >= CS_FN_AND && csw.func <= CS_FN_XOR) { + if ((csw.func >= CS_FN_AND && csw.func <= CS_FN_XOR) || csw.func == CS_FN_STICKY) { switchesConversionTable->importValue(v1, csw.val1); switchesConversionTable->importValue(v2, csw.val2); } + else if (csw.func >= CS_FN_EQUAL && csw.func <= CS_FN_ELESS) { + sourcesConversionTable->importValue(v1, csw.val1); + sourcesConversionTable->importValue(v2, csw.val2); + } + else { + if ((csw.func >= CS_FN_VPOS && csw.func <= CS_FN_ANEG) || (csw.func >= CS_FN_EQUAL && csw.func!=CS_FN_TIMER)) + sourcesConversionTable->importValue(v1, csw.val1); + else + csw.val1 = v1; + csw.val2 = v2; + } } protected: @@ -1361,9 +1360,9 @@ class SwitchesWarningField: public TransformedField { unsigned int version; }; -class CustomFunctionField: public TransformedField { +class ArmCustomFunctionField: public TransformedField { public: - CustomFunctionField(FuncSwData & fn, BoardEnum board, unsigned int version, unsigned int variant): + ArmCustomFunctionField(FuncSwData & fn, BoardEnum board, unsigned int version, unsigned int variant): TransformedField(internalField), internalField("CustomFunction"), fn(fn), @@ -1371,201 +1370,324 @@ class CustomFunctionField: public TransformedField { version(version), variant(variant), functionsConversionTable(board, version), - sourcesConversionTable(SourcesConversionTable::getInstance(board, version, variant, FLAG_NONONE)), - _param(0), - _delay(0), - _union_param(0) + sourcesConversionTable(SourcesConversionTable::getInstance(board, version, variant, version >= 216 ? 0 : FLAG_NONONE)), + _active(0) { - memset(_arm_param, 0, sizeof(_arm_param)); + memset(_param, 0, sizeof(_param)); internalField.Append(new SwitchField<8>(fn.swtch, board, version)); - if (IS_ARM(board)) { - internalField.Append(new ConversionField< UnsignedField<8> >((unsigned int &)fn.func, &functionsConversionTable, "Function", ::QObject::tr("OpenTX on this board doesn't accept this function"))); - if (IS_TARANIS(board)) - internalField.Append(new CharField<10>(_arm_param)); - else - internalField.Append(new CharField<6>(_arm_param)); - if (version >= 214) { - internalField.Append(new UnsignedField<2>(_mode)); - internalField.Append(new SignedField<6>(_delay)); - } - else { - internalField.Append(new UnsignedField<8>((unsigned int &)_delay)); - } - if (version < 214) - internalField.Append(new SpareBitsField<8>()); + internalField.Append(new ConversionField< UnsignedField<8> >((unsigned int &)fn.func, &functionsConversionTable, "Function", ::QObject::tr("OpenTX on this board doesn't accept this function"))); + + if (IS_TARANIS(board)) + internalField.Append(new CharField<10>(_param, false)); + else + internalField.Append(new CharField<6>(_param, false)); + + if (version >= 216) { + internalField.Append(new UnsignedField<8>(_active)); + } + else if (version >= 214) { + internalField.Append(new UnsignedField<2>(_mode)); + internalField.Append(new UnsignedField<6>(_active)); } else { - if (version >= 213) { - internalField.Append(new UnsignedField<3>(_union_param)); - internalField.Append(new ConversionField< UnsignedField<5> >((unsigned int &)fn.func, &functionsConversionTable, "Function", ::QObject::tr("OpenTX on this board doesn't accept this function"))); - } - else { - internalField.Append(new ConversionField< UnsignedField<7> >((unsigned int &)fn.func, &functionsConversionTable, "Function", ::QObject::tr("OpenTX on this board doesn't accept this function"))); - internalField.Append(new BoolField<1>((bool &)fn.enabled)); - } - internalField.Append(new UnsignedField<8>(_param)); + internalField.Append(new UnsignedField<8>((unsigned int &)_active)); + internalField.Append(new SpareBitsField<8>()); } } virtual void beforeExport() { - if (IS_ARM(board)) { - _mode = 0; - if (fn.func == FuncPlaySound || fn.func == FuncPlayPrompt || fn.func == FuncPlayValue) - _delay = (version >= 216 ? fn.repeatParam : (fn.repeatParam/5)); - else - _delay = (fn.enabled ? 1 : 0); - if (fn.func <= FuncInstantTrim) { - *((uint32_t *)_arm_param) = fn.param; - } - else if (fn.func == FuncPlayPrompt || fn.func == FuncBackgroundMusic) { - memcpy(_arm_param, fn.paramarm, sizeof(_arm_param)); - } - else if (fn.func >= FuncAdjustGV1 && fn.func <= FuncAdjustGVLast) { - unsigned int value; - if (version >= 214) { - _mode = fn.adjustMode; - if (fn.adjustMode == 1) - sourcesConversionTable->exportValue(fn.param, (int &)value); - else if (fn.adjustMode == 2) - value = RawSource(fn.param).index; - else - value = fn.param; - } - else { - unsigned int value; - sourcesConversionTable->exportValue(fn.param, (int &)value); - } - *((uint32_t *)_arm_param) = value; - } - else if (fn.func == FuncPlayValue || fn.func == FuncVolume) { - unsigned int value; - sourcesConversionTable->exportValue(fn.param, (int &)value); - *((uint32_t *)_arm_param) = value; + _mode = 0; + + if (fn.func == FuncPlaySound || fn.func == FuncPlayPrompt || fn.func == FuncPlayValue) + _active = (version >= 216 ? fn.repeatParam : (fn.repeatParam/5)); + else + _active = (fn.enabled ? 1 : 0); + + if (fn.func >= FuncSafetyCh1 && fn.func <= FuncSafetyCh32) { + if (version >= 216) { + *((uint16_t *)_param) = fn.param; + *((uint8_t *)(_param+3)) = fn.func - FuncSafetyCh1; } else { - *((uint32_t *)_arm_param) = fn.param; + *((uint32_t *)_param) = fn.param; } } + else if (fn.func >= FuncTrainer && fn.func <= FuncTrainerAIL) { + if (version >= 216) + *((uint8_t *)(_param+3)) = fn.func - FuncTrainer; + } + else if (fn.func == FuncPlayPrompt || fn.func == FuncBackgroundMusic) { + memcpy(_param, fn.paramarm, sizeof(_param)); + } + else if (fn.func >= FuncAdjustGV1 && fn.func <= FuncAdjustGVLast) { + if (version >= 216) { + *((uint8_t *)(_param+2)) = fn.adjustMode; + *((uint8_t *)(_param+3)) = fn.func - FuncAdjustGV1; + unsigned int value; + if (fn.adjustMode == 1) + sourcesConversionTable->exportValue(fn.param, (int &)value); + else if (fn.adjustMode == 2) + value = RawSource(fn.param).index; + else + value = fn.param; + *((uint16_t *)_param) = value; + } + else if (version >= 214) { + unsigned int value; + _mode = fn.adjustMode; + if (fn.adjustMode == 1) + sourcesConversionTable->exportValue(fn.param, (int &)value); + else if (fn.adjustMode == 2) + value = RawSource(fn.param).index; + else + value = fn.param; + *((uint32_t *)_param) = value; + } + else { + unsigned int value; + sourcesConversionTable->exportValue(fn.param, (int &)value); + *((uint32_t *)_param) = value; + } + } + else if (fn.func == FuncPlayValue || fn.func == FuncVolume) { + unsigned int value; + sourcesConversionTable->exportValue(fn.param, (int &)value); + if (version >= 216) + *((uint16_t *)_param) = value; + else + *((uint32_t *)_param) = value; + } else { - /* the default behavior */ - _param = fn.param; - _union_param = (fn.enabled ? 1 : 0); - if (fn.func >= FuncAdjustGV1 && fn.func <= FuncAdjustGVLast) { - if (version >= 213) { - _union_param += (fn.adjustMode << 1); - if (fn.adjustMode == 1) - sourcesConversionTable->exportValue(fn.param, (int &)_param); - else if (fn.adjustMode == 2) - _param = RawSource(fn.param).index; - } - else { - sourcesConversionTable->exportValue(fn.param, (int &)_param); - } - } - else if (fn.func == FuncPlayValue) { - if (version >= 213) { - _union_param = fn.repeatParam / 10; - sourcesConversionTable->exportValue(fn.param, (int &)_param); - } - else { - SourcesConversionTable::getInstance(board, version, variant, FLAG_NONONE|FLAG_NOSWITCHES)->exportValue(fn.param, (int &)_param); - } - } - else if (fn.func == FuncPlaySound || fn.func == FuncPlayPrompt || fn.func == FuncPlayBoth) { - if (version >= 213) - _union_param = fn.repeatParam / 10; - } - else if (fn.func <= FuncSafetyCh32) { - if (version >= 213) - _union_param += ((fn.func % 4) << 1); - } + *((uint32_t *)_param) = fn.param; } } virtual void afterImport() { - if (IS_ARM(board)) { - if (fn.func == FuncPlaySound || fn.func == FuncPlayPrompt || fn.func == FuncPlayValue) - fn.repeatParam = (version >= 216 ? _delay : (_delay*5)); - else - fn.enabled = (_delay & 0x01); + if (fn.func == FuncPlaySound || fn.func == FuncPlayPrompt || fn.func == FuncPlayValue) + fn.repeatParam = (version >= 216 ? _active : (_active*5)); + else + fn.enabled = (_active & 0x01); - unsigned int value = *((uint32_t *)_arm_param); - if (fn.func <= FuncTrainer) { - fn.param = (int)value; - } - else if (fn.func <= FuncInstantTrim) { - fn.param = value; - } - else if (fn.func == FuncPlayPrompt || fn.func == FuncBackgroundMusic) { - memcpy(fn.paramarm, _arm_param, sizeof(fn.paramarm)); - } - else if (fn.func == FuncVolume) { - sourcesConversionTable->importValue(value, (int &)fn.param); - } - else if (fn.func >= FuncAdjustGV1 && fn.func <= FuncAdjustGVLast) { - if (version >= 214) { - fn.adjustMode = _mode; - if (fn.adjustMode == 1) - sourcesConversionTable->importValue(value, (int &)fn.param); - else if (fn.adjustMode == 2) - fn.param = RawSource(SOURCE_TYPE_GVAR, value).toValue(); - else - fn.param = value; - } - else { - sourcesConversionTable->importValue(value, (int &)fn.param); - } - } - else if (fn.func == FuncPlayValue) { - if (version >= 213) - sourcesConversionTable->importValue(value, (int &)fn.param); - else - SourcesConversionTable::getInstance(board, version, variant, FLAG_NONONE|FLAG_NOSWITCHES)->importValue(value, (int &)fn.param); - } - else { - fn.param = value; - } + unsigned int value=0, mode=0, index=0; + if (version >= 216) { + value = *((uint16_t *)_param); + mode = *((uint8_t *)(_param+2)); + index = *((uint8_t *)(_param+3)); } else { - fn.param = _param; - if (version >= 213) { - fn.enabled = (_union_param & 0x01); + value = *((uint32_t *)_param); + } + + if (fn.func >= FuncSafetyCh1 && fn.func <= FuncSafetyCh32) { + fn.func = AssignFunc(fn.func + index); + fn.param = (int)value; + } + else if (fn.func >= FuncTrainer && fn.func <= FuncTrainerAIL) { + fn.func = AssignFunc(fn.func + index); + fn.param = (int)value; + } + else if (fn.func == FuncPlayPrompt || fn.func == FuncBackgroundMusic) { + memcpy(fn.paramarm, _param, sizeof(fn.paramarm)); + } + else if (fn.func == FuncVolume) { + sourcesConversionTable->importValue(value, (int &)fn.param); + } + else if (fn.func >= FuncAdjustGV1 && fn.func <= FuncAdjustGVLast) { + if (version >= 216) { + fn.func = AssignFunc(fn.func + index); + fn.adjustMode = mode; + if (fn.adjustMode == 1) + sourcesConversionTable->importValue(value, (int &)fn.param); + else if (fn.adjustMode == 2) + fn.param = RawSource(SOURCE_TYPE_GVAR, value).toValue(); + else + fn.param = value; } - if (fn.func >= FuncAdjustGV1 && fn.func <= FuncAdjustGVLast) { - if (version >= 213) { - fn.adjustMode = ((_union_param >> 1) & 0x03); - if (fn.adjustMode == 1) - sourcesConversionTable->importValue(_param, (int &)fn.param); - else if (fn.adjustMode == 2) - fn.param = RawSource(SOURCE_TYPE_GVAR, _param).toValue(); - } - else { - sourcesConversionTable->importValue(_param, (int &)fn.param); - } + else if (version >= 214) { + fn.adjustMode = _mode; + if (fn.adjustMode == 1) + sourcesConversionTable->importValue(value, (int &)fn.param); + else if (fn.adjustMode == 2) + fn.param = RawSource(SOURCE_TYPE_GVAR, value).toValue(); + else + fn.param = value; } - else if (fn.func == FuncPlayValue) { - if (version >= 213) { - fn.repeatParam = _union_param * 10; - sourcesConversionTable->importValue(_param, (int &)fn.param); - } - else { - SourcesConversionTable::getInstance(board, version, variant, FLAG_NONONE|FLAG_NOSWITCHES)->importValue(_param, (int &)fn.param); - } - } - else if (fn.func == FuncPlaySound || fn.func == FuncPlayPrompt || fn.func == FuncPlayBoth) { - if (version >= 213) - fn.repeatParam = _union_param * 10; - } - else if (fn.func <= FuncSafetyCh32) { - if (version >= 213) { - fn.func = AssignFunc(((fn.func >> 2) << 2) + ((_union_param >> 1) & 0x03)); - } - fn.param = (int8_t)fn.param; + else { + sourcesConversionTable->importValue(value, (int &)fn.param); } } + else if (fn.func == FuncPlayValue) { + if (version >= 213) + sourcesConversionTable->importValue(value, (int &)fn.param); + else + SourcesConversionTable::getInstance(board, version, variant, FLAG_NONONE|FLAG_NOSWITCHES)->importValue(value, (int &)fn.param); + } + else { + fn.param = value; + } + } + + protected: + StructField internalField; + FuncSwData & fn; + BoardEnum board; + unsigned int version; + unsigned int variant; + CustomFunctionsConversionTable functionsConversionTable; + SourcesConversionTable * sourcesConversionTable; + char _param[10]; + unsigned int _active; + unsigned int _mode; +}; + +class AvrCustomFunctionField: public TransformedField { + public: + AvrCustomFunctionField(FuncSwData & fn, BoardEnum board, unsigned int version, unsigned int variant): + TransformedField(internalField), + internalField("CustomFunction"), + fn(fn), + board(board), + version(version), + variant(variant), + functionsConversionTable(board, version), + sourcesConversionTable(SourcesConversionTable::getInstance(board, version, variant, version >= 216 ? 0 : FLAG_NONONE)), + _param(0), + _union_param(0), + _active(0) + { + if (version >= 216) { + internalField.Append(new SwitchField<6>(fn.swtch, board, version)); + internalField.Append(new ConversionField< UnsignedField<4> >((unsigned int &)fn.func, &functionsConversionTable, "Function", ::QObject::tr("OpenTX on this board doesn't accept this function"))); + internalField.Append(new UnsignedField<5>(_union_param)); + internalField.Append(new UnsignedField<1>(_active)); + } + if (version >= 213) { + internalField.Append(new SwitchField<8>(fn.swtch, board, version)); + internalField.Append(new UnsignedField<3>(_union_param)); + internalField.Append(new ConversionField< UnsignedField<5> >((unsigned int &)fn.func, &functionsConversionTable, "Function", ::QObject::tr("OpenTX on this board doesn't accept this function"))); + } + else { + internalField.Append(new SwitchField<8>(fn.swtch, board, version)); + internalField.Append(new ConversionField< UnsignedField<7> >((unsigned int &)fn.func, &functionsConversionTable, "Function", ::QObject::tr("OpenTX on this board doesn't accept this function"))); + internalField.Append(new BoolField<1>((bool &)fn.enabled)); + } + internalField.Append(new UnsignedField<8>(_param)); + } + + virtual void beforeExport() + { + _param = fn.param; + _active = (fn.enabled ? 1 : 0); + + if (fn.func >= FuncSafetyCh1 && fn.func <= FuncSafetyCh32) { + if (version >= 216) + _union_param = fn.func - FuncSafetyCh1; + else if (version >= 213) + _active += ((fn.func % 4) << 1); + } + else if (fn.func >= FuncTrainer && fn.func <= FuncTrainerAIL) { + if (version >= 216) + _union_param = fn.func - FuncTrainer; + } + else if (fn.func >= FuncAdjustGV1 && fn.func <= FuncAdjustGVLast) { + if (version >= 216) { + _union_param = fn.adjustMode; + _union_param += (fn.func - FuncAdjustGV1) << 2; + if (fn.adjustMode == 1) + sourcesConversionTable->exportValue(fn.param, (int &)_param); + else if (fn.adjustMode == 2) + _param = RawSource(fn.param).index; + } + else if (version >= 213) { + _active += (fn.adjustMode << 1); + if (fn.adjustMode == 1) + sourcesConversionTable->exportValue(fn.param, (int &)_param); + else if (fn.adjustMode == 2) + _param = RawSource(fn.param).index; + } + else { + sourcesConversionTable->exportValue(fn.param, (int &)_param); + } + } + else if (fn.func == FuncPlayValue) { + if (version >= 216) { + _union_param = fn.repeatParam / 10; + sourcesConversionTable->exportValue(fn.param, (int &)_param); + } + else if (version >= 213) { + _active = fn.repeatParam / 10; + sourcesConversionTable->exportValue(fn.param, (int &)_param); + } + else { + SourcesConversionTable::getInstance(board, version, variant, FLAG_NONONE|FLAG_NOSWITCHES)->exportValue(fn.param, (int &)_param); + } + } + else if (fn.func == FuncPlaySound || fn.func == FuncPlayPrompt || fn.func == FuncPlayBoth) { + if (version >= 216) { + _union_param = fn.repeatParam / 10; + } + else if (version >= 213) { + _active = fn.repeatParam / 10; + } + } + } + + virtual void afterImport() + { + fn.param = _param; + if (version >= 213) { + fn.enabled = (_active & 0x01); + } + + if (fn.func >= FuncSafetyCh1 && fn.func <= FuncSafetyCh32) { + if (version >= 216) + fn.func = AssignFunc(fn.func + _union_param); + else if (version >= 213) + fn.func = AssignFunc(((fn.func >> 2) << 2) + ((_active >> 1) & 0x03)); + fn.param = (int8_t)fn.param; + } + else if (fn.func >= FuncTrainer && fn.func <= FuncTrainerAIL) { + if (version >= 216) + fn.func = AssignFunc(fn.func + _union_param); + } + else if (fn.func >= FuncAdjustGV1 && fn.func <= FuncAdjustGVLast) { + if (version >= 216) { + fn.func = AssignFunc(fn.func + (_union_param >> 2)); + fn.adjustMode = (_union_param & 0x03); + } + else if (version >= 213) { + fn.adjustMode = ((_active >> 1) & 0x03); + if (fn.adjustMode == 1) + sourcesConversionTable->importValue(_param, (int &)fn.param); + else if (fn.adjustMode == 2) + fn.param = RawSource(SOURCE_TYPE_GVAR, _param).toValue(); + } + else { + sourcesConversionTable->importValue(_param, (int &)fn.param); + } + } + else if (fn.func == FuncPlayValue) { + if (version >= 216) { + fn.repeatParam = _union_param * 10; + sourcesConversionTable->importValue(_param, (int &)fn.param); + } + else if (version >= 213) { + fn.repeatParam = _active * 10; + sourcesConversionTable->importValue(_param, (int &)fn.param); + } + else { + SourcesConversionTable::getInstance(board, version, variant, FLAG_NONONE|FLAG_NOSWITCHES)->importValue(_param, (int &)fn.param); + } + } + else if (fn.func == FuncPlaySound || fn.func == FuncPlayPrompt || fn.func == FuncPlayBoth) { + if (version >= 216) + fn.repeatParam = _union_param * 10; + else if (version >= 213) + fn.repeatParam = _active * 10; + } } protected: @@ -1576,11 +1698,10 @@ class CustomFunctionField: public TransformedField { unsigned int variant; CustomFunctionsConversionTable functionsConversionTable; SourcesConversionTable * sourcesConversionTable; - char _arm_param[10]; unsigned int _param; - int _delay; unsigned int _mode; unsigned int _union_param; + unsigned int _active; }; class FrskyScreenField: public DataField { @@ -1933,8 +2054,12 @@ Open9xModelDataNew::Open9xModelDataNew(ModelData & modelData, BoardEnum board, u internalField.Append(new CurvesField(modelData.curves, board, version)); for (int i=0; isetMaxVisibleItems(10); } -QString getRepeatString(unsigned int val) -{ - if (val==0) { - return QObject::tr("No repeat"); - } else { - unsigned int step = IS_ARM(GetEepromInterface()->getBoard()) ? 5 : 10; - return QObject::tr("%1 sec").arg(step*val); - } -} - -QString getFuncName(unsigned int val) -{ - if (val < C9X_NUM_CHNOUT) { - return QObject::tr("Safety %1").arg(RawSource(SOURCE_TYPE_CH, val).toString()); - } - else if (val == FuncTrainer) - return QObject::tr("Trainer"); - else if (val == FuncTrainerRUD) - return QObject::tr("Trainer RUD"); - else if (val == FuncTrainerELE) - return QObject::tr("Trainer ELE"); - else if (val == FuncTrainerTHR) - return QObject::tr("Trainer THR"); - else if (val == FuncTrainerAIL) - return QObject::tr("Trainer AIL"); - else if (val == FuncInstantTrim) - return QObject::tr("Instant Trim"); - else if (val == FuncPlaySound) - return QObject::tr("Play Sound"); - else if (val == FuncPlayHaptic) - return QObject::tr("Play Haptic"); - else if (val == FuncReset) - return QObject::tr("Reset"); - else if (val == FuncVario) - return QObject::tr("Vario"); - else if (val == FuncPlayPrompt) - return QObject::tr("Play Track"); - else if (val == FuncPlayBoth) - return QObject::tr("Play Both"); - else if (val == FuncPlayValue) - return QObject::tr("Play Value"); - else if (val == FuncLogs) - return QObject::tr("Start Logs"); - else if (val == FuncVolume) - return QObject::tr("Volume"); - else if (val == FuncBacklight) - return QObject::tr("Backlight"); - else if (val == FuncBackgroundMusic) - return QObject::tr("Background Music"); - else if (val == FuncBackgroundMusicPause) - return QObject::tr("Background Music Pause"); - else if (val >= FuncAdjustGV1 && val <= FuncAdjustGVLast) - return QObject::tr("Adjust GV%1").arg(val-FuncAdjustGV1+1); - else { - return QString("???"); // Highlight unknown functions with output of question marks.(BTW should not happen that we do not know what a function is) - } -} - -// TODO should be a toString() method in CustoSwData ... -QString getCustomSwitchStr(CustomSwData * customSw, const ModelData & model) -{ - QString result = ""; - - if (!customSw->func) - return result; - if (customSw->andsw!=0) { - result +="( "; - } - switch (getCSFunctionFamily(customSw->func)) { - case CS_FAMILY_TIMERS: - result = QString("TIM(%1 , %2)").arg(ValToTim(customSw->val1)).arg(ValToTim(customSw->val2)); - break; - case CS_FAMILY_VOFS: { - RawSource source = RawSource(customSw->val1, &model); - RawSourceRange range = source.getRange(); - if (customSw->val1) - result += source.toString(); - else - result += "0"; - result.remove(" "); - if (customSw->func == CS_FN_APOS || customSw->func == CS_FN_ANEG) - result = "|" + result + "|"; - else if (customSw->func == CS_FN_DAPOS) - result = "|d(" + result + ")|"; - else if (customSw->func == CS_FN_DPOS) result = "d(" + result + ")"; - if (customSw->func == CS_FN_APOS || customSw->func == CS_FN_VPOS || customSw->func == CS_FN_DAPOS || customSw->func == CS_FN_DPOS) - result += " > "; - else if (customSw->func == CS_FN_ANEG || customSw->func == CS_FN_VNEG) - result += " < "; - result += QString::number(range.step * (customSw->val2 /*TODO+ source.getRawOffset(model)*/) + range.offset); - break; - } - case CS_FAMILY_VBOOL: - result = RawSwitch(customSw->val1).toString(); - switch (customSw->func) { - case CS_FN_AND: - result += " AND "; - break; - case CS_FN_OR: - result += " OR "; - break; - case CS_FN_XOR: - result += " XOR "; - break; - default: - break; - } - result += RawSwitch(customSw->val2).toString(); - break; - - case CS_FAMILY_VCOMP: - if (customSw->val1) - result += RawSource(customSw->val1).toString(); - else - result += "0"; - switch (customSw->func) { - case CS_FN_EQUAL: - result += " = "; - break; - case CS_FN_NEQUAL: - result += " != "; - break; - case CS_FN_GREATER: - result += " > "; - break; - case CS_FN_LESS: - result += " < "; - break; - case CS_FN_EGREATER: - result += " >= "; - break; - case CS_FN_ELESS: - result += " <= "; - break; - default: - break; - } - if (customSw->val2) - result += RawSource(customSw->val2).toString(); - else - result += "0"; - break; - } - - if (customSw->andsw!=0) { - result +=" ) AND "; - result += RawSwitch(customSw->andsw).toString(); - } - - if (GetEepromInterface()->getCapability(CustomSwitchesExt)) { - if (customSw->delay) - result += QObject::tr(" Delay %1 sec").arg(customSw->delay/2.0); - if (customSw->duration) - result += QObject::tr(" Duration %1 sec").arg(customSw->duration/2.0); - } - - return result; -} - QString getProtocolStr(const int proto) { static const char *strings[] = { "OFF", @@ -567,17 +408,6 @@ QString getTimerMode(int tm) { return s; } - if (tma >= TMRMODE_FIRST_MOMENT_SWITCH && tma < TMRMODE_FIRST_MOMENT_SWITCH + GetEepromInterface()->getCapability(SwitchesPositions)) { - s = RawSwitch(SWITCH_TYPE_SWITCH, tma - TMRMODE_FIRST_MOMENT_SWITCH + 1).toString()+"t"; - if (tm < 0) s.prepend("!"); - return s; - } - - if (tma >= TMRMODE_FIRST_MOMENT_SWITCH + GetEepromInterface()->getCapability(SwitchesPositions) && tma < TMRMODE_FIRST_MOMENT_SWITCH + GetEepromInterface()->getCapability(SwitchesPositions) + GetEepromInterface()->getCapability(CustomSwitches)) { - s = RawSwitch(SWITCH_TYPE_VIRTUAL, tma - TMRMODE_FIRST_MOMENT_SWITCH - GetEepromInterface()->getCapability(SwitchesPositions) + 1).toString()+"t"; - if (tm < 0) s.prepend("!"); - return s; - } if (tma >=TMRMODE_FIRST_CHPERC && tma 33) { - tma-=32; - } - if (tma < 10) { - s=stt.mid(abs(tma)*3, 3); - } else if (tma <19) { - s=QString("SW%1").arg(tma-9); - } else { - s=QString("SW")+QChar('A'+tma-19); - } - if (tm<0) { - s.prepend("!"); - } else if (tm>33) { - s.append("m"); - } - return s; -} - void populateBacklightCB(QComboBox *b, const uint8_t value) { QString strings[] = { QObject::tr("OFF"), QObject::tr("Keys"), QObject::tr("Sticks"), QObject::tr("Keys + Sticks"), QObject::tr("ON"), NULL }; @@ -720,15 +526,6 @@ void populateSwitchCB(QComboBox *b, const RawSwitch & value, unsigned long attr, if (item == value) b->setCurrentIndex(b->count()-1); } -#if 0 - // TODO One ? - if (attr & POPULATE_ONOFF) { - item = RawSwitch(SWITCH_TYPE_ONM); - b->addItem(item.toString(), item.toValue()); - if (item == value) b->setCurrentIndex(b->count()-1); - } -#endif - b->setMaxVisibleItems(10); } @@ -878,35 +675,6 @@ void populateSourceCB(QComboBox *b, const RawSource & source, const ModelData & b->setMaxVisibleItems(10); } -#define CSWITCH_STR "---- a~x a>x ax |a|b a=b a<=b d>=x |d|>=xTIM " -#define CSW_NUM_FUNC 18 // TODO enum -#define CSW_LEN_FUNC 6 -int csw_values[]={ - CS_FN_OFF, - CS_FN_VEQUAL, // added at the end to avoid everything renumbered - CS_FN_VPOS, - CS_FN_VNEG, - CS_FN_APOS, - CS_FN_ANEG, - CS_FN_AND, - CS_FN_OR, - CS_FN_XOR, - CS_FN_EQUAL, - CS_FN_NEQUAL, - CS_FN_GREATER, - CS_FN_LESS, - CS_FN_EGREATER, - CS_FN_ELESS, - CS_FN_DPOS, - CS_FN_DAPOS, - CS_FN_TIM -}; - -QString getCSWFunc(int val) -{ - return QString(CSWITCH_STR).mid(val*CSW_LEN_FUNC, CSW_LEN_FUNC); -} - float ValToTim(int value) { return ((value < -109 ? 129+value : (value < 7 ? (113+value)*5 : (53+value)*10))/10.0); @@ -927,14 +695,37 @@ int TimToVal(float value) void populateCSWCB(QComboBox *b, int value) { + int order[] = { + CS_FN_OFF, + CS_FN_VEQUAL, // added at the end to avoid everything renumbered + CS_FN_VPOS, + CS_FN_VNEG, + CS_FN_APOS, + CS_FN_ANEG, + CS_FN_AND, + CS_FN_OR, + CS_FN_XOR, + CS_FN_EQUAL, + CS_FN_NEQUAL, + CS_FN_GREATER, + CS_FN_LESS, + CS_FN_EGREATER, + CS_FN_ELESS, + CS_FN_DPOS, + CS_FN_DAPOS, + CS_FN_TIMER, + CS_FN_STICKY + }; + b->clear(); - for (int i = 0; i < CSW_NUM_FUNC; i++) { - b->addItem(getCSWFunc(i),csw_values[i]); - if (i>GetEepromInterface()->getCapability(CSFunc)) { - QModelIndex index = b->model()->index(i, 0); - QVariant v(0); - } - if (value == csw_values[i]) { + for (int i=0; iaddItem(CustomSwData(func).funcToString(), func); +// if (i>GetEepromInterface()->getCapability(CSFunc)) { +// QModelIndex index = b->model()->index(i, 0); +// QVariant v(0); +// } + if (value == func) { b->setCurrentIndex(b->count()-1); } } @@ -1143,13 +934,6 @@ QString getPhasesStr(unsigned int phases, ModelData & model) } } -float c9xexpou(float point, float coeff) -{ - float x=point*1024.0/100.0; - float k=coeff*256.0/100.0; - return ((k*x*x*x/(1024*1024) + x*(256-k) + 128) / 256)/1024.0*100; -} - QString getCenterBeep(ModelData * g_model) { //RETA123 diff --git a/companion/src/helpers.h b/companion/src/helpers.h index 3764a0395..d3a7bc5ec 100644 --- a/companion/src/helpers.h +++ b/companion/src/helpers.h @@ -87,7 +87,6 @@ void populateTrimUseCB(QComboBox *b, unsigned int phase); void populateGvarUseCB(QComboBox *b, unsigned int phase); void populateCustomScreenFieldCB(QComboBox *b, unsigned int value, bool last, int hubproto); void populateTimerSwitchCB(QComboBox *b, int value); -QString getCustomSwitchStr(CustomSwData * customSw, const ModelData & model); QString getProtocolStr(const int proto); QString getPhasesStr(unsigned int phases, ModelData & model); @@ -107,12 +106,8 @@ void populateGVCB(QComboBox *b, int value); void populateSourceCB(QComboBox *b, const RawSource &source, const ModelData & model, unsigned int flags); void populateCSWCB(QComboBox *b, int value); QString getTimerMode(int tm); -QString getTimerModeB(int tm); QString getPhaseName(int val, char * phasename=NULL); QString getInputStr(ModelData & model, int index); -QString getCSWFunc(int val); -QString getFuncName(unsigned int val); -QString getRepeatString(unsigned int val); QString getSignedStr(int value); QString getGVarString(int16_t val, bool sign=false); QString image2qstring(QImage image); @@ -132,7 +127,6 @@ QString getFrSkyProtocol(int protocol); QString getFrSkyMeasure(int units); QString getFrSkySrc(int index); -float c9xexpou(float point, float coeff); float ValToTim(int value); int TimToVal(float value); diff --git a/companion/src/modeledit/curves.cpp b/companion/src/modeledit/curves.cpp index fe54f3d7d..1112b1dde 100644 --- a/companion/src/modeledit/curves.cpp +++ b/companion/src/modeledit/curves.cpp @@ -495,6 +495,13 @@ void ModelEdit::on_ca_ctype_CB_currentIndexChanged() } } +float c9xexpou(float point, float coeff) +{ + float x=point*1024.0/100.0; + float k=coeff*256.0/100.0; + return ((k*x*x*x/(1024*1024) + x*(256-k) + 128) / 256)/1024.0*100; +} + void ModelEdit::on_ca_apply_PB_clicked() { int index=ui->ca_ctype_CB->currentIndex(); diff --git a/companion/src/modeledit/customfunctions.cpp b/companion/src/modeledit/customfunctions.cpp index 711ddd380..98c331f5d 100644 --- a/companion/src/modeledit/customfunctions.cpp +++ b/companion/src/modeledit/customfunctions.cpp @@ -513,7 +513,7 @@ void CustomFunctionsPanel::populateFuncCB(QComboBox *b, unsigned int value) { b->clear(); for (unsigned int i=0; iaddItem(getFuncName(i)); + b->addItem(FuncSwData(AssignFunc(i)).funcToString()); if (!GetEepromInterface()->getCapability(HasVolume)) { if (i==FuncVolume || i==FuncBackgroundMusic || i==FuncBackgroundMusicPause) { QModelIndex index = b->model()->index(i, 0); diff --git a/companion/src/modeledit/customswitches.cpp b/companion/src/modeledit/customswitches.cpp index 68d3fc34f..db3f69311 100644 --- a/companion/src/modeledit/customswitches.cpp +++ b/companion/src/modeledit/customswitches.cpp @@ -78,7 +78,7 @@ CustomSwitchesPanel::CustomSwitchesPanel(QWidget * parent, ModelData & model): // AND cswitchAnd[i] = new QComboBox(this); cswitchAnd[i]->setProperty("index", i); - connect(cswitchAnd[i], SIGNAL(currentIndexChanged(int)), this, SLOT(edited())); + connect(cswitchAnd[i], SIGNAL(currentIndexChanged(int)), this, SLOT(andEdited(int))); gridLayout->addWidget(cswitchAnd[i], i+1, 4); cswitchAnd[i]->setVisible(false); @@ -91,7 +91,7 @@ CustomSwitchesPanel::CustomSwitchesPanel(QWidget * parent, ModelData & model): cswitchDuration[i]->setMinimum(0); cswitchDuration[i]->setAccelerated(true); cswitchDuration[i]->setDecimals(1); - connect(cswitchDuration[i],SIGNAL(editingFinished()), this, SLOT(edited())); + connect(cswitchDuration[i], SIGNAL(valueChanged(double)), this, SLOT(durationEdited(double))); gridLayout->addWidget(cswitchDuration[i], i+1, 5); cswitchDuration[i]->setVisible(false); @@ -103,7 +103,7 @@ CustomSwitchesPanel::CustomSwitchesPanel(QWidget * parent, ModelData & model): cswitchDelay[i]->setMinimum(0); cswitchDelay[i]->setAccelerated(true); cswitchDelay[i]->setDecimals(1); - connect(cswitchDelay[i], SIGNAL(editingFinished()), this, SLOT(edited())); + connect(cswitchDelay[i], SIGNAL(valueChanged(double)), this, SLOT(delayEdited(double))); gridLayout->addWidget(cswitchDelay[i], i+1, 6); cswitchDelay[i]->setVisible(false); } @@ -116,6 +116,27 @@ CustomSwitchesPanel::~CustomSwitchesPanel() { } +void CustomSwitchesPanel::durationEdited(double duration) +{ + int index = sender()->property("index").toInt(); + model.customSw[index].duration = (uint8_t)round(duration*2); + emit modified(); +} + +void CustomSwitchesPanel::delayEdited(double delay) +{ + int index = sender()->property("index").toInt(); + model.customSw[index].delay = (uint8_t)round(delay*2); + emit modified(); +} + +void CustomSwitchesPanel::andEdited(int value) +{ + int index = sender()->property("index").toInt(); + model.customSw[index].andsw = cswitchAnd[index]->itemData(value).toInt(); + emit modified(); +} + void CustomSwitchesPanel::edited() { if (!lock) { @@ -124,27 +145,25 @@ void CustomSwitchesPanel::edited() bool chAr; float value, step; int newval; - chAr = (getCSFunctionFamily(model.customSw[i].func) != getCSFunctionFamily(csw[i]->itemData(csw[i]->currentIndex()).toInt())); + chAr = (model.customSw[i].getFunctionFamily() != CustomSwData(csw[i]->itemData(csw[i]->currentIndex()).toInt()).getFunctionFamily()); model.customSw[i].func = csw[i]->itemData(csw[i]->currentIndex()).toInt(); if(chAr) { - if (getCSFunctionFamily(model.customSw[i].func)==CS_FAMILY_TIMERS) { + if (model.customSw[i].getFunctionFamily() == CS_FAMILY_TIMER) { model.customSw[i].val1 = -119; model.customSw[i].val2 = -119; - } else { + } + else { model.customSw[i].val1 = 0; model.customSw[i].val2 = 0; } model.customSw[i].andsw = 0; setSwitchWidgetVisibility(i); } - if (GetEepromInterface()->getCapability(CustomSwitchesExt)) { - model.customSw[i].duration= (uint8_t)round(cswitchDuration[i]->value()*2); - model.customSw[i].delay= (uint8_t)round(cswitchDelay[i]->value()*2); - } + RawSource source; - switch (getCSFunctionFamily(model.customSw[i].func)) + switch (model.customSw[i].getFunctionFamily()) { - case (CS_FAMILY_VOFS): + case CS_FAMILY_VOFS: if (model.customSw[i].val1 != cswitchSource1[i]->itemData(cswitchSource1[i]->currentIndex()).toInt()) { source = RawSource(model.customSw[i].val1, &model); model.customSw[i].val1 = cswitchSource1[i]->itemData(cswitchSource1[i]->currentIndex()).toInt(); @@ -181,7 +200,8 @@ void CustomSwitchesPanel::edited() } } break; - case (CS_FAMILY_TIMERS): { + case CS_FAMILY_TIMER: + { value = cswitchOffset[i]->value(); newval=TimToVal(value); if (newval>model.customSw[i].val2) { @@ -194,7 +214,8 @@ void CustomSwitchesPanel::edited() } else { step=0.1; } - } else { + } + else { if (value <=2) { step=0.1; } else if (value<=60) { @@ -238,14 +259,14 @@ void CustomSwitchesPanel::edited() cswitchValue[i]->setValue(value); cswitchValue[i]->setSingleStep(step); break; - } - case (CS_FAMILY_VBOOL): - case (CS_FAMILY_VCOMP): + } + case CS_FAMILY_VBOOL: + case CS_FAMILY_VCOMP: + case CS_FAMILY_STICKY: model.customSw[i].val1 = cswitchSource1[i]->itemData(cswitchSource1[i]->currentIndex()).toInt(); model.customSw[i].val2 = cswitchSource2[i]->itemData(cswitchSource2[i]->currentIndex()).toInt(); break; } - model.customSw[i].andsw = cswitchAnd[i]->itemData(cswitchAnd[i]->currentIndex()).toInt(); emit modified(); lock = false; } @@ -256,7 +277,7 @@ void CustomSwitchesPanel::setSwitchWidgetVisibility(int i) RawSource source = RawSource(model.customSw[i].val1, &model); RawSourceRange range = source.getRange(); - switch (getCSFunctionFamily(model.customSw[i].func)) + switch (model.customSw[i].getFunctionFamily()) { case CS_FAMILY_VOFS: cswitchSource1[i]->setVisible(true); @@ -270,13 +291,15 @@ void CustomSwitchesPanel::setSwitchWidgetVisibility(int i) cswitchOffset[i]->setMinimum(range.step*-127); cswitchOffset[i]->setMaximum(range.step*127); cswitchOffset[i]->setValue(range.step*model.customSw[i].val2); - } else { + } + else { cswitchOffset[i]->setMinimum(range.min); cswitchOffset[i]->setMaximum(range.max); cswitchOffset[i]->setValue(range.step*(model.customSw[i].val2/* TODO+source.getRawOffset(model)*/)+range.offset); } break; case CS_FAMILY_VBOOL: + case CS_FAMILY_STICKY: cswitchSource1[i]->setVisible(true); cswitchSource2[i]->setVisible(true); cswitchValue[i]->setVisible(false); @@ -292,7 +315,7 @@ void CustomSwitchesPanel::setSwitchWidgetVisibility(int i) populateSourceCB(cswitchSource1[i], RawSource(model.customSw[i].val1), model, POPULATE_SOURCES | POPULATE_VIRTUAL_INPUTS | POPULATE_TRIMS | POPULATE_SWITCHES | POPULATE_TELEMETRY | (GetEepromInterface()->getCapability(GvarsInCS) ? POPULATE_GVARS : 0)); populateSourceCB(cswitchSource2[i], RawSource(model.customSw[i].val2), model, POPULATE_SOURCES | POPULATE_TRIMS | POPULATE_VIRTUAL_INPUTS | POPULATE_SWITCHES | POPULATE_TELEMETRY | (GetEepromInterface()->getCapability(GvarsInCS) ? POPULATE_GVARS : 0)); break; - case CS_FAMILY_TIMERS: + case CS_FAMILY_TIMER: cswitchSource1[i]->setVisible(false); cswitchSource2[i]->setVisible(false); cswitchValue[i]->setVisible(true); diff --git a/companion/src/modeledit/customswitches.h b/companion/src/modeledit/customswitches.h index c00ad60b6..219249aae 100644 --- a/companion/src/modeledit/customswitches.h +++ b/companion/src/modeledit/customswitches.h @@ -17,6 +17,9 @@ class CustomSwitchesPanel : public ModelPanel private slots: void edited(); + void durationEdited(double duration); + void delayEdited(double delay); + void andEdited(int value); void csw_customContextMenuRequested(QPoint pos); void cswDelete(); void cswCopy(); diff --git a/companion/src/modeledit/telemetry.cpp b/companion/src/modeledit/telemetry.cpp index 014def777..1b5fd285f 100644 --- a/companion/src/modeledit/telemetry.cpp +++ b/companion/src/modeledit/telemetry.cpp @@ -352,7 +352,7 @@ void TelemetryCustomScreen::updateBar(int line) RawSource source = RawSource(SOURCE_TYPE_TELEMETRY, index-1, &model); RawSourceRange range = source.getRange(true); int max = round((range.max - range.min) / range.step); - if (255-screen.body.bars[line].barMax > max) + if (int(255-screen.body.bars[line].barMax) > max) screen.body.bars[line].barMax = 255 - max; minSB[line]->setEnabled(true); minSB[line]->setDecimals(range.decimals); diff --git a/companion/src/printdialog.cpp b/companion/src/printdialog.cpp index 5283dd614..be95c92be 100644 --- a/companion/src/printdialog.cpp +++ b/companion/src/printdialog.cpp @@ -650,7 +650,7 @@ void printDialog::printSwitches() } else { str.append(""); } - QString tstr = getCustomSwitchStr(&g_model->customSw[i], *g_model); + QString tstr = g_model->customSw[i].toString(*g_model); str.append(doTC(tstr,"green")); str.append(""); sc++; @@ -708,7 +708,7 @@ void printDialog::printFSwitches() if (g_model->funcSw[i].swtch.type!=SWITCH_TYPE_NONE) { str.append(""); str.append(doTC(g_model->funcSw[i].swtch.toString(),"green")); - str.append(doTC(getFuncName(g_model->funcSw[i].func),"green")); + str.append(doTC(g_model->funcSw[i].funcToString(),"green")); str.append(doTC(g_model->funcSw[i].paramToString(),"green")); int index=g_model->funcSw[i].func; if (index==FuncPlaySound || index==FuncPlayHaptic || index==FuncPlayValue || index==FuncPlayPrompt || index==FuncPlayBoth || index==FuncBackgroundMusic) { diff --git a/radio/src/translations/cz.h.txt b/radio/src/translations/cz.h.txt index 3655f1cb4..8901e27ed 100644 --- a/radio/src/translations/cz.h.txt +++ b/radio/src/translations/cz.h.txt @@ -335,9 +335,9 @@ #if defined(PCBTARANIS) #define TR_6POS_POTS "P11""P12""P13""P14""P15""P16""P21""P22""P23""P24""P25""P26" - #define TR_VSWITCHES "SA\300""SA-""SA\301""SB\300""SB-""SB\301""SC\300""SC-""SC\301""SD\300""SD-""SD\301""SE\300""SE-""SE\301""SF\300""SF\301""SG\300""SG-""SG\301""SH\300""SH\301" TR_CUSTOMSW TR_6POS_POTS "*1 " + #define TR_VSWITCHES "SA\300""SA-""SA\301""SB\300""SB-""SB\301""SC\300""SC-""SC\301""SD\300""SD-""SD\301""SE\300""SE-""SE\301""SF\300""SF\301""SG\300""SG-""SG\301""SH\300""SH\301" TR_CUSTOMSW TR_6POS_POTS #else - #define TR_VSWITCHES TR_9X_3POS_SWITCHES "THR""RUD""ELE""AIL""GEA""TRN" TR_CUSTOMSW "*1 " + #define TR_VSWITCHES TR_9X_3POS_SWITCHES "THR""RUD""ELE""AIL""GEA""TRN" TR_CUSTOMSW #endif #if defined(PCBSKY9X) diff --git a/radio/src/translations/de.h.txt b/radio/src/translations/de.h.txt index e8ac659c8..429781e15 100644 --- a/radio/src/translations/de.h.txt +++ b/radio/src/translations/de.h.txt @@ -335,9 +335,9 @@ #if defined(PCBTARANIS) #define TR_6POS_POTS "P11""P12""P13""P14""P15""P16""P21""P22""P23""P24""P25""P26" - #define TR_VSWITCHES "SA\300""SA-""SA\301""SB\300""SB-""SB\301""SC\300""SC-""SC\301""SD\300""SD-""SD\301""SE\300""SE-""SE\301""SF\300""SF\301""SG\300""SG-""SG\301""SH\300""SH\301" TR_CUSTOMSW TR_6POS_POTS "ONE" + #define TR_VSWITCHES "SA\300""SA-""SA\301""SB\300""SB-""SB\301""SC\300""SC-""SC\301""SD\300""SD-""SD\301""SE\300""SE-""SE\301""SF\300""SF\301""SG\300""SG-""SG\301""SH\300""SH\301" TR_CUSTOMSW TR_6POS_POTS #else - #define TR_VSWITCHES TR_9X_3POS_SWITCHES "THR""RUD""ELE""AIL""GEA""TRN" TR_CUSTOMSW "ONE" + #define TR_VSWITCHES TR_9X_3POS_SWITCHES "THR""RUD""ELE""AIL""GEA""TRN" TR_CUSTOMSW #endif #if defined(PCBSKY9X) diff --git a/radio/src/translations/en.h b/radio/src/translations/en.h index 0f7dd182e..070b76b03 100644 --- a/radio/src/translations/en.h +++ b/radio/src/translations/en.h @@ -340,9 +340,9 @@ #if defined(PCBTARANIS) #define TR_6POS_POTS "P11""P12""P13""P14""P15""P16""P21""P22""P23""P24""P25""P26" - #define TR_VSWITCHES "SA\300""SA-""SA\301""SB\300""SB-""SB\301""SC\300""SC-""SC\301""SD\300""SD-""SD\301""SE\300""SE-""SE\301""SF\300""SF\301""SG\300""SG-""SG\301""SH\300""SH\301" TR_CUSTOMSW TR_6POS_POTS "One" + #define TR_VSWITCHES "SA\300""SA-""SA\301""SB\300""SB-""SB\301""SC\300""SC-""SC\301""SD\300""SD-""SD\301""SE\300""SE-""SE\301""SF\300""SF\301""SG\300""SG-""SG\301""SH\300""SH\301" TR_CUSTOMSW TR_6POS_POTS #else - #define TR_VSWITCHES TR_9X_3POS_SWITCHES "THR""RUD""ELE""AIL""GEA""TRN" TR_CUSTOMSW "One" + #define TR_VSWITCHES TR_9X_3POS_SWITCHES "THR""RUD""ELE""AIL""GEA""TRN" TR_CUSTOMSW #endif #if defined(PCBSKY9X) diff --git a/radio/src/translations/es.h.txt b/radio/src/translations/es.h.txt index d1c923ea7..952bc68fa 100644 --- a/radio/src/translations/es.h.txt +++ b/radio/src/translations/es.h.txt @@ -335,9 +335,9 @@ #if defined(PCBTARANIS) #define TR_6POS_POTS "P11""P12""P13""P14""P15""P16""P21""P22""P23""P24""P25""P26" - #define TR_VSWITCHES "SA\300""SA-""SA\301""SB\300""SB-""SB\301""SC\300""SC-""SC\301""SD\300""SD-""SD\301""SE\300""SE-""SE\301""SF\300""SF\301""SG\300""SG-""SG\301""SH\300""SH\301" TR_CUSTOMSW TR_6POS_POTS "Uno" + #define TR_VSWITCHES "SA\300""SA-""SA\301""SB\300""SB-""SB\301""SC\300""SC-""SC\301""SD\300""SD-""SD\301""SE\300""SE-""SE\301""SF\300""SF\301""SG\300""SG-""SG\301""SH\300""SH\301" TR_CUSTOMSW TR_6POS_POTS #else - #define TR_VSWITCHES TR_9X_3POS_SWITCHES "ACE""DIR""ELE""ALE""GEA""TRN" TR_CUSTOMSW "Uno" + #define TR_VSWITCHES TR_9X_3POS_SWITCHES "ACE""DIR""ELE""ALE""GEA""TRN" TR_CUSTOMSW #endif #if defined(PCBSKY9X) diff --git a/radio/src/translations/fr.h.txt b/radio/src/translations/fr.h.txt index e018ef0a5..8cf9b660f 100644 --- a/radio/src/translations/fr.h.txt +++ b/radio/src/translations/fr.h.txt @@ -335,9 +335,9 @@ #if defined(PCBTARANIS) #define TR_6POS_POTS "P11""P12""P13""P14""P15""P16""P21""P22""P23""P24""P25""P26" - #define TR_VSWITCHES "SA\300""SA-""SA\301""SB\300""SB-""SB\301""SC\300""SC-""SC\301""SD\300""SD-""SD\301""SE\300""SE-""SE\301""SF\300""SF\301""SG\300""SG-""SG\301""SH\300""SH\301" TR_CUSTOMSW TR_6POS_POTS "1*\0" + #define TR_VSWITCHES "SA\300""SA-""SA\301""SB\300""SB-""SB\301""SC\300""SC-""SC\301""SD\300""SD-""SD\301""SE\300""SE-""SE\301""SF\300""SF\301""SG\300""SG-""SG\301""SH\300""SH\301" TR_CUSTOMSW TR_6POS_POTS #else - #define TR_VSWITCHES TR_9X_3POS_SWITCHES "THR""RUD""ELE""AIL""GEA""TRN" TR_CUSTOMSW "1*\0" + #define TR_VSWITCHES TR_9X_3POS_SWITCHES "THR""RUD""ELE""AIL""GEA""TRN" TR_CUSTOMSW #endif #if defined(PCBSKY9X) diff --git a/radio/src/translations/it.h.txt b/radio/src/translations/it.h.txt index fc59b9576..e767bc8f2 100644 --- a/radio/src/translations/it.h.txt +++ b/radio/src/translations/it.h.txt @@ -337,7 +337,7 @@ #define TR_6POS_POTS "P11""P12""P13""P14""P15""P16""P21""P22""P23""P24""P25""P26" #define TR_VSWITCHES "SA\300""SA-""SA\301""SB\300""SB-""SB\301""SC\300""SC-""SC\301""SD\300""SD-""SD\301""SE\300""SE-""SE\301""SF\300""SF\301""SG\300""SG-""SG\301""SH\300""SH\301" TR_CUSTOMSW TR_6POS_POTS "1*\0" #else - #define TR_VSWITCHES TR_9X_3POS_SWITCHES "THR""RUD""ELE""AIL""GEA""TRN" TR_CUSTOMSW "One" + #define TR_VSWITCHES TR_9X_3POS_SWITCHES "THR""RUD""ELE""AIL""GEA""TRN" TR_CUSTOMSW #endif #if defined(PCBSKY9X) diff --git a/radio/src/translations/pl.h.txt b/radio/src/translations/pl.h.txt index 8f006b74b..58af6305d 100644 --- a/radio/src/translations/pl.h.txt +++ b/radio/src/translations/pl.h.txt @@ -335,9 +335,9 @@ #if defined(PCBTARANIS) #define TR_6POS_POTS "P11""P12""P13""P14""P15""P16""P21""P22""P23""P24""P25""P26" - #define TR_VSWITCHES "SA\300""SA-""SA\301""SB\300""SB-""SB\301""SC\300""SC-""SC\301""SD\300""SD-""SD\301""SE\300""SE-""SE\301""SF\300""SF\301""SG\300""SG-""SG\301""SH\300""SH\301" TR_CUSTOMSW TR_6POS_POTS " * " + #define TR_VSWITCHES "SA\300""SA-""SA\301""SB\300""SB-""SB\301""SC\300""SC-""SC\301""SD\300""SD-""SD\301""SE\300""SE-""SE\301""SF\300""SF\301""SG\300""SG-""SG\301""SH\300""SH\301" TR_CUSTOMSW TR_6POS_POTS #else - #define TR_VSWITCHES TR_9X_3POS_SWITCHES "GAZ""SK ""LOT""SW ""GEA""TRN" TR_CUSTOMSW " * " + #define TR_VSWITCHES TR_9X_3POS_SWITCHES "GAZ""SK ""LOT""SW ""GEA""TRN" TR_CUSTOMSW #endif #if defined(PCBSKY9X) diff --git a/radio/src/translations/pt.h.txt b/radio/src/translations/pt.h.txt index 3a78386ed..1c722ed02 100644 --- a/radio/src/translations/pt.h.txt +++ b/radio/src/translations/pt.h.txt @@ -335,9 +335,9 @@ #if defined(PCBTARANIS) #define TR_6POS_POTS "P11""P12""P13""P14""P15""P16""P21""P22""P23""P24""P25""P26" - #define TR_VSWITCHES "SA\300""SA-""SA\301""SB\300""SB-""SB\301""SC\300""SC-""SC\301""SD\300""SD-""SD\301""SE\300""SE-""SE\301""SF\300""SF\301""SG\300""SG-""SG\301""SH\300""SH\301" TR_CUSTOMSW TR_6POS_POTS "1*\0" + #define TR_VSWITCHES "SA\300""SA-""SA\301""SB\300""SB-""SB\301""SC\300""SC-""SC\301""SD\300""SD-""SD\301""SE\300""SE-""SE\301""SF\300""SF\301""SG\300""SG-""SG\301""SH\300""SH\301" TR_CUSTOMSW TR_6POS_POTS #else - #define TR_VSWITCHES TR_9X_3POS_SWITCHES "THR""RUD""ELE""AIL""GEA""TRN" TR_CUSTOMSW "1*\0" + #define TR_VSWITCHES TR_9X_3POS_SWITCHES "THR""RUD""ELE""AIL""GEA""TRN" TR_CUSTOMSW #endif #if defined(PCBSKY9X) diff --git a/radio/src/translations/se.h.txt b/radio/src/translations/se.h.txt index 6a3b32bfc..c585a356b 100644 --- a/radio/src/translations/se.h.txt +++ b/radio/src/translations/se.h.txt @@ -335,9 +335,9 @@ #if defined(PCBTARANIS) #define TR_6POS_POTS "P11""P12""P13""P14""P15""P16""P21""P22""P23""P24""P25""P26" - #define TR_VSWITCHES "SA\300""SA-""SA\301""SB\300""SB-""SB\301""SC\300""SC-""SC\301""SD\300""SD-""SD\301""SE\300""SE-""SE\301""SF\300""SF\301""SG\300""SG-""SG\301""SH\300""SH\301" TR_CUSTOMSW TR_6POS_POTS "One" + #define TR_VSWITCHES "SA\300""SA-""SA\301""SB\300""SB-""SB\301""SC\300""SC-""SC\301""SD\300""SD-""SD\301""SE\300""SE-""SE\301""SF\300""SF\301""SG\300""SG-""SG\301""SH\300""SH\301" TR_CUSTOMSW TR_6POS_POTS #else - #define TR_VSWITCHES TR_9X_3POS_SWITCHES "THR""RUD""ELE""AIL""GEA""TRN" TR_CUSTOMSW "One" + #define TR_VSWITCHES TR_9X_3POS_SWITCHES "THR""RUD""ELE""AIL""GEA""TRN" TR_CUSTOMSW #endif #if defined(PCBSKY9X)
"+tr("LS")+('A'+(i-9))+"