Bsongis/x9d+ 2019 (#6588)

X9D+ 2019 added
This commit is contained in:
Bertrand Songis
2019-07-26 19:18:29 +02:00
committed by GitHub
parent 37e1e0ef33
commit 151827ada5
44 changed files with 704 additions and 321 deletions
+74 -72
View File
@@ -24,12 +24,6 @@
#define MAX_TIMERS_218 3
#define MAX_GVARS_218 9
#if defined(BUZZER)
#define BUZZER_FIELD_218 int8_t buzzerMode:2; // -2=quiet, -1=only alarms, 0=no keys, 1=all (only used on AVR radios without audio hardware)
#else
#define BUZZER_FIELD_218 int8_t spareRadio:2;
#endif
#if defined(PCBHORUS)
#define NUM_SWITCHES_218 8
#elif defined(PCBXLITE)
@@ -130,6 +124,21 @@
#define MAX_TELEMETRY_SENSORS_218 32
#endif
#if defined(COLORLCD)
typedef uint32_t swarnstate218_t;
#elif defined(PCBX9E)
typedef uint64_t swconfig218_t;
typedef uint64_t swarnstate218_t;
typedef uint32_t swarnenable218_t;
#elif defined(PCBTARANIS)
typedef uint16_t swconfig218_t;
typedef uint16_t swarnstate218_t;
typedef uint8_t swarnenable218_t;
#else
typedef uint8_t swarnstate218_t;
typedef uint8_t swarnenable218_t;
#endif
PACK(typedef struct {
uint8_t type:4;
int8_t rfProtocol:4;
@@ -416,7 +425,7 @@ PACK(struct ModelHeader_v218 {
#if defined(COLORLCD)
#define SWITCH_WARNING_DATA_218
#else
#define SWITCH_WARNING_DATA_218 swarnenable_t switchWarningEnable;
#define SWITCH_WARNING_DATA_218 swarnenable218_t switchWarningEnable;
#endif
PACK(struct ModelData_v218 {
@@ -448,7 +457,7 @@ PACK(struct ModelData_v218 {
uint8_t thrTraceSrc;
swarnstate_t switchWarningState;
swarnstate218_t switchWarningState;
SWITCH_WARNING_DATA_218
@@ -467,45 +476,8 @@ PACK(struct ModelData_v218 {
VIEW_DATA
});
#include "chksize.h"
#define CHKSIZE(x, y) check_size<struct x, y>()
static inline void check_struct_218()
{
#if defined(PCBHORUS)
CHKSIZE(ModelData_v218, 9380);
#elif defined(PCBX9E)
CHKSIZE(ModelData_v218, 6520);
#endif
}
#undef CHKSIZE
#define EXTRA_GENERAL_FIELDS_GENERAL_218 \
uint8_t backlightBright; \
uint32_t globalTimer; \
uint8_t bluetoothBaudrate:4; \
uint8_t bluetoothMode:4; \
uint8_t countryCode; \
uint8_t imperial:1; \
uint8_t jitterFilter:1; /* 0 - active */\
uint8_t disableRssiPoweroffAlarm:1; \
uint8_t USBMode:2; \
uint8_t spareExtraArm:3; \
char ttsLanguage[2]; \
int8_t beepVolume:4; \
int8_t wavVolume:4; \
int8_t varioVolume:4; \
int8_t backgroundVolume:4; \
int8_t varioPitch; \
int8_t varioRange; \
int8_t varioRepeat; \
CustomFunctionData_v218 customFn[MAX_SPECIAL_FUNCTIONS_218];
#if defined(PCBHORUS)
#define EXTRA_GENERAL_FIELDS_218 \
EXTRA_GENERAL_FIELDS_GENERAL_218 \
uint8_t auxSerialMode:4; \
uint8_t slidersConfig:4; \
uint32_t switchConfig; \
@@ -517,27 +489,25 @@ static inline void check_struct_218()
uint8_t blOffBright:7; \
char bluetoothName[LEN_BLUETOOTH_NAME_218];
#elif defined(PCBTARANIS)
#if defined(BLUETOOTH)
#define BLUETOOTH_FIELDS_218 \
#if defined(STORAGE_BLUETOOTH) && !defined(PCBX9D) && !defined(PCBX9DP)
#define BLUETOOTH_FIELDS_218 \
uint8_t spare; \
char bluetoothName[LEN_BLUETOOTH_NAME_218];
#else
#define BLUETOOTH_FIELDS
#endif
#define EXTRA_GENERAL_FIELDS_218 \
EXTRA_GENERAL_FIELDS_GENERAL_218 \
#else
#define BLUETOOTH_FIELDS_218
#endif
#define EXTRA_GENERAL_FIELDS_218 \
uint8_t auxSerialMode:4; \
uint8_t slidersConfig:4; \
uint8_t potsConfig; /* two bits per pot */\
uint8_t backlightColor; \
swarnstate_t switchUnlockStates; \
swconfig_t switchConfig; \
swarnstate218_t switchUnlockStates; \
swconfig218_t switchConfig; \
char switchNames[NUM_SWITCHES_218][LEN_SWITCH_NAME_218]; \
char anaNames[NUM_STICKS+NUM_POTS+NUM_SLIDERS][LEN_ANA_NAME_218]; \
BLUETOOTH_FIELDS
BLUETOOTH_FIELDS_218
#elif defined(PCBSKY9X)
#define EXTRA_GENERAL_FIELDS_218 \
EXTRA_GENERAL_FIELDS_GENERAL_218 \
#define EXTRA_GENERAL_FIELDS_218 \
int8_t txCurrentCalibration; \
int8_t temperatureWarn; \
uint8_t mAhWarn; \
@@ -548,16 +518,8 @@ static inline void check_struct_218()
uint8_t rotarySteps; \
char switchNames[NUM_SWITCHES_218][LEN_SWITCH_NAME_218]; \
char anaNames[NUM_STICKS+NUM_POTS+NUM_SLIDERS][LEN_ANA_NAME_218];
#else
#define EXTRA_GENERAL_FIELDS_218 EXTRA_GENERAL_FIELDS_GENERAL_218
#endif
#if defined(PCBHORUS)
#define SPLASH_MODE_218 uint8_t splashSpares:3
#elif defined(FSPLASH)
#define SPLASH_MODE_218 uint8_t splashMode:3
#else
#define SPLASH_MODE_218 int8_t splashMode:3
#else
#define EXTRA_GENERAL_FIELDS_218 EXTRA_GENERAL_FIELDS_GENERAL_218
#endif
#if defined(COLORLCD)
@@ -570,7 +532,7 @@ static inline void check_struct_218()
#define THEME_DATA
#endif
PACK(typedef struct {
PACK(struct RadioData_v218 {
uint8_t version;
uint16_t variant;
CalibData calib[NUM_STICKS+STORAGE_NUM_POTS+STORAGE_NUM_SLIDERS+STORAGE_NUM_MOUSE_ANALOGS];
@@ -582,7 +544,7 @@ PACK(typedef struct {
int8_t backlightMode;
TrainerData_v218 trainer;
uint8_t view; // index of view in main screen
BUZZER_FIELD_218
int8_t buzzerMode:2;
uint8_t fai:1;
int8_t beepMode:2; // -2=quiet, -1=only alarms, 0=no keys, 1=all
uint8_t alarmsFlash:1;
@@ -592,8 +554,10 @@ PACK(typedef struct {
int8_t timezone:5;
uint8_t adjustRTC:1;
uint8_t inactivityTimer;
SPLASH_MODE_218; /* 3bits */
int8_t hapticMode:2; // -2=quiet, -1=only alarms, 0=no keys, 1=all
int8_t splashMode:3;
int8_t hapticMode:2;
int8_t spare2:3;
int8_t switchesDelay;
uint8_t lightAutoOff;
uint8_t templateSetup; // RETA order for receiver channels
int8_t PPM_Multiplier;
@@ -609,9 +573,47 @@ PACK(typedef struct {
int8_t vBatMin;
int8_t vBatMax;
uint8_t backlightBright;
uint32_t globalTimer;
uint8_t bluetoothBaudrate:4;
uint8_t bluetoothMode:4;
uint8_t countryCode;
uint8_t imperial:1;
uint8_t jitterFilter:1; /* 0 - active */
uint8_t disableRssiPoweroffAlarm:1;
uint8_t USBMode:2;
uint8_t spareExtraArm:3;
char ttsLanguage[2];
int8_t beepVolume:4;
int8_t wavVolume:4;
int8_t varioVolume:4;
int8_t backgroundVolume:4;
int8_t varioPitch;
int8_t varioRange;
int8_t varioRepeat;
CustomFunctionData_v218 customFn[MAX_SPECIAL_FUNCTIONS_218];
EXTRA_GENERAL_FIELDS_218
THEME_DATA
}) RadioData_v218;
});
#include "chksize.h"
#define CHKSIZE(x, y) check_size<struct x, y>()
static inline void check_struct_218()
{
#if defined(PCBHORUS)
CHKSIZE(ModelData_v218, 9380);
#elif defined(PCBX9E)
CHKSIZE(ModelData_v218, 6520);
#elif defined(PCBX9D)
CHKSIZE(RadioData_v218, 872);
#endif
}
#undef CHKSIZE
#endif //OPENTX_DATASTRUCTS_218_H