diff --git a/companion/src/eeprominterface.cpp b/companion/src/eeprominterface.cpp index 1df1f4e98..749a54d70 100644 --- a/companion/src/eeprominterface.cpp +++ b/companion/src/eeprominterface.cpp @@ -428,6 +428,8 @@ QString LogicalSwitchData::funcToString() case LS_FN_DAPOS: return QObject::tr("|d|>=x"); case LS_FN_VEQUAL: + return QObject::tr("a=x"); + case LS_FN_VALMOSTEQUAL: return QObject::tr("a~x"); case LS_FN_TIMER: return QObject::tr("Timer"); diff --git a/companion/src/eeprominterface.h b/companion/src/eeprominterface.h index 07919466c..316c263dc 100644 --- a/companion/src/eeprominterface.h +++ b/companion/src/eeprominterface.h @@ -597,6 +597,7 @@ enum CSFunction { LS_FN_DPOS, LS_FN_DAPOS, LS_FN_VEQUAL, // added at the end to avoid everything renumbered + LS_FN_VALMOSTEQUAL, LS_FN_TIMER, LS_FN_STICKY, LS_FN_STAY, diff --git a/companion/src/firmwares/opentx/opentxeeprom.cpp b/companion/src/firmwares/opentx/opentxeeprom.cpp index 37f148900..01d9cab65 100644 --- a/companion/src/firmwares/opentx/opentxeeprom.cpp +++ b/companion/src/firmwares/opentx/opentxeeprom.cpp @@ -1063,8 +1063,10 @@ class LogicalSwitchesFunctionsTable: public ConversionTable { int val=0; bool afterrelease21March2013 = IS_AFTER_RELEASE_21_MARCH_2013(board, version); addConversion(LS_FN_OFF, val++); - if (afterrelease21March2013) + if (IS_ARM(board) && version >= 216) addConversion(LS_FN_VEQUAL, val++); + if (afterrelease21March2013) + addConversion(LS_FN_VALMOSTEQUAL, val++); addConversion(LS_FN_VPOS, val++); addConversion(LS_FN_VNEG, val++); if (IS_ARM(board) && version >= 216) val++; // later RANGE diff --git a/companion/src/helpers.cpp b/companion/src/helpers.cpp index 2c7f9fc0c..e0cd7b91c 100644 --- a/companion/src/helpers.cpp +++ b/companion/src/helpers.cpp @@ -643,6 +643,7 @@ void populateCSWCB(QComboBox *b, int value) int order[] = { LS_FN_OFF, LS_FN_VEQUAL, // added at the end to avoid everything renumbered + LS_FN_VALMOSTEQUAL, // added at the end to avoid everything renumbered LS_FN_VPOS, LS_FN_VNEG, // LS_FN_RANGE, diff --git a/companion/src/modeledit/customswitches.cpp b/companion/src/modeledit/customswitches.cpp index cf02f4430..d86a1a487 100644 --- a/companion/src/modeledit/customswitches.cpp +++ b/companion/src/modeledit/customswitches.cpp @@ -121,7 +121,7 @@ void LogicalSwitchesPanel::v1Edited(int value) if (model.customSw[i].getFunctionFamily() == LS_FAMILY_VOFS) { RawSource source = RawSource(model.customSw[i].val1, &model); if (source.type == SOURCE_TYPE_TELEMETRY) { - if (model.customSw[i].func > LS_FN_ELESS && model.customSw[i].func < LS_FN_VEQUAL) { + if (model.customSw[i].func == LS_FN_DPOS || model.customSw[i].func == LS_FN_DAPOS) { model.customSw[i].val2 = 0; } else { @@ -130,7 +130,7 @@ void LogicalSwitchesPanel::v1Edited(int value) } else { RawSourceRange range = source.getRange(); - if (model.customSw[i].func > LS_FN_ELESS && model.customSw[i].func < LS_FN_VEQUAL) { + if (model.customSw[i].func == LS_FN_DPOS || model.customSw[i].func == LS_FN_DAPOS) { model.customSw[i].val2 = (cswitchOffset[i]->value() / range.step); } else { @@ -208,7 +208,7 @@ void LogicalSwitchesPanel::edited() { source = RawSource(model.customSw[i].val1, &model); RawSourceRange range = source.getRange(); - if (model.customSw[i].func>LS_FN_ELESS && model.customSw[i].funcvalue() / range.step); cswitchOffset[i]->setValue(model.customSw[i].val2*range.step); } @@ -269,7 +269,7 @@ void LogicalSwitchesPanel::setSwitchWidgetVisibility(int i) populateSourceCB(cswitchSource1[i], source, model, POPULATE_SOURCES | POPULATE_VIRTUAL_INPUTS | POPULATE_TRIMS | POPULATE_SWITCHES | POPULATE_TELEMETRY | (GetEepromInterface()->getCapability(GvarsInCS) ? POPULATE_GVARS : 0)); cswitchOffset[i]->setDecimals(range.decimals); cswitchOffset[i]->setSingleStep(range.step); - if (model.customSw[i].func>LS_FN_ELESS && model.customSw[i].funcsetMinimum(range.step*-127); cswitchOffset[i]->setMaximum(range.step*127); cswitchOffset[i]->setValue(range.step*model.customSw[i].val2); diff --git a/radio/src/eeprom_conversions.cpp b/radio/src/eeprom_conversions.cpp index f12353cb0..dc3707352 100644 --- a/radio/src/eeprom_conversions.cpp +++ b/radio/src/eeprom_conversions.cpp @@ -466,6 +466,7 @@ void ConvertModel_215_to_216(ModelData &model) for (uint8_t i=0; i<32; i++) { LogicalSwitchData & sw = g_model.customSw[i]; sw.func = oldModel.customSw[i].func; + if (sw.func >= LS_FUNC_VEQUAL) sw.func += 1; if (sw.func >= LS_FUNC_RANGE) sw.func += 1; if (sw.func >= LS_FUNC_STAY) sw.func += 1; sw.v1 = oldModel.customSw[i].v1; diff --git a/radio/src/myeeprom.h b/radio/src/myeeprom.h index 94b6cbb9e..2527383a2 100644 --- a/radio/src/myeeprom.h +++ b/radio/src/myeeprom.h @@ -686,7 +686,10 @@ PACK( union u_int8int16_t { enum LogicalSwitchesFunctions { LS_FUNC_NONE, +#if defined(CPUARM) LS_FUNC_VEQUAL, // v==offset +#endif + LS_FUNC_VALMOSTEQUAL, // v~=offset LS_FUNC_VPOS, // v>offset LS_FUNC_VNEG, // vfunc) { +#if defined(CPUARM) case LS_FUNC_VEQUAL: + result = (x==y); + break; +#endif + case LS_FUNC_VALMOSTEQUAL: #if defined(GVARS) if (v1 >= MIXSRC_GVAR1 && v1 <= MIXSRC_LAST_GVAR) result = (x==y); diff --git a/radio/src/translations/cz.h.txt b/radio/src/translations/cz.h.txt index 1fa49ad61..e69af0f29 100644 --- a/radio/src/translations/cz.h.txt +++ b/radio/src/translations/cz.h.txt @@ -167,8 +167,14 @@ #endif #endif +#if defined(CPUARM) + #define TR_CSWEQUAL "a=x\0 " +#else + #define TR_CSWEQUAL +#endif + #define LEN_VCSWFUNC "\005" -#define TR_VCSWFUNC "---\0 ""a{x\0 ""a>x\0 ""ax""|a|b\0 ""ax\0 ""ax""|a|b\0 ""ax\0 ""ax""|a|b\0 ""ax\0 ""ax""|a|b\0 ""ax\0 ""ax""|a|b\0 ""ax\0 ""ax""|a|b\0 ""ax\0 ""ax""|a|b\0 ""ax\0 ""ax""|a|b\0 ""ax\0 ""ax""|a|b\0 ""ax\0 ""ax""|a|b\0 ""ax\0 ""ax""|a|b\0 ""ax\0 ""ax""|a|b\0 ""ax\0 ""ax""|a|b\0 ""ax\0 ""ax""|a|b\0 ""ax\0 ""ax""|a|b\0 ""ax\0 ""ax""|a|b\0 ""ax\0 ""ax""|a|b\0 ""ax\0 ""ax""|a|b\0 ""ax\0 ""ax""|a|b\0 ""ax\0 ""ax""|a|b\0 ""a