Merge pull request #6626 from opentx/raphaelcoeffic/companion-access

Companion ACCESS support
This commit is contained in:
Bertrand Songis
2019-08-22 11:55:01 +02:00
committed by GitHub
20 changed files with 1112 additions and 453 deletions
+19 -9
View File
@@ -48,11 +48,16 @@ enum PulsesProtocol {
PULSES_MULTIMODULE,
PULSES_PXX_R9M,
PULSES_PXX_R9M_LITE,
PULSES_PXX_R9M_LITE_PRO,
PULSES_SBUS,
PULSES_ACCESS_ISRM,
PULSES_ACCST_ISRM_D16,
PULSES_ACCESS_R9M,
PULSES_ACCESS_R9M_LITE,
PULSES_ACCESS_R9M_LITE_PRO,
PULSES_XJT_LITE_X16,
PULSES_XJT_LITE_D8,
PULSES_XJT_LITE_LR12,
PULSES_PROTOCOL_LAST
};
@@ -128,13 +133,18 @@ enum ModuleSubtypeR9M {
MODULE_SUBTYPE_R9M_LAST=MODULE_SUBTYPE_R9M_AUPLUS
};
constexpr int PXX2_MAX_RECEIVERS_PER_MODULE = 3;
constexpr int PXX2_LEN_RX_NAME = 8;
class ModuleData {
Q_DECLARE_TR_FUNCTIONS(ModuleData)
public:
ModuleData() { clear(); }
unsigned int modelId;
int protocol;
unsigned int protocol; // type in datastructs.h
int rfProtocol; // rfProtocol in datastructs.h
unsigned int subType;
bool invertedSerial;
unsigned int channelsStart;
@@ -142,14 +152,14 @@ class ModuleData {
unsigned int failsafeMode;
int failsafeChannels[CPN_MAX_CHNOUT];
struct {
struct PPM {
int delay;
bool pulsePol; // false = positive
bool outputType; // false = open drain, true = push pull
int frameLength;
} ppm;
struct {
struct Multi {
unsigned int rfProtocol;
bool autoBindMode;
bool lowPowerMode;
@@ -157,22 +167,22 @@ class ModuleData {
int optionValue;
} multi;
struct {
int power; // 0 10 mW, 1 100 mW, 2 500 mW, 3 1W
struct PXX {
unsigned int power; // 0 10 mW, 1 100 mW, 2 500 mW, 3 1W
bool receiver_telem_off; // false = receiver telem enabled
bool receiver_channel_9_16; // false = pwm out 1-8, true 9-16
bool external_antenna; // false = internal antenna, true = external antenna
bool sport_out;
} pxx;
struct {
// unsigned int receivers;
// char receiverName[3][8];
char data[1 + 3 * 8];
struct Access {
unsigned int receivers;
char receiverName[PXX2_MAX_RECEIVERS_PER_MODULE][PXX2_LEN_RX_NAME+1];
} access;
void clear() { memset(this, 0, sizeof(ModuleData)); }
void convert(RadioDataConversionState & cstate);
bool isPxx2Module() const;
QString polarityToString() const { return ppm.pulsePol ? tr("Positive") : tr("Negative"); }
QString rfProtocolToString() const;
QString subTypeToString(int type = -1) const;