fix(AFHDS3): Sync UI with Flysky AFHDS3 module stored settings (#3501)
* Refresh UI module settings when AHFDS3 config is updated. * Fix scroll order for module options when 'FlySky' module type selected. Fix simulator crash issues related to FlySky module. * Fixed UI refresh problems in UI widget ordering fix. * Refresh config when receiver is connected. * Disable change of bind time options when receiver is connected. * Rename methods to better distinguish between buffer fill or actual send. * Clean and tidy up AFHDS3 state flow. * Implemented settings sync upon setting changes. * Added RF power settings for IRM301/FRM303. * Added RF power sensors for FRM303. * Fixed config not saved and only FRM303 supports RF power settings. * Fixed RF power command error. * Fixed a crash for IRM301. * Always check if port exists and return nullptr for driver. * fix: Make Companion preserve settings *as is* --------- Co-authored-by: Phil Mitchell <phil.a.mitchell@gmail.com> Co-authored-by: Peter Feerick <peter.feerick@gmail.com>
This commit is contained in:
co-authored by
Phil Mitchell
Peter Feerick
parent
bdb78ba2ef
commit
cb533f4493
@@ -80,7 +80,8 @@ PWMfrequencyChoice::PWMfrequencyChoice(Window* parent, uint8_t moduleIdx, uint8_
|
||||
setFlexLayout(LV_FLEX_FLOW_ROW);
|
||||
lv_obj_set_width(lvobj, LV_SIZE_CONTENT);
|
||||
uint16_t &pwmvalue_type = _v1_pwmvalue_type[moduleIdx][channelIdx];
|
||||
auto vCfg = &afhds3::getConfig(moduleIdx)->v1;
|
||||
auto cfg = afhds3::getConfig(moduleIdx);
|
||||
auto vCfg = &cfg->v1;
|
||||
if( 0xff ==pwmvalue_type )
|
||||
{
|
||||
if ( 50 == vCfg->PWMFrequenciesV1.PWMFrequencies[channelIdx] ) pwmvalue_type = 0;
|
||||
@@ -96,12 +97,14 @@ PWMfrequencyChoice::PWMfrequencyChoice(Window* parent, uint8_t moduleIdx, uint8_
|
||||
[=,&pwmvalue_type](int32_t newValue) {
|
||||
pwmvalue_type=newValue;
|
||||
vCfg->PWMFrequenciesV1.PWMFrequencies[channelIdx] = _v1_index2pwmvalue[newValue];
|
||||
DIRTY_CMD(cfg, afhds3::DirtyConfig::DC_RX_CMD_FREQUENCY_V1);
|
||||
});
|
||||
auto num_edit = new NumberEdit(this, rect_t{}, 50, 400,
|
||||
[=,&pwmvalue_type] { return (pwmvalue_type==4?vCfg->PWMFrequenciesV1.PWMFrequencies[channelIdx]:50); },
|
||||
[=](int16_t newVal) {
|
||||
vCfg->PWMFrequenciesV1.PWMFrequencies[channelIdx] = newVal;
|
||||
});
|
||||
auto num_edit = new NumberEdit(this, rect_t{}, 50, 400,
|
||||
[=,&pwmvalue_type] { return (pwmvalue_type==4?vCfg->PWMFrequenciesV1.PWMFrequencies[channelIdx]:50); },
|
||||
[=](int16_t newVal) {
|
||||
vCfg->PWMFrequenciesV1.PWMFrequencies[channelIdx] = newVal;
|
||||
DIRTY_CMD(cfg, afhds3::DirtyConfig::DC_RX_CMD_FREQUENCY_V1);
|
||||
});
|
||||
c_obj = choice->getLvObj();
|
||||
auto btn_obj = num_edit->getLvObj();
|
||||
lv_obj_add_event_cb(c_obj, pwmfreq_changed, LV_EVENT_VALUE_CHANGED, btn_obj);
|
||||
@@ -114,7 +117,8 @@ PWMfrequencyChoice::PWMfrequencyChoice(Window* parent, uint8_t moduleIdx ) :
|
||||
setFlexLayout(LV_FLEX_FLOW_ROW);
|
||||
lv_obj_set_width(lvobj, LV_SIZE_CONTENT);
|
||||
uint16_t &pwmvalue_type = _v1_pwmvalue_type[moduleIdx][0];
|
||||
auto vCfg = &afhds3::getConfig(moduleIdx)->v0;
|
||||
auto cfg = afhds3::getConfig(moduleIdx);
|
||||
auto vCfg = &cfg->v0;
|
||||
if( 0xff ==pwmvalue_type )
|
||||
{
|
||||
if ( 50 == (vCfg->PWMFrequency.Frequency&0x7fff) ) pwmvalue_type = 0;
|
||||
@@ -124,16 +128,18 @@ PWMfrequencyChoice::PWMfrequencyChoice(Window* parent, uint8_t moduleIdx ) :
|
||||
auto choice = new Choice(this, rect_t{}, _v0_pwmfreq_types, 0, 2,
|
||||
[=,&pwmvalue_type]{
|
||||
return pwmvalue_type;
|
||||
},
|
||||
},
|
||||
[=,&pwmvalue_type](int32_t newValue) {
|
||||
pwmvalue_type=newValue;
|
||||
vCfg->PWMFrequency.Frequency = _v0_index2pwmvalue[newValue];
|
||||
});
|
||||
auto num_edit = new NumberEdit(this, rect_t{}, 50, 400,
|
||||
[=,&pwmvalue_type] { return (pwmvalue_type==2?vCfg->PWMFrequency.Frequency&0x7fff:50); },
|
||||
[=](int16_t newVal) {
|
||||
vCfg->PWMFrequency.Frequency = newVal;
|
||||
});
|
||||
DIRTY_CMD(cfg, afhds3::DirtyConfig::DC_RX_CMD_FREQUENCY_V0);
|
||||
});
|
||||
auto num_edit = new NumberEdit(this, rect_t{}, 50, 400,
|
||||
[=,&pwmvalue_type] { return (pwmvalue_type==2?vCfg->PWMFrequency.Frequency&0x7fff:50); },
|
||||
[=](int16_t newVal) {
|
||||
vCfg->PWMFrequency.Frequency = newVal;
|
||||
DIRTY_CMD(cfg, afhds3::DirtyConfig::DC_RX_CMD_FREQUENCY_V0);
|
||||
});
|
||||
c_obj = choice->getLvObj();
|
||||
auto btn_obj = num_edit->getLvObj();
|
||||
lv_obj_add_event_cb(c_obj, pwmfreq_changedV0, LV_EVENT_VALUE_CHANGED, btn_obj);
|
||||
@@ -145,8 +151,6 @@ void PWMfrequencyChoice::update() const
|
||||
lv_event_send(c_obj, LV_EVENT_VALUE_CHANGED, nullptr);
|
||||
}
|
||||
|
||||
|
||||
|
||||
AFHDS3_Options::AFHDS3_Options(uint8_t moduleIdx) : Page(ICON_MODEL_SETUP)
|
||||
{
|
||||
cfg = afhds3::getConfig(moduleIdx);
|
||||
@@ -179,7 +183,8 @@ AFHDS3_Options::AFHDS3_Options(uint8_t moduleIdx) : Page(ICON_MODEL_SETUP)
|
||||
temp_str += " ";
|
||||
temp_str += STR_SYNC;
|
||||
new StaticText(line, rect_t{}, temp_str);
|
||||
new CheckBox(line, rect_t{}, GET_SET_DEFAULT(vCfg->PWMFrequency.Synchronized));
|
||||
new CheckBox(line, rect_t{}, GET_SET_AND_SYNC(cfg, vCfg->PWMFrequency.Synchronized,
|
||||
afhds3::DirtyConfig::DC_RX_CMD_FREQUENCY_V0));
|
||||
line = form->newLine(&grid);
|
||||
|
||||
temp_str = STR_CH;
|
||||
@@ -187,12 +192,12 @@ AFHDS3_Options::AFHDS3_Options(uint8_t moduleIdx) : Page(ICON_MODEL_SETUP)
|
||||
new StaticText(line, rect_t{}, temp_str );
|
||||
new Choice(line, rect_t{}, _analog_outputs,
|
||||
afhds3::SES_ANALOG_OUTPUT_PWM, afhds3::SES_ANALOG_OUTPUT_PPM,
|
||||
GET_SET_DEFAULT(vCfg->AnalogOutput));
|
||||
GET_SET_AND_SYNC(cfg, vCfg->AnalogOutput, afhds3::DirtyConfig::DC_RX_CMD_OUT_PWM_PPM_MODE));
|
||||
|
||||
line = form->newLine(&grid);
|
||||
new StaticText(line, rect_t{}, STR_SERIAL_BUS);
|
||||
new Choice(line, rect_t{}, _bus_types, 0, 2,
|
||||
GET_SET_DEFAULT(cfg->BusType.ExternalBusType));
|
||||
GET_SET_AND_SYNC(cfg, cfg->others.ExternalBusType, afhds3::DirtyConfig::DC_RX_CMD_BUS_TYPE_V0));
|
||||
} else {
|
||||
auto vCfg = &cfg->v1;
|
||||
for (uint8_t i = 0; i < channel_num[vCfg->PhyMode]; i++) {
|
||||
@@ -212,6 +217,7 @@ AFHDS3_Options::AFHDS3_Options(uint8_t moduleIdx) : Page(ICON_MODEL_SETUP)
|
||||
[=](uint8_t newVal) {
|
||||
vCfg->PWMFrequenciesV1.Synchronized &= ~(1<<i);
|
||||
vCfg->PWMFrequenciesV1.Synchronized |= (newVal?1:0)<<i;
|
||||
DIRTY_CMD(cfg, afhds3::DirtyConfig::DC_RX_CMD_FREQUENCY_V1);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -225,7 +231,10 @@ AFHDS3_Options::AFHDS3_Options(uint8_t moduleIdx) : Page(ICON_MODEL_SETUP)
|
||||
GET_DEFAULT(vCfg->NewPortTypes[i]),
|
||||
[=](int32_t newValue) {
|
||||
if(!newValue)
|
||||
{
|
||||
vCfg->NewPortTypes[i] = newValue;
|
||||
DIRTY_CMD(cfg, afhds3::DirtyConfig::DC_RX_CMD_PORT_TYPE_V1);
|
||||
}
|
||||
else {
|
||||
uint8_t j = 0;
|
||||
for ( j = 0; j < SES_NPT_NB_MAX_PORTS; j++) {
|
||||
@@ -233,7 +242,11 @@ AFHDS3_Options::AFHDS3_Options(uint8_t moduleIdx) : Page(ICON_MODEL_SETUP)
|
||||
break;
|
||||
}
|
||||
//The RX does not support two or more ports to output IBUS (the same is true for PPM and SBUS).
|
||||
if(j==SES_NPT_NB_MAX_PORTS ) vCfg->NewPortTypes[i] = newValue;
|
||||
if(j==SES_NPT_NB_MAX_PORTS )
|
||||
{
|
||||
vCfg->NewPortTypes[i] = newValue;
|
||||
DIRTY_CMD(cfg, afhds3::DirtyConfig::DC_RX_CMD_PORT_TYPE_V1);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -250,5 +263,8 @@ AFHDS3_Options::AFHDS3_Options(uint8_t moduleIdx) : Page(ICON_MODEL_SETUP)
|
||||
new Choice(line, rect_t{}, signed_strength_ch,
|
||||
0, channel_num[cfg->v1.PhyMode],
|
||||
[=] { return cfg->v1.SignalStrengthRCChannelNb==0xff?0:cfg->v1.SignalStrengthRCChannelNb+1; },
|
||||
[=](int32_t newValue) { newValue?cfg->v1.SignalStrengthRCChannelNb = newValue-1:cfg->v1.SignalStrengthRCChannelNb=0xff;});
|
||||
[=](int32_t newValue) {
|
||||
newValue?cfg->v1.SignalStrengthRCChannelNb = newValue-1:cfg->v1.SignalStrengthRCChannelNb=0xff;
|
||||
DIRTY_CMD(cfg, afhds3::DirtyConfig::DC_RX_CMD_RSSI_CHANNEL_SETUP);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -28,6 +28,7 @@
|
||||
|
||||
#include "pulses/flysky.h"
|
||||
#include "pulses/afhds3.h"
|
||||
#include "pulses/afhds3_config.h"
|
||||
|
||||
#define SET_DIRTY() storageDirty(EE_MODEL)
|
||||
|
||||
@@ -88,71 +89,170 @@ FlySkySettings::FlySkySettings(Window* parent, const FlexGridLayout& g,
|
||||
grid(g)
|
||||
{
|
||||
setFlexLayout();
|
||||
|
||||
FormGroup::Line* line;
|
||||
|
||||
#if defined(AFHDS2)
|
||||
// RX options:
|
||||
line = newLine(&grid);
|
||||
afhds2OptionsLabel = new StaticText(line, rect_t{}, STR_OPTIONS, 0, COLOR_THEME_PRIMARY1);
|
||||
|
||||
afhds2ProtoOpts = new FSProtoOpts(
|
||||
line, [=]() { return md->flysky.mode; },
|
||||
[=](uint8_t v) { md->flysky.mode = v; });
|
||||
|
||||
#if defined(PCBNV14)
|
||||
if (getNV14RfFwVersion() >= 0x1000E) {
|
||||
line = newLine(&grid);
|
||||
static const char* _rf_power[] = {"Default", "High"};
|
||||
afhds2RFPowerText = new StaticText(line, rect_t{}, STR_MULTI_RFPOWER);
|
||||
afhds2RFPowerChoice = new Choice(line, rect_t{}, _rf_power, 0, 1,
|
||||
GET_DEFAULT(md->flysky.rfPower),
|
||||
[=](int32_t newValue) -> void {
|
||||
md->flysky.rfPower = newValue;
|
||||
resetPulsesAFHDS2();
|
||||
});
|
||||
#endif
|
||||
}
|
||||
|
||||
hideAFHDS2Options();
|
||||
#endif
|
||||
|
||||
#if defined(AFHDS3)
|
||||
// Status
|
||||
line = newLine(&grid);
|
||||
afhds3StatusLabel = new StaticText(line, rect_t{}, STR_MODULE_STATUS, 0, COLOR_THEME_PRIMARY1);
|
||||
afhds3StatusText = new DynamicText(line, rect_t{}, [=] {
|
||||
char msg[64] = "";
|
||||
getModuleStatusString(moduleIdx, msg);
|
||||
return std::string(msg);
|
||||
});
|
||||
|
||||
// TYPE
|
||||
line = newLine(&grid);
|
||||
afhds3TypeLabel = new StaticText(line, rect_t{}, STR_TYPE, 0, COLOR_THEME_PRIMARY1);
|
||||
|
||||
afhds3TypeForm = new FormGroup(line, rect_t{});
|
||||
afhds3TypeForm->setFlexLayout(LV_FLEX_FLOW_ROW_WRAP);
|
||||
lv_obj_set_style_grid_cell_x_align(afhds3TypeForm->getLvObj(), LV_GRID_ALIGN_STRETCH, 0);
|
||||
|
||||
afhds3PhyMode = new Choice(afhds3TypeForm, rect_t{}, _afhds3_phy_mode, 0, afhds3::PHYMODE_MAX,
|
||||
GET_SET_DEFAULT(md->afhds3.phyMode));
|
||||
lv_obj_set_style_bg_color(afhds3PhyMode->getLvObj(), makeLvColor(COLOR_THEME_DISABLED), LV_PART_MAIN | LV_STATE_DISABLED);
|
||||
|
||||
afhds3Emi = new Choice(afhds3TypeForm, rect_t{}, _afhds3_region,
|
||||
afhds3::LNK_ES_CE, afhds3::LNK_ES_FCC,
|
||||
GET_SET_DEFAULT(md->afhds3.emi));
|
||||
lv_obj_set_style_bg_color(afhds3Emi->getLvObj(), makeLvColor(COLOR_THEME_DISABLED), LV_PART_MAIN | LV_STATE_DISABLED);
|
||||
|
||||
new TextButton(afhds3TypeForm, rect_t{}, STR_MODULE_OPTIONS,
|
||||
[=]() {
|
||||
afhds3::applyModelConfig(moduleIdx);
|
||||
new AFHDS3_Options(moduleIdx);
|
||||
return 0;
|
||||
});
|
||||
|
||||
if (moduleIdx == EXTERNAL_MODULE) {
|
||||
line = newLine(&grid);
|
||||
auto cfg = afhds3::getConfig(moduleIdx);
|
||||
new StaticText(line, rect_t{}, STR_MULTI_RFPOWER);
|
||||
afhds3RfPower = new Choice(line, rect_t{}, STR_AFHDS3_POWERS, 0, AFHDS3_FRM303_POWER_MAX,
|
||||
GET_DEFAULT(md->afhds3.rfPower),
|
||||
[=](int32_t newValue) { md->afhds3.rfPower = newValue;
|
||||
cfg->others.dirtyFlag |= (uint32_t) 1 << afhds3::DirtyConfig::DC_RX_CMD_TX_PWR;
|
||||
SET_DIRTY();});
|
||||
}
|
||||
|
||||
hideAFHDS3Options();
|
||||
#endif
|
||||
}
|
||||
|
||||
#if defined(AFHDS2)
|
||||
void FlySkySettings::hideAFHDS2Options()
|
||||
{
|
||||
lv_obj_add_flag(afhds2OptionsLabel->getLvObj(), LV_OBJ_FLAG_HIDDEN);
|
||||
lv_obj_add_flag(afhds2ProtoOpts->getLvObj(), LV_OBJ_FLAG_HIDDEN);
|
||||
#if defined(PCBNV14)
|
||||
if (afhds2RFPowerText != nullptr)
|
||||
lv_obj_add_flag(afhds2RFPowerText->getLvObj(), LV_OBJ_FLAG_HIDDEN);
|
||||
if (afhds2RFPowerChoice != nullptr)
|
||||
lv_obj_add_flag(afhds2RFPowerChoice->getLvObj(), LV_OBJ_FLAG_HIDDEN);
|
||||
#endif
|
||||
}
|
||||
|
||||
void FlySkySettings::showAFHDS2Options()
|
||||
{
|
||||
lv_obj_clear_flag(afhds2OptionsLabel->getLvObj(), LV_OBJ_FLAG_HIDDEN);
|
||||
lv_obj_clear_flag(afhds2ProtoOpts->getLvObj(), LV_OBJ_FLAG_HIDDEN);
|
||||
#if defined(PCBNV14)
|
||||
if (afhds2RFPowerText != nullptr)
|
||||
lv_obj_clear_flag(afhds2RFPowerText->getLvObj(), LV_OBJ_FLAG_HIDDEN);
|
||||
if (afhds2RFPowerChoice != nullptr)
|
||||
{
|
||||
lv_obj_clear_flag(afhds2RFPowerChoice->getLvObj(), LV_OBJ_FLAG_HIDDEN);
|
||||
lv_event_send(afhds2RFPowerChoice->getLvObj(), LV_EVENT_VALUE_CHANGED, nullptr);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(AFHDS3)
|
||||
void FlySkySettings::hideAFHDS3Options()
|
||||
{
|
||||
lv_obj_add_flag(afhds3StatusLabel->getLvObj(), LV_OBJ_FLAG_HIDDEN);
|
||||
lv_obj_add_flag(afhds3StatusText->getLvObj(), LV_OBJ_FLAG_HIDDEN);
|
||||
lv_obj_add_flag(afhds3TypeLabel->getLvObj(), LV_OBJ_FLAG_HIDDEN);
|
||||
lv_obj_add_flag(afhds3TypeForm->getLvObj(), LV_OBJ_FLAG_HIDDEN);
|
||||
}
|
||||
|
||||
void FlySkySettings::showAFHDS3Options()
|
||||
{
|
||||
lv_obj_clear_flag(afhds3StatusLabel->getLvObj(), LV_OBJ_FLAG_HIDDEN);
|
||||
lv_obj_clear_flag(afhds3StatusText->getLvObj(), LV_OBJ_FLAG_HIDDEN);
|
||||
lv_obj_clear_flag(afhds3TypeLabel->getLvObj(), LV_OBJ_FLAG_HIDDEN);
|
||||
lv_obj_clear_flag(afhds3TypeForm->getLvObj(), LV_OBJ_FLAG_HIDDEN);
|
||||
lv_event_send(afhds3StatusText->getLvObj(), LV_EVENT_VALUE_CHANGED, nullptr);
|
||||
lv_event_send(afhds3PhyMode->getLvObj(), LV_EVENT_VALUE_CHANGED, nullptr);
|
||||
lv_event_send(afhds3Emi->getLvObj(), LV_EVENT_VALUE_CHANGED, nullptr);
|
||||
if (moduleIdx == EXTERNAL_MODULE) {
|
||||
lv_event_send(afhds3RfPower->getLvObj(), LV_EVENT_VALUE_CHANGED, nullptr);
|
||||
}
|
||||
if (afhds3::getConfig(moduleIdx)->others.isConnected)
|
||||
{
|
||||
lv_obj_add_state(afhds3PhyMode->getLvObj(), LV_STATE_DISABLED);
|
||||
lv_obj_add_state(afhds3Emi->getLvObj(), LV_STATE_DISABLED);
|
||||
}
|
||||
else
|
||||
{
|
||||
lv_obj_clear_state(afhds3PhyMode->getLvObj(), LV_STATE_DISABLED);
|
||||
lv_obj_clear_state(afhds3Emi->getLvObj(), LV_STATE_DISABLED);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
void FlySkySettings::checkEvents() {
|
||||
if (afhds3::getConfig(moduleIdx)->others.lastUpdated > lastRefresh) {
|
||||
update();
|
||||
}
|
||||
FormGroup::checkEvents();
|
||||
}
|
||||
|
||||
void FlySkySettings::update()
|
||||
{
|
||||
clear();
|
||||
|
||||
lastRefresh = get_tmr10ms();
|
||||
#if defined(AFHDS2)
|
||||
if (isModuleAFHDS2A(moduleIdx)) {
|
||||
// RX options:
|
||||
auto line = newLine(&grid);
|
||||
new StaticText(line, rect_t{}, STR_OPTIONS, 0, COLOR_THEME_PRIMARY1);
|
||||
|
||||
new FSProtoOpts(
|
||||
line, [=]() { return md->flysky.mode; },
|
||||
[=](uint8_t v) { md->flysky.mode = v; });
|
||||
|
||||
#if defined(AFHDS2) && defined(PCBNV14)
|
||||
if (getNV14RfFwVersion() >= 0x1000E) {
|
||||
line = newLine(&grid);
|
||||
static const char* _rf_power[] = {"Default", "High"};
|
||||
new StaticText(line, rect_t{}, STR_MULTI_RFPOWER);
|
||||
new Choice(line, rect_t{}, _rf_power, 0, 1,
|
||||
GET_DEFAULT(md->flysky.rfPower),
|
||||
[=](int32_t newValue) -> void {
|
||||
md->flysky.rfPower = newValue;
|
||||
resetPulsesAFHDS2();
|
||||
});
|
||||
}
|
||||
#endif
|
||||
showAFHDS2Options();
|
||||
} else {
|
||||
hideAFHDS2Options();
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(AFHDS3)
|
||||
if (isModuleAFHDS3(moduleIdx)) {
|
||||
|
||||
// Status
|
||||
auto line = newLine(&grid);
|
||||
new StaticText(line, rect_t{}, STR_MODULE_STATUS, 0, COLOR_THEME_PRIMARY1);
|
||||
new DynamicText(line, rect_t{}, [=] {
|
||||
char msg[64] = "";
|
||||
getModuleStatusString(moduleIdx, msg);
|
||||
return std::string(msg);
|
||||
});
|
||||
|
||||
// TYPE
|
||||
line = newLine(&grid);
|
||||
new StaticText(line, rect_t{}, STR_TYPE, 0, COLOR_THEME_PRIMARY1);
|
||||
|
||||
auto box = new FormGroup(line, rect_t{});
|
||||
box->setFlexLayout(LV_FLEX_FLOW_ROW_WRAP);
|
||||
lv_obj_set_style_grid_cell_x_align(box->getLvObj(), LV_GRID_ALIGN_STRETCH, 0);
|
||||
|
||||
new Choice(box, rect_t{}, _afhds3_phy_mode, 0, afhds3::PHYMODE_MAX,
|
||||
GET_SET_DEFAULT(md->afhds3.phyMode));
|
||||
|
||||
new Choice(box, rect_t{}, _afhds3_region,
|
||||
afhds3::LNK_ES_CE, afhds3::LNK_ES_FCC,
|
||||
GET_SET_DEFAULT(md->afhds3.emi));
|
||||
|
||||
uint8_t module = moduleIdx;
|
||||
new TextButton(box, rect_t{}, STR_MODULE_OPTIONS,
|
||||
[=]() {
|
||||
afhds3::applyModelConfig(module);
|
||||
new AFHDS3_Options(module);
|
||||
return 0;
|
||||
});
|
||||
showAFHDS3Options();
|
||||
} else {
|
||||
hideAFHDS3Options();
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -22,6 +22,7 @@
|
||||
#pragma once
|
||||
|
||||
#include "form.h"
|
||||
#include "choice.h"
|
||||
#include "module_setup.h"
|
||||
|
||||
struct ModuleData;
|
||||
@@ -31,7 +32,32 @@ class FlySkySettings : public FormGroup, public ModuleOptions
|
||||
uint8_t moduleIdx;
|
||||
ModuleData* md;
|
||||
FlexGridLayout grid;
|
||||
tmr10ms_t lastRefresh = 0;
|
||||
|
||||
#if defined(AFHDS2)
|
||||
Window* afhds2OptionsLabel = nullptr;
|
||||
Window* afhds2ProtoOpts = nullptr;
|
||||
#if defined(PCBNV14)
|
||||
Window* afhds2RFPowerText = nullptr;
|
||||
Window* afhds2RFPowerChoice = nullptr;
|
||||
#endif
|
||||
void hideAFHDS2Options();
|
||||
void showAFHDS2Options();
|
||||
#endif
|
||||
|
||||
#if defined(AFHDS3)
|
||||
Window* afhds3StatusLabel = nullptr;
|
||||
Window* afhds3StatusText = nullptr;
|
||||
Window* afhds3TypeLabel = nullptr;
|
||||
FormGroup* afhds3TypeForm = nullptr;
|
||||
Choice *afhds3PhyMode = nullptr;
|
||||
Choice *afhds3Emi = nullptr;
|
||||
Choice *afhds3RfPower = nullptr;
|
||||
void hideAFHDS3Options();
|
||||
void showAFHDS3Options();
|
||||
#endif
|
||||
|
||||
void checkEvents() override;
|
||||
void update() override;
|
||||
|
||||
public:
|
||||
|
||||
Reference in New Issue
Block a user