Support new Multi 1.3 features (#7077)

This commit is contained in:
3djc
2019-11-15 16:20:24 +01:00
committed by GitHub
parent 86b186fafd
commit 3a7e006635
57 changed files with 1542 additions and 355 deletions
+6 -6
View File
@@ -418,6 +418,7 @@ PACK(struct TrainerModuleData {
// Only used in case switch and if statements as "virtual" protocol
#define MM_RF_CUSTOM_SELECTED 0xff
#define MULTI_MAX_PROTOCOLS 127 // rfProtocol:4 + rfProtocolExtra:3
PACK(struct ModuleData {
uint8_t type:4;
// TODO some refactoring is needed, rfProtocol is only used by DSM2 and MULTI, it could be merged with subType
@@ -436,8 +437,9 @@ PACK(struct ModuleData {
int8_t frameLength;
} ppm;
NOBACKUP(struct {
uint8_t rfProtocolExtra:2;
uint8_t spare1:3;
uint8_t rfProtocolExtra:3;
uint8_t disableTelemetry:1;
uint8_t disableMapping:1;
uint8_t customProto:1;
uint8_t autoBindMode:1;
uint8_t lowPowerMode:1;
@@ -464,15 +466,13 @@ PACK(struct ModuleData {
};
// Helper functions to set both of the rfProto protocol at the same time
NOBACKUP(inline uint8_t getMultiProtocol(bool returnCustom) {
if (returnCustom && multi.customProto)
return MM_RF_CUSTOM_SELECTED;
NOBACKUP(inline uint8_t getMultiProtocol() {
return ((uint8_t) (rfProtocol & 0x0f)) + (multi.rfProtocolExtra << 4);
})
NOBACKUP(inline void setMultiProtocol(uint8_t proto) {
rfProtocol = (uint8_t) (proto & 0x0f);
multi.rfProtocolExtra = (proto & 0x30) >> 4;
multi.rfProtocolExtra = (proto & 0x70) >> 4;
})
});