[color] Fix MPM option title==nullptr
This commit is contained in:
@@ -688,57 +688,68 @@ class ModuleWindow : public FormGroup {
|
|||||||
if (MULTIMODULE_PROTOCOL_KNOWN(moduleIdx)) {
|
if (MULTIMODULE_PROTOCOL_KNOWN(moduleIdx)) {
|
||||||
// Multi optional feature row
|
// Multi optional feature row
|
||||||
const char *title = getMultiOptionTitle(moduleIdx);
|
const char *title = getMultiOptionTitle(moduleIdx);
|
||||||
grid.nextLine();
|
if (title != nullptr) {
|
||||||
new StaticText(this, grid.getLabelSlot(true), title);
|
grid.nextLine();
|
||||||
|
new StaticText(this, grid.getLabelSlot(true), title);
|
||||||
|
|
||||||
//int optionValue = g_model.moduleData[moduleIdx].multi.optionValue;
|
// int optionValue =
|
||||||
int8_t min, max;
|
// g_model.moduleData[moduleIdx].multi.optionValue;
|
||||||
getMultiOptionValues(multi_proto, min, max);
|
int8_t min, max;
|
||||||
|
getMultiOptionValues(multi_proto, min, max);
|
||||||
|
|
||||||
|
if (title == STR_MULTI_RFPOWER) {
|
||||||
if (title == STR_MULTI_RFPOWER) {
|
new Choice(this, grid.getFieldSlot(2, 0), STR_MULTI_POWER, 0, 15,
|
||||||
new Choice(this, grid.getFieldSlot(2, 0), STR_MULTI_POWER, 0, 15,
|
GET_SET_DEFAULT(
|
||||||
GET_SET_DEFAULT(g_model.moduleData[moduleIdx].multi.optionValue));
|
g_model.moduleData[moduleIdx].multi.optionValue));
|
||||||
} else if (title == STR_MULTI_TELEMETRY) {
|
} else if (title == STR_MULTI_TELEMETRY) {
|
||||||
new Choice(this, grid.getFieldSlot(2, 0), STR_MULTI_TELEMETRY_MODE, min, max,
|
new Choice(this, grid.getFieldSlot(2, 0),
|
||||||
GET_SET_DEFAULT(g_model.moduleData[moduleIdx].multi.optionValue));
|
STR_MULTI_TELEMETRY_MODE, min, max,
|
||||||
} else if (title == STR_MULTI_WBUS) {
|
GET_SET_DEFAULT(
|
||||||
new Choice(this, grid.getFieldSlot(2, 0), STR_MULTI_WBUS_MODE, 0, 1,
|
g_model.moduleData[moduleIdx].multi.optionValue));
|
||||||
GET_SET_DEFAULT(g_model.moduleData[moduleIdx].multi.optionValue));
|
} else if (title == STR_MULTI_WBUS) {
|
||||||
} else if (multi_proto == MODULE_SUBTYPE_MULTI_FS_AFHDS2A) {
|
new Choice(this, grid.getFieldSlot(2, 0), STR_MULTI_WBUS_MODE, 0,
|
||||||
auto edit = new NumberEdit(
|
1,
|
||||||
this, grid.getFieldSlot(2, 0), 50, 400,
|
GET_SET_DEFAULT(
|
||||||
GET_DEFAULT(
|
g_model.moduleData[moduleIdx].multi.optionValue));
|
||||||
50 + 5 * g_model.moduleData[moduleIdx].multi.optionValue),
|
} else if (multi_proto == MODULE_SUBTYPE_MULTI_FS_AFHDS2A) {
|
||||||
SET_VALUE(g_model.moduleData[moduleIdx].multi.optionValue,
|
auto edit = new NumberEdit(
|
||||||
(newValue - 50) / 5));
|
this, grid.getFieldSlot(2, 0), 50, 400,
|
||||||
edit->setStep(5);
|
GET_DEFAULT(
|
||||||
} else if (multi_proto == MODULE_SUBTYPE_MULTI_DSM2) {
|
50 + 5 * g_model.moduleData[moduleIdx].multi.optionValue),
|
||||||
new CheckBox(
|
SET_VALUE(g_model.moduleData[moduleIdx].multi.optionValue,
|
||||||
this, grid.getFieldSlot(2, 0),
|
(newValue - 50) / 5));
|
||||||
[=]() {
|
edit->setStep(5);
|
||||||
return g_model.moduleData[moduleIdx].multi.optionValue & 0x01;
|
} else if (multi_proto == MODULE_SUBTYPE_MULTI_DSM2) {
|
||||||
},
|
new CheckBox(
|
||||||
[=](int16_t newValue) {
|
this, grid.getFieldSlot(2, 0),
|
||||||
g_model.moduleData[moduleIdx].multi.optionValue =
|
[=]() {
|
||||||
(g_model.moduleData[moduleIdx].multi.optionValue & 0xFE) +
|
return g_model.moduleData[moduleIdx].multi.optionValue &
|
||||||
newValue;
|
0x01;
|
||||||
});
|
},
|
||||||
} else {
|
[=](int16_t newValue) {
|
||||||
if (min == 0 && max == 1) {
|
g_model.moduleData[moduleIdx].multi.optionValue =
|
||||||
new CheckBox(this, grid.getFieldSlot(2, 0),
|
(g_model.moduleData[moduleIdx].multi.optionValue &
|
||||||
GET_SET_DEFAULT(g_model.moduleData[moduleIdx].multi.optionValue));
|
0xFE) +
|
||||||
|
newValue;
|
||||||
|
});
|
||||||
} else {
|
} else {
|
||||||
new NumberEdit(
|
if (min == 0 && max == 1) {
|
||||||
this, grid.getFieldSlot(2, 0), -128, 127,
|
new CheckBox(
|
||||||
GET_SET_DEFAULT(
|
this, grid.getFieldSlot(2, 0),
|
||||||
g_model.moduleData[moduleIdx].multi.optionValue));
|
GET_SET_DEFAULT(
|
||||||
|
g_model.moduleData[moduleIdx].multi.optionValue));
|
||||||
|
} else {
|
||||||
|
new NumberEdit(
|
||||||
|
this, grid.getFieldSlot(2, 0), -128, 127,
|
||||||
|
GET_SET_DEFAULT(
|
||||||
|
g_model.moduleData[moduleIdx].multi.optionValue));
|
||||||
|
|
||||||
// Show RSSI next to RF Freq Fine Tune
|
// Show RSSI next to RF Freq Fine Tune
|
||||||
if (getMultiOptionTitle(moduleIdx) == STR_MULTI_RFTUNE) {
|
if (title == STR_MULTI_RFTUNE) {
|
||||||
new DynamicNumber<int>(
|
new DynamicNumber<int>(
|
||||||
this, grid.getFieldSlot(2, 1),
|
this, grid.getFieldSlot(2, 1),
|
||||||
[] { return (int)TELEMETRY_RSSI(); }, 0, "RSSI: ", " db");
|
[] { return (int)TELEMETRY_RSSI(); }, 0, "RSSI: ", " db");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user