Fixes for FlySkySettings
This commit is contained in:
committed by
Raphael Coeffic
parent
c616204cb9
commit
35e14ff83e
@@ -28,8 +28,8 @@
|
|||||||
|
|
||||||
class FSProtoOpts : public FormGroup
|
class FSProtoOpts : public FormGroup
|
||||||
{
|
{
|
||||||
std::function<uint8_t()> getMode;
|
std::function<uint8_t()> _getMode;
|
||||||
std::function<void(uint8_t)> setMode;
|
std::function<void(uint8_t)> _setMode;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
FSProtoOpts(Window* parent, std::function<uint8_t()> getMode,
|
FSProtoOpts(Window* parent, std::function<uint8_t()> getMode,
|
||||||
@@ -39,29 +39,43 @@ public:
|
|||||||
FSProtoOpts::FSProtoOpts(Window* parent, std::function<uint8_t()> getMode,
|
FSProtoOpts::FSProtoOpts(Window* parent, std::function<uint8_t()> getMode,
|
||||||
std::function<void(uint8_t)> setMode) :
|
std::function<void(uint8_t)> setMode) :
|
||||||
FormGroup(parent, rect_t{}),
|
FormGroup(parent, rect_t{}),
|
||||||
getMode(std::move(getMode)),
|
_getMode(std::move(getMode)),
|
||||||
setMode(std::move(setMode))
|
_setMode(std::move(setMode))
|
||||||
{
|
{
|
||||||
setFlexLayout(LV_FLEX_FLOW_ROW);
|
setFlexLayout(LV_FLEX_FLOW_ROW);
|
||||||
|
|
||||||
// PPM / PWM
|
// PPM / PWM
|
||||||
new Choice(
|
new Choice(
|
||||||
this, rect_t{}, STR_FLYSKY_PULSE_PROTO, 0, 1,
|
this, rect_t{}, STR_FLYSKY_PULSE_PROTO, 0, 1,
|
||||||
[=]() { return getMode() >> 1; },
|
[=]() -> int { return _getMode() >> 1; },
|
||||||
[=](int v) { setMode((getMode() & 1) | ((v & 1) << 1)); SET_DIRTY(); });
|
[=](int v) {
|
||||||
|
_setMode((_getMode() & 1) | ((v & 1) << 1));
|
||||||
|
SET_DIRTY();
|
||||||
|
});
|
||||||
|
|
||||||
// SBUS / iBUS
|
// SBUS / iBUS
|
||||||
new Choice(
|
new Choice(
|
||||||
this, rect_t{}, STR_FLYSKY_SERIAL_PROTO, 0, 1,
|
this, rect_t{}, STR_FLYSKY_SERIAL_PROTO, 0, 1,
|
||||||
[=]() { return getMode() & 1; },
|
[=]() -> int { return _getMode() & 1; },
|
||||||
[=](int v) { setMode((getMode() & 2) | (v & 1)); SET_DIRTY(); });
|
[=](int v) {
|
||||||
|
_setMode((_getMode() & 2) | (v & 1));
|
||||||
|
SET_DIRTY();
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
FlySkySettings::FlySkySettings(Window* parent, const FlexGridLayout& g,
|
FlySkySettings::FlySkySettings(Window* parent, const FlexGridLayout& g,
|
||||||
uint8_t moduleIdx) :
|
uint8_t moduleIdx) :
|
||||||
FormGroup(parent, rect_t{}), md(&g_model.moduleData[moduleIdx])
|
FormGroup(parent, rect_t{}),
|
||||||
|
moduleIdx(moduleIdx),
|
||||||
|
md(&g_model.moduleData[moduleIdx]),
|
||||||
|
grid(g)
|
||||||
{
|
{
|
||||||
FlexGridLayout grid(g);
|
|
||||||
setFlexLayout();
|
setFlexLayout();
|
||||||
|
}
|
||||||
|
|
||||||
|
void FlySkySettings::update()
|
||||||
|
{
|
||||||
|
clear();
|
||||||
|
|
||||||
// RX options:
|
// RX options:
|
||||||
auto line = newLine(&grid);
|
auto line = newLine(&grid);
|
||||||
|
|||||||
@@ -28,9 +28,11 @@ struct ModuleData;
|
|||||||
|
|
||||||
class FlySkySettings : public FormGroup, public ModuleOptions
|
class FlySkySettings : public FormGroup, public ModuleOptions
|
||||||
{
|
{
|
||||||
|
uint8_t moduleIdx;
|
||||||
ModuleData* md;
|
ModuleData* md;
|
||||||
|
FlexGridLayout grid;
|
||||||
|
|
||||||
void update() override {}
|
void update() override;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
FlySkySettings(Window* parent, const FlexGridLayout& g, uint8_t moduleIdx);
|
FlySkySettings(Window* parent, const FlexGridLayout& g, uint8_t moduleIdx);
|
||||||
|
|||||||
@@ -138,10 +138,16 @@ void ModuleWindow::updateModule()
|
|||||||
FlexGridLayout grid(col_dsc, row_dsc, 2);
|
FlexGridLayout grid(col_dsc, row_dsc, 2);
|
||||||
clear();
|
clear();
|
||||||
|
|
||||||
|
modOpts = nullptr;
|
||||||
|
chRange = nullptr;
|
||||||
|
bindButton = nullptr;
|
||||||
|
rangeButton = nullptr;
|
||||||
|
registerButton = nullptr;
|
||||||
|
fsLine = nullptr;
|
||||||
|
|
||||||
// Module parameters
|
// Module parameters
|
||||||
ModuleData* md = &g_model.moduleData[moduleIdx];
|
ModuleData* md = &g_model.moduleData[moduleIdx];
|
||||||
|
|
||||||
modOpts = nullptr;
|
|
||||||
if (md->type == MODULE_TYPE_NONE) {
|
if (md->type == MODULE_TYPE_NONE) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -630,8 +636,9 @@ ModulePage::ModulePage(uint8_t moduleIdx) : Page(ICON_MODEL_SETUP)
|
|||||||
moduleChoice->setSetValueHandler([=](int32_t newValue) {
|
moduleChoice->setSetValueHandler([=](int32_t newValue) {
|
||||||
setModuleType(moduleIdx, newValue);
|
setModuleType(moduleIdx, newValue);
|
||||||
|
|
||||||
subTypeChoice->update();
|
|
||||||
moduleWindow->updateModule();
|
moduleWindow->updateModule();
|
||||||
|
subTypeChoice->update();
|
||||||
|
|
||||||
SET_DIRTY();
|
SET_DIRTY();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user