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:
richardclli
2023-06-19 19:00:02 +08:00
committed by GitHub
co-authored by Phil Mitchell Peter Feerick
parent bdb78ba2ef
commit cb533f4493
33 changed files with 598 additions and 197 deletions
@@ -48,6 +48,20 @@
// ghost:
// raw12bits: 0
// FRM303 (as of PR3501)
// type: TYPE_FLYSKY
// subType: AFHDS3
// channelsStart: 0
// channelsCount: 18
// failsafeMode: NOT_SET
// mod:
// afhds3:
// emi: 2
// telemetry: 1
// phyMode: 2
// reserved: 0
// rfPower: 1
static const YamlLookupTable protocolLut = {
{ PULSES_OFF, "TYPE_NONE" },
{ PULSES_PPM, "TYPE_PPM" },
@@ -97,6 +111,11 @@ static const YamlLookupTable dsmLut = {
{ 2, "DSMX" },
};
static const YamlLookupTable afhdsLut = {
{ 0, "AFHDS3" },
{ 1, "AFHDS2A" } // could be complete nonsense, CHECK IT!
};
static const YamlLookupTable failsafeLut = {
{ FAILSAFE_NOT_SET, "NOT_SET" },
{ FAILSAFE_HOLD, "HOLD" },
@@ -156,6 +175,10 @@ Node convert<ModuleData>::encode(const ModuleData& rhs)
st_str += std::to_string(subType);
node["subType"] = st_str;
} break;
case PULSES_AFHDS3: {
node["subType"] = LookupValue(afhdsLut, subtype);
break;
}
}
node["channelsStart"] = rhs.channelsStart;
@@ -223,7 +246,17 @@ Node convert<ModuleData>::encode(const ModuleData& rhs)
dsmp["flags"] = rhs.dsmp.flags;
mod["dsmp"] = dsmp;
} break;
// TODO: afhds3, flysky
// TODO: flysky
// TODO: afhds3
case PULSES_AFHDS3: {
Node afhds3;
afhds3["emi"] = rhs.afhds3.emi;
afhds3["telemetry"] = rhs.afhds3.telemetry;
afhds3["phyMode"] = rhs.afhds3.phyMode;
afhds3["reserved"] = rhs.afhds3.reserved;
afhds3["rfPower"] = rhs.afhds3.rfPower;
mod["afhds3"] = afhds3;
} break;
default: {
Node ppm;
ppm["delay"] = exportPpmDelay(rhs.ppm.delay);
@@ -348,9 +381,15 @@ bool convert<ModuleData>::decode(const Node& node, ModuleData& rhs)
Node dsmp = mod["dsmp"];
dsmp["flags"] >> rhs.dsmp.flags;
} else if (mod["flysky"]) {
//TODO
// TODO: flysky
} else if (mod["afhds3"]) {
//TODO
// TODO: afhds3
Node afhds3 = mod["afhds3"];
afhds3["emi"] >> rhs.afhds3.emi;
afhds3["telemetry"] >> rhs.afhds3.telemetry;
afhds3["phyMode"] >> rhs.afhds3.phyMode;
afhds3["reserved"] >> rhs.afhds3.reserved;
afhds3["rfPower"] >> rhs.afhds3.rfPower;
}
}
+4
View File
@@ -140,6 +140,10 @@ class ModuleData {
struct Afhds3 {
unsigned int rxFreq;
unsigned int rfPower;
unsigned int emi;
unsigned int telemetry;
unsigned int phyMode;
unsigned int reserved;
} afhds3;
struct PXX {