fix(cpn): more fixes to RawSource calls (#5155)
Arising from index shift in #4722
This commit is contained in:
@@ -1941,11 +1941,11 @@ void SetupPanel::populateThrottleTrimSwitchCB()
|
||||
for (int i=0; i<getBoardCapability(board, Board::NumTrims); i++, idx++) {
|
||||
// here order is TERA instead of RETA
|
||||
if (i == 0)
|
||||
trim = RawSource(SOURCE_TYPE_TRIM, 2).toString(model, &generalSettings);
|
||||
trim = RawSource(SOURCE_TYPE_TRIM, 2 + 1).toString(model, &generalSettings);
|
||||
else if (i == 2)
|
||||
trim = RawSource(SOURCE_TYPE_TRIM, 0).toString(model, &generalSettings);
|
||||
trim = RawSource(SOURCE_TYPE_TRIM, 0 + 1).toString(model, &generalSettings);
|
||||
else
|
||||
trim = RawSource(SOURCE_TYPE_TRIM, i).toString(model, &generalSettings);
|
||||
trim = RawSource(SOURCE_TYPE_TRIM, i + 1).toString(model, &generalSettings);
|
||||
ui->throttleTrimSwitch->addItem(trim, idx);
|
||||
}
|
||||
|
||||
|
||||
@@ -429,7 +429,7 @@ QString ModelPrinter::printMixerLine(const MixData & mix, bool showMultiplex, in
|
||||
if (mix.carryTrim > 0)
|
||||
str += " " + tr("NoTrim");
|
||||
else if (mix.carryTrim < 0)
|
||||
str += " " + RawSource(SOURCE_TYPE_TRIM, (-(mix.carryTrim)-1)).toString(&model, &generalSettings);
|
||||
str += " " + RawSource(SOURCE_TYPE_TRIM, (-(mix.carryTrim)-1) + 1).toString(&model, &generalSettings);
|
||||
|
||||
if (firmware->getCapability(HasNoExpo) && mix.noExpo)
|
||||
str += " " + tr("No DR/Expo").toHtmlEscaped();
|
||||
@@ -696,7 +696,7 @@ QString ModelPrinter::printOutputValueGVar(int val)
|
||||
if (abs(val) > 10000) {
|
||||
if (val < 0)
|
||||
result = "-";
|
||||
result.append(RawSource(SOURCE_TYPE_GVAR, abs(val)-10001).toString(&model));
|
||||
result.append(RawSource(SOURCE_TYPE_GVAR, (abs(val)-10001) + 1).toString(&model));
|
||||
}
|
||||
else {
|
||||
if (val >= 0)
|
||||
@@ -932,6 +932,10 @@ QString ModelPrinter::printThrottle()
|
||||
result << printLabelValue(tr("Trim idle only"), printBoolean(model.thrTrim, BOOLEAN_YESNO));
|
||||
result << printLabelValue(tr("Warning"), printBoolean(!model.disableThrottleWarning, BOOLEAN_YESNO));
|
||||
result << printLabelValue(tr("Reversed"), printBoolean(model.throttleReversed, BOOLEAN_YESNO));
|
||||
int thrTrim = model.thrTrimSwitch;
|
||||
if (thrTrim == 0) thrTrim = 2;
|
||||
else if (thrTrim == 2) thrTrim = 0;
|
||||
result << printLabelValue(tr("Trim source"), RawSource(SOURCE_TYPE_TRIM, thrTrim + 1).toString(&model, &generalSettings));
|
||||
return result.join(" ");
|
||||
}
|
||||
|
||||
|
||||
@@ -162,7 +162,7 @@ void joystickDialog::populateSourceCombo(QComboBox * cb)
|
||||
if (radioSettings.isInputStick(i))
|
||||
wname = Boards::getAxisName(i);
|
||||
else
|
||||
wname = RawSource(RawSourceType::SOURCE_TYPE_INPUT, i).toString(nullptr, &radioSettings);
|
||||
wname = RawSource(RawSourceType::SOURCE_TYPE_INPUT, i + 1).toString(nullptr, &radioSettings);
|
||||
cb->addItem(wname, i);
|
||||
}
|
||||
}
|
||||
@@ -186,7 +186,7 @@ void joystickDialog::populateButtonCombo(QComboBox * cb)
|
||||
for (i = 0; i < ttlSwitches; ++i) {
|
||||
if (radioSettings.switchConfig[i].type != Board::SWITCH_NOT_AVAILABLE) {
|
||||
swtype = Board::SwitchType(radioSettings.switchConfig[i].type);
|
||||
wname = RawSource(RawSourceType::SOURCE_TYPE_SWITCH, i).toString(nullptr, &radioSettings);
|
||||
wname = RawSource(RawSourceType::SOURCE_TYPE_SWITCH, i + 1).toString(nullptr, &radioSettings);
|
||||
if (swtype == Board::SWITCH_3POS) {
|
||||
cb->addItem(wname + CPN_STR_SW_INDICATOR_UP, i | JS_BUTTON_3POS_UP);
|
||||
cb->addItem(wname + CPN_STR_SW_INDICATOR_DN, i | JS_BUTTON_3POS_DN);
|
||||
@@ -197,7 +197,7 @@ void joystickDialog::populateButtonCombo(QComboBox * cb)
|
||||
}
|
||||
|
||||
for (i = 0; i < ttlTrims; i += 1) {
|
||||
wname = RawSource(RawSourceType::SOURCE_TYPE_TRIM, i).toString(nullptr, &radioSettings);
|
||||
wname = RawSource(RawSourceType::SOURCE_TYPE_TRIM, i + 1).toString(nullptr, &radioSettings);
|
||||
if ((i == 0) || (i == 3)) {
|
||||
cb->addItem(wname + " Left", (i + ttlSwitches) | JS_BUTTON_3POS_DN);
|
||||
cb->addItem(wname + " Right", (i + ttlSwitches) | JS_BUTTON_3POS_UP);
|
||||
|
||||
Reference in New Issue
Block a user