fix(nv14): incorrect read/write of module data (#4953)
This commit is contained in:
@@ -83,17 +83,15 @@ AFHDS2ASettings::AFHDS2ASettings(Window* parent, const FlexGridLayout& g,
|
|||||||
[=](uint8_t v) { md->flysky.mode = v; });
|
[=](uint8_t v) { md->flysky.mode = v; });
|
||||||
|
|
||||||
#if defined(PCBNV14)
|
#if defined(PCBNV14)
|
||||||
if (getNV14RfFwVersion() >= 0x1000E) {
|
line = newLine(grid);
|
||||||
line = newLine(grid);
|
static const char* _rf_power[] = {"Default", "High"};
|
||||||
static const char* _rf_power[] = {"Default", "High"};
|
afhds2RFPowerText = new StaticText(line, rect_t{}, STR_MULTI_RFPOWER);
|
||||||
afhds2RFPowerText = new StaticText(line, rect_t{}, STR_MULTI_RFPOWER);
|
afhds2RFPowerChoice = new Choice(line, rect_t{}, _rf_power, 0, 1,
|
||||||
afhds2RFPowerChoice = new Choice(line, rect_t{}, _rf_power, 0, 1,
|
GET_DEFAULT(md->flysky.rfPower),
|
||||||
GET_DEFAULT(md->flysky.rfPower),
|
[=](int32_t newValue) -> void {
|
||||||
[=](int32_t newValue) -> void {
|
md->flysky.rfPower = newValue;
|
||||||
md->flysky.rfPower = newValue;
|
resetPulsesAFHDS2();
|
||||||
resetPulsesAFHDS2();
|
});
|
||||||
});
|
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
hideAFHDS2Options();
|
hideAFHDS2Options();
|
||||||
@@ -104,10 +102,8 @@ void AFHDS2ASettings::hideAFHDS2Options()
|
|||||||
afhds2OptionsLabel->hide();
|
afhds2OptionsLabel->hide();
|
||||||
afhds2ProtoOpts->hide();
|
afhds2ProtoOpts->hide();
|
||||||
#if defined(PCBNV14)
|
#if defined(PCBNV14)
|
||||||
if (afhds2RFPowerText != nullptr)
|
afhds2RFPowerText->hide();
|
||||||
afhds2RFPowerText->hide();
|
afhds2RFPowerChoice->hide();
|
||||||
if (afhds2RFPowerChoice != nullptr)
|
|
||||||
afhds2RFPowerChoice->hide();
|
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -116,23 +112,24 @@ void AFHDS2ASettings::showAFHDS2Options()
|
|||||||
afhds2OptionsLabel->show();
|
afhds2OptionsLabel->show();
|
||||||
afhds2ProtoOpts->show();
|
afhds2ProtoOpts->show();
|
||||||
#if defined(PCBNV14)
|
#if defined(PCBNV14)
|
||||||
if (afhds2RFPowerText != nullptr)
|
bool showRFPower = (getNV14RfFwVersion() >= 0x1000E);
|
||||||
afhds2RFPowerText->show();
|
afhds2RFPowerText->show(showRFPower);
|
||||||
if (afhds2RFPowerChoice != nullptr)
|
afhds2RFPowerChoice->show(showRFPower);
|
||||||
{
|
if (showRFPower && (showRFPower != hasRFPower)) {
|
||||||
afhds2RFPowerChoice->show();
|
hasRFPower = showRFPower;
|
||||||
lv_event_send(afhds2RFPowerChoice->getLvObj(), LV_EVENT_VALUE_CHANGED, nullptr);
|
lv_event_send(afhds2RFPowerChoice->getLvObj(), LV_EVENT_VALUE_CHANGED, nullptr);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void AFHDS2ASettings::checkEvents() {
|
void AFHDS2ASettings::checkEvents()
|
||||||
|
{
|
||||||
Window::checkEvents();
|
Window::checkEvents();
|
||||||
|
update();
|
||||||
}
|
}
|
||||||
|
|
||||||
void AFHDS2ASettings::update()
|
void AFHDS2ASettings::update()
|
||||||
{
|
{
|
||||||
lastRefresh = get_tmr10ms();
|
|
||||||
if (isModuleAFHDS2A(moduleIdx)) {
|
if (isModuleAFHDS2A(moduleIdx)) {
|
||||||
showAFHDS2Options();
|
showAFHDS2Options();
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -31,11 +31,11 @@ class AFHDS2ASettings : public Window, public ModuleOptions
|
|||||||
uint8_t moduleIdx;
|
uint8_t moduleIdx;
|
||||||
ModuleData* md;
|
ModuleData* md;
|
||||||
FlexGridLayout grid;
|
FlexGridLayout grid;
|
||||||
tmr10ms_t lastRefresh = 0;
|
|
||||||
|
|
||||||
Window* afhds2OptionsLabel = nullptr;
|
Window* afhds2OptionsLabel = nullptr;
|
||||||
Window* afhds2ProtoOpts = nullptr;
|
Window* afhds2ProtoOpts = nullptr;
|
||||||
#if defined(PCBNV14)
|
#if defined(PCBNV14)
|
||||||
|
bool hasRFPower = false;
|
||||||
Window* afhds2RFPowerText = nullptr;
|
Window* afhds2RFPowerText = nullptr;
|
||||||
Window* afhds2RFPowerChoice = nullptr;
|
Window* afhds2RFPowerChoice = nullptr;
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -2063,11 +2063,13 @@ static void r_modSubtype(void* user, uint8_t* data, uint32_t bitoffs,
|
|||||||
md->subType = yaml_parse_enum(enum_ISRM_Subtypes, val, val_len);
|
md->subType = yaml_parse_enum(enum_ISRM_Subtypes, val, val_len);
|
||||||
} else if (isModuleTypeR9MNonAccess(md->type)) {
|
} else if (isModuleTypeR9MNonAccess(md->type)) {
|
||||||
md->subType = yaml_parse_enum(enum_R9M_Subtypes, val, val_len);
|
md->subType = yaml_parse_enum(enum_R9M_Subtypes, val, val_len);
|
||||||
|
#if defined(AFHDS3)
|
||||||
} else if (md->type == MODULE_TYPE_FLYSKY_AFHDS2A) {
|
} else if (md->type == MODULE_TYPE_FLYSKY_AFHDS2A) {
|
||||||
// Flysky sub-types have been converted into separate module types
|
// Flysky sub-types have been converted into separate module types
|
||||||
auto sub_type = yaml_parse_enum(enum_FLYSKY_Subtypes, val, val_len);
|
auto sub_type = yaml_parse_enum(enum_FLYSKY_Subtypes, val, val_len);
|
||||||
if (sub_type == FLYSKY_SUBTYPE_AFHDS3)
|
if (sub_type == FLYSKY_SUBTYPE_AFHDS3)
|
||||||
md->type = MODULE_TYPE_FLYSKY_AFHDS3;
|
md->type = MODULE_TYPE_FLYSKY_AFHDS3;
|
||||||
|
#endif
|
||||||
} else if (md->type == MODULE_TYPE_MULTIMODULE) {
|
} else if (md->type == MODULE_TYPE_MULTIMODULE) {
|
||||||
#if defined(MULTIMODULE)
|
#if defined(MULTIMODULE)
|
||||||
// Read type/subType by the book (see MPM documentation)
|
// Read type/subType by the book (see MPM documentation)
|
||||||
@@ -2128,6 +2130,10 @@ static bool w_modSubtype(void* user, uint8_t* data, uint32_t bitoffs,
|
|||||||
str = yaml_output_enum(md->subType, enum_DSM2_Subtypes);
|
str = yaml_output_enum(md->subType, enum_DSM2_Subtypes);
|
||||||
} else if (md->type == MODULE_TYPE_PPM) {
|
} else if (md->type == MODULE_TYPE_PPM) {
|
||||||
str = yaml_output_enum(md->subType, enum_PPM_Subtypes);
|
str = yaml_output_enum(md->subType, enum_PPM_Subtypes);
|
||||||
|
} else if (md->type == MODULE_TYPE_FLYSKY_AFHDS2A) {
|
||||||
|
str = yaml_output_enum(FLYSKY_SUBTYPE_AFHDS2A, enum_FLYSKY_Subtypes);
|
||||||
|
} else if (md->type == MODULE_TYPE_FLYSKY_AFHDS3) {
|
||||||
|
str = yaml_output_enum(FLYSKY_SUBTYPE_AFHDS3, enum_FLYSKY_Subtypes);
|
||||||
} else {
|
} else {
|
||||||
str = yaml_unsigned2str(val);
|
str = yaml_unsigned2str(val);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user