Module setup improvements
This commit is contained in:
committed by
Peter Feerick
parent
647d19bbc9
commit
e6dc23b77f
@@ -69,6 +69,8 @@ class ModuleWindow : public FormGroup
|
|||||||
void updateModule();
|
void updateModule();
|
||||||
void updateSubType();
|
void updateSubType();
|
||||||
|
|
||||||
|
uint8_t getModuleIdx() const { return moduleIdx; }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
uint8_t moduleIdx;
|
uint8_t moduleIdx;
|
||||||
|
|
||||||
@@ -79,6 +81,7 @@ class ModuleWindow : public FormGroup
|
|||||||
TextButton *rangeButton = nullptr;
|
TextButton *rangeButton = nullptr;
|
||||||
TextButton *registerButton = nullptr;
|
TextButton *registerButton = nullptr;
|
||||||
Window *fsLine = nullptr;
|
Window *fsLine = nullptr;
|
||||||
|
Choice *rfPower = nullptr;
|
||||||
|
|
||||||
void startRSSIDialog(std::function<void()> closeHandler = nullptr);
|
void startRSSIDialog(std::function<void()> closeHandler = nullptr);
|
||||||
};
|
};
|
||||||
@@ -147,6 +150,7 @@ void ModuleWindow::updateModule()
|
|||||||
rangeButton = nullptr;
|
rangeButton = nullptr;
|
||||||
registerButton = nullptr;
|
registerButton = nullptr;
|
||||||
fsLine = nullptr;
|
fsLine = nullptr;
|
||||||
|
rfPower = nullptr;
|
||||||
|
|
||||||
// Module parameters
|
// Module parameters
|
||||||
ModuleData* md = &g_model.moduleData[moduleIdx];
|
ModuleData* md = &g_model.moduleData[moduleIdx];
|
||||||
@@ -175,6 +179,11 @@ void ModuleWindow::updateModule()
|
|||||||
new StaticText(line, rect_t{}, STR_CHANNELRANGE, 0, COLOR_THEME_PRIMARY1);
|
new StaticText(line, rect_t{}, STR_CHANNELRANGE, 0, COLOR_THEME_PRIMARY1);
|
||||||
chRange = new ModuleChannelRange(line, moduleIdx);
|
chRange = new ModuleChannelRange(line, moduleIdx);
|
||||||
|
|
||||||
|
// Failsafe
|
||||||
|
fsLine = newLine(&grid);
|
||||||
|
new StaticText(fsLine, rect_t{}, STR_FAILSAFE, 0, COLOR_THEME_PRIMARY1);
|
||||||
|
new FailsafeChoice(fsLine, moduleIdx);
|
||||||
|
|
||||||
// PPM modules
|
// PPM modules
|
||||||
if (isModulePPM(moduleIdx)) {
|
if (isModulePPM(moduleIdx)) {
|
||||||
new PpmSettings(this, grid, moduleIdx);
|
new PpmSettings(this, grid, moduleIdx);
|
||||||
@@ -190,7 +199,7 @@ void ModuleWindow::updateModule()
|
|||||||
new StaticText(line, rect_t{}, STR_RECEIVER, 0, COLOR_THEME_PRIMARY1);
|
new StaticText(line, rect_t{}, STR_RECEIVER, 0, COLOR_THEME_PRIMARY1);
|
||||||
|
|
||||||
auto box = new FormGroup(line, rect_t{});
|
auto box = new FormGroup(line, rect_t{});
|
||||||
box->setFlexLayout(LV_FLEX_FLOW_ROW);
|
box->setFlexLayout(LV_FLEX_FLOW_ROW, lv_dpx(8));
|
||||||
|
|
||||||
// Model index
|
// Model index
|
||||||
auto modelId = &g_model.header.modelId[moduleIdx];
|
auto modelId = &g_model.header.modelId[moduleIdx];
|
||||||
@@ -291,15 +300,10 @@ void ModuleWindow::updateModule()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Failsafe
|
|
||||||
fsLine = newLine(&grid);
|
|
||||||
new StaticText(fsLine, rect_t{}, STR_FAILSAFE, 0, COLOR_THEME_PRIMARY1);
|
|
||||||
new FailsafeChoice(fsLine, moduleIdx);
|
|
||||||
|
|
||||||
#if defined(PXX2)
|
#if defined(PXX2)
|
||||||
// Register and Range buttons
|
else if (isModuleRFAccess(moduleIdx)) {
|
||||||
if (isModuleRFAccess(moduleIdx)) {
|
|
||||||
|
// Register and Range buttons
|
||||||
auto line = newLine(&grid);
|
auto line = newLine(&grid);
|
||||||
new StaticText(line, rect_t{}, STR_MODULE, 0, COLOR_THEME_PRIMARY1);
|
new StaticText(line, rect_t{}, STR_MODULE, 0, COLOR_THEME_PRIMARY1);
|
||||||
|
|
||||||
@@ -324,9 +328,7 @@ void ModuleWindow::updateModule()
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
line = newLine(&grid);
|
auto options = new TextButton(box, rect_t{}, LV_SYMBOL_SETTINGS);
|
||||||
new StaticText(line, rect_t{}, STR_OPTIONS, 0, COLOR_THEME_PRIMARY1);
|
|
||||||
auto options = new TextButton(line, rect_t{}, STR_SET);
|
|
||||||
options->setPressHandler([=]() {
|
options->setPressHandler([=]() {
|
||||||
new pxx2::ModuleOptions(Layer::back(), moduleIdx);
|
new pxx2::ModuleOptions(Layer::back(), moduleIdx);
|
||||||
return 0;
|
return 0;
|
||||||
@@ -335,22 +337,12 @@ void ModuleWindow::updateModule()
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
// R9M Power
|
// R9M Power
|
||||||
if (isModuleR9M_FCC_VARIANT(moduleIdx)) {
|
if (isModuleR9MNonAccess(moduleIdx)) {
|
||||||
auto line = newLine(&grid);
|
auto line = newLine(&grid);
|
||||||
new StaticText(line, rect_t{}, STR_RF_POWER, 0, COLOR_THEME_PRIMARY1);
|
new StaticText(line, rect_t{}, STR_RF_POWER, 0, COLOR_THEME_PRIMARY1);
|
||||||
new Choice(line, rect_t{}, STR_R9M_FCC_POWER_VALUES, 0, R9M_FCC_POWER_MAX,
|
rfPower = new Choice(line, rect_t{}, 0, 0, GET_SET_DEFAULT(md->pxx.power));
|
||||||
GET_SET_DEFAULT(md->pxx.power));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isModuleR9M_LBT(moduleIdx)) {
|
|
||||||
auto line = newLine(&grid);
|
|
||||||
new StaticText(line, rect_t{}, STR_RF_POWER, 0, COLOR_THEME_PRIMARY1);
|
|
||||||
new Choice(line, rect_t{}, STR_R9M_LBT_POWER_VALUES, 0,
|
|
||||||
R9M_LBT_POWER_MAX,
|
|
||||||
GET_DEFAULT(min<uint8_t>(md->pxx.power,
|
|
||||||
R9M_LBT_POWER_MAX)),
|
|
||||||
SET_DEFAULT(md->pxx.power));
|
|
||||||
}
|
|
||||||
#if defined(PXX2)
|
#if defined(PXX2)
|
||||||
// Receivers
|
// Receivers
|
||||||
if (isModuleRFAccess(moduleIdx)) {
|
if (isModuleRFAccess(moduleIdx)) {
|
||||||
@@ -420,11 +412,16 @@ void ModuleWindow::updateSubType()
|
|||||||
lv_obj_add_flag(fsLine->getLvObj(), LV_OBJ_FLAG_HIDDEN);
|
lv_obj_add_flag(fsLine->getLvObj(), LV_OBJ_FLAG_HIDDEN);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (rfPower) {
|
||||||
// TODO: ISRM
|
if (isModuleR9M_LBT(moduleIdx)) {
|
||||||
// - ACCESS "Register" vs D16 "Bind"
|
rfPower->setValues(STR_R9M_LBT_POWER_VALUES);
|
||||||
// - ACCESS module options
|
rfPower->setMax(R9M_LBT_POWER_MAX);
|
||||||
// - ACCESS Rx list
|
} else {
|
||||||
|
rfPower->setValues(STR_R9M_FCC_POWER_VALUES);
|
||||||
|
rfPower->setMax(R9M_FCC_POWER_MAX);
|
||||||
|
}
|
||||||
|
lv_event_send(rfPower->getLvObj(), LV_EVENT_VALUE_CHANGED, nullptr);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(PCBNV14)
|
#if defined(PCBNV14)
|
||||||
@@ -629,7 +626,11 @@ static void update_module_window(lv_event_t* e)
|
|||||||
ModuleWindow* mw = (ModuleWindow*)lv_event_get_user_data(e);
|
ModuleWindow* mw = (ModuleWindow*)lv_event_get_user_data(e);
|
||||||
if (!mw) return;
|
if (!mw) return;
|
||||||
|
|
||||||
mw->updateSubType();
|
if (isModuleISRM(mw->getModuleIdx())) {
|
||||||
|
mw->updateModule();
|
||||||
|
} else {
|
||||||
|
mw->updateSubType();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ModulePage::ModulePage(uint8_t moduleIdx) : Page(ICON_MODEL_SETUP)
|
ModulePage::ModulePage(uint8_t moduleIdx) : Page(ICON_MODEL_SETUP)
|
||||||
|
|||||||
Reference in New Issue
Block a user