Skip to content

Commit

Permalink
[color] Fix subType editing & set default channel start + range on ch…
Browse files Browse the repository at this point in the history
…ange

Resolves #567
  • Loading branch information
raphaelcoeffic committed Sep 27, 2021
1 parent e2a37f3 commit 994c4ff
Showing 1 changed file with 15 additions and 4 deletions.
19 changes: 15 additions & 4 deletions radio/src/gui/colorlcd/model_setup.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -810,12 +810,23 @@ class ModuleWindow : public FormGroup {

// Module parameters
if (isModuleXJT(moduleIdx)) {
auto xjtChoice = new Choice(
rfChoice = new Choice(
this, grid.getFieldSlot(2, 1), STR_XJT_ACCST_RF_PROTOCOLS,
MODULE_SUBTYPE_PXX1_OFF, MODULE_SUBTYPE_PXX1_ACCST_LR12,
GET_SET_DEFAULT(g_model.moduleData[moduleIdx].rfProtocol));
xjtChoice->setAvailableHandler(
MODULE_SUBTYPE_PXX1_OFF, MODULE_SUBTYPE_PXX1_LAST,
GET_DEFAULT(g_model.moduleData[moduleIdx].subType),
[=](int32_t newValue) {
g_model.moduleData[moduleIdx].subType = newValue;
g_model.moduleData[moduleIdx].channelsStart = 0;
g_model.moduleData[moduleIdx].channelsCount =
defaultModuleChannels_M8(moduleIdx);
SET_DIRTY();
update();
rfChoice->setFocus(SET_FOCUS_DEFAULT);
});

rfChoice->setAvailableHandler(
[](int index) { return index != MODULE_SUBTYPE_PXX1_OFF; });

} else if (isModuleDSM2(moduleIdx)) {
new Choice(this, grid.getFieldSlot(2, 1), STR_DSM_PROTOCOLS,
DSM2_PROTO_LP45, DSM2_PROTO_DSMX,
Expand Down

0 comments on commit 994c4ff

Please sign in to comment.