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,6 +80,29 @@ enum eSES_NewPortType {
|
||||
SES_NPT_NONE=0xFF
|
||||
};
|
||||
|
||||
enum DirtyConfig {
|
||||
DC_RX_CMD_TX_PWR,
|
||||
DC_RX_CMD_FAILSAFE_VALUE,
|
||||
DC_RX_CMD_FAILSAFE_TIME,
|
||||
DC_RX_CMD_RSSI_CHANNEL_SETUP,
|
||||
DC_RX_CMD_RANGE,
|
||||
DC_RX_CMD_GET_CAPABILITIES,
|
||||
DC_RX_CMD_OUT_PWM_PPM_MODE,
|
||||
DC_RX_CMD_FREQUENCY_V0,
|
||||
DC_RX_CMD_PORT_TYPE_V1,
|
||||
DC_RX_CMD_FREQUENCY_V1,
|
||||
DC_RX_CMD_FREQUENCY_V1_2,
|
||||
DC_RX_CMD_BUS_TYPE_V0,
|
||||
DC_RX_CMD_IBUS_SETUP,
|
||||
DC_RX_CMD_IBUS_DIRECTION,
|
||||
DC_RX_CMD_BUS_FAILSAFE,
|
||||
DC_RX_CMD_GET_VERSION
|
||||
};
|
||||
|
||||
#define SET_AND_SYNC(cfg, value, dirtyCmd) [=](int32_t newValue) { value = newValue; cfg->others.dirtyFlag |= (uint32_t) 1 << dirtyCmd; }
|
||||
#define GET_SET_AND_SYNC(cfg, value, dirtyCmd) GET_DEFAULT(value), SET_AND_SYNC(cfg, value, dirtyCmd)
|
||||
#define DIRTY_CMD(cfg, dirtyCmd) cfg->others.dirtyFlag |= (uint32_t) 1 << dirtyCmd;
|
||||
|
||||
PACK(struct sSES_PWMFrequenciesAPPV1 {
|
||||
// One unsigned short per
|
||||
// channel, From 50 to 400Hz,
|
||||
@@ -104,9 +127,12 @@ PACK(struct sDATA_ConfigV1 {
|
||||
sSES_PWMFrequenciesAPPV1 PWMFrequenciesV1;
|
||||
});
|
||||
|
||||
PACK(struct sDATA_BusType {
|
||||
PACK(struct sDATA_Others {
|
||||
uint8_t buffer[sizeof(sDATA_ConfigV1)];
|
||||
uint8_t ExternalBusType; // eEB_BusType
|
||||
uint8_t ExternalBusType; // eEB_BusType
|
||||
tmr10ms_t lastUpdated; // last updated time
|
||||
bool isConnected; // specify if receiver is connected
|
||||
uint32_t dirtyFlag; // mapped to commands that need to be issued to sync settings
|
||||
});
|
||||
|
||||
union Config_u
|
||||
@@ -115,7 +141,7 @@ union Config_u
|
||||
sDATA_ConfigV0 v0;
|
||||
sDATA_ConfigV1 v1;
|
||||
uint8_t buffer[sizeof(sDATA_ConfigV1)];
|
||||
sDATA_BusType BusType;
|
||||
sDATA_Others others;
|
||||
};
|
||||
|
||||
Config_u* getConfig(uint8_t moduleIdx);
|
||||
|
||||
Reference in New Issue
Block a user