Merge pull request #744 from opentx/bsongis/Issue741_a_equals_x_in_logical_switches

Issue #741 fixed - a==x added in logical switches functions
This commit is contained in:
Andre Bernet
2014-02-25 21:07:07 +01:00
18 changed files with 90 additions and 15 deletions
+2
View File
@@ -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");
+1
View File
@@ -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,
@@ -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
+1
View File
@@ -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,
+4 -4
View File
@@ -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].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);
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].func<LS_FN_VEQUAL) {
if (model.customSw[i].func == LS_FN_DPOS || model.customSw[i].func == LS_FN_DAPOS) {
cswitchOffset[i]->setMinimum(range.step*-127);
cswitchOffset[i]->setMaximum(range.step*127);
cswitchOffset[i]->setValue(range.step*model.customSw[i].val2);