Massive clean thanks to Schwabe : unifdef -m -DCPUARM -UCPUM64 -UCPUM2560 -UPCBSTD -UPCBMEGA2560 -UPCBGRUVIN9X -UPCB9X $(find . -name "*.cpp" -or -name "*.h")
This commit is contained in:
@@ -35,17 +35,8 @@
|
||||
#define WARN_MEM (!(g_eeGeneral.warnOpts & WARN_MEM_BIT))
|
||||
#define BEEP_VAL ( (g_eeGeneral.warnOpts & WARN_BVAL_BIT) >>3 )
|
||||
|
||||
#if defined(CPUARM)
|
||||
#define EEPROM_VER 218
|
||||
#define FIRST_CONV_EEPROM_VER 216
|
||||
#elif defined(CPUM2560) || defined(CPUM2561)
|
||||
#define EEPROM_VER 217
|
||||
#define FIRST_CONV_EEPROM_VER EEPROM_VER
|
||||
#elif defined(CPUM128)
|
||||
#define EEPROM_VER 217
|
||||
#else
|
||||
#define EEPROM_VER 216
|
||||
#endif
|
||||
|
||||
#define GET_PPM_POLARITY(idx) g_model.moduleData[idx].ppm.pulsePol
|
||||
#define GET_SBUS_POLARITY(idx) g_model.moduleData[idx].sbus.noninverted
|
||||
@@ -68,13 +59,8 @@
|
||||
#define IS_PLAY_FUNC(func) ((func) == FUNC_PLAY_SOUND)
|
||||
#endif
|
||||
|
||||
#if defined(CPUARM)
|
||||
#define IS_PLAY_BOTH_FUNC(func) (0)
|
||||
#define IS_VOLUME_FUNC(func) ((func) == FUNC_VOLUME)
|
||||
#else
|
||||
#define IS_PLAY_BOTH_FUNC(func) ((func) == FUNC_PLAY_BOTH)
|
||||
#define IS_VOLUME_FUNC(func) (0)
|
||||
#endif
|
||||
|
||||
#if defined(GVARS)
|
||||
#define IS_ADJUST_GV_FUNC(func) ((func) == FUNC_ADJUST_GVAR)
|
||||
@@ -91,7 +77,6 @@
|
||||
#define HAS_ENABLE_PARAM(func) ((func) < FUNC_FIRST_WITHOUT_ENABLE)
|
||||
#define HAS_REPEAT_PARAM(func) (IS_PLAY_FUNC(func) || IS_HAPTIC_FUNC(func))
|
||||
|
||||
#if defined(CPUARM)
|
||||
#define CFN_EMPTY(p) (!(p)->swtch)
|
||||
#define CFN_SWITCH(p) ((p)->swtch)
|
||||
#define CFN_FUNC(p) ((p)->func)
|
||||
@@ -109,33 +94,6 @@
|
||||
#define CFN_GVAR_CST_MAX GVAR_MAX
|
||||
#define MODEL_GVAR_MIN(idx) (CFN_GVAR_CST_MIN + g_model.gvars[idx].min)
|
||||
#define MODEL_GVAR_MAX(idx) (CFN_GVAR_CST_MAX - g_model.gvars[idx].max)
|
||||
#elif defined(CPUM2560)
|
||||
#define CFN_SWITCH(p) ((p)->swtch)
|
||||
#define CFN_FUNC(p) ((p)->func)
|
||||
#define CFN_ACTIVE(p) ((p)->active)
|
||||
#define CFN_CH_INDEX(p) ((p)->param)
|
||||
#define CFN_TIMER_INDEX(p) ((p)->param)
|
||||
#define CFN_GVAR_INDEX(p) ((p)->param)
|
||||
#define CFN_PLAY_REPEAT(p) ((p)->param)
|
||||
#define CFN_PLAY_REPEAT_MUL 10
|
||||
#define CFN_GVAR_MODE(p) ((p)->mode)
|
||||
#define CFN_PARAM(p) ((p)->value)
|
||||
#define CFN_RESET(p) ((p)->active = 0, CFN_PARAM(p) = 0)
|
||||
#define CFN_GVAR_CST_MAX 125
|
||||
#else
|
||||
#define CFN_SWITCH(p) ((p)->all.swtch)
|
||||
#define CFN_FUNC(p) ((p)->all.func)
|
||||
#define CFN_ACTIVE(p) ((p)->all.active)
|
||||
#define CFN_CH_INDEX(p) ((p)->all.param)
|
||||
#define CFN_TIMER_INDEX(p) ((p)->all.param)
|
||||
#define CFN_GVAR_INDEX(p) ((p)->gvar.param)
|
||||
#define CFN_PLAY_REPEAT(p) ((p)->all.param)
|
||||
#define CFN_PLAY_REPEAT_MUL 10
|
||||
#define CFN_GVAR_MODE(p) ((p)->gvar.mode)
|
||||
#define CFN_PARAM(p) ((p)->value)
|
||||
#define CFN_RESET(p) ((p)->all.active = 0, CFN_PARAM(p) = 0)
|
||||
#define CFN_GVAR_CST_MAX 125
|
||||
#endif
|
||||
|
||||
#if defined(PCBTARANIS) || defined(PCBHORUS)
|
||||
enum SwitchConfig {
|
||||
@@ -187,27 +145,11 @@ enum CurveRefType {
|
||||
CURVE_REF_CUSTOM
|
||||
};
|
||||
|
||||
#if !defined(CPUARM)
|
||||
#define MODE_DIFFERENTIAL 0
|
||||
#define MODE_EXPO 0
|
||||
#define MODE_CURVE 1
|
||||
#endif
|
||||
|
||||
#if defined(CPUARM)
|
||||
#define MIN_EXPO_WEIGHT -100
|
||||
#define EXPO_VALID(ed) ((ed)->mode)
|
||||
#define EXPO_MODE_ENABLE(ed, v) (((v)<0 && ((ed)->mode&1)) || ((v)>=0 && ((ed)->mode&2)))
|
||||
#elif defined(CPUM2560) || defined(CPUM2561)
|
||||
#define MIN_EXPO_WEIGHT 0
|
||||
#define EXPO_VALID(ed) ((ed)->mode)
|
||||
#define EXPO_MODE_ENABLE(ed, v) (((v)<0 && ((ed)->mode&1)) || ((v)>=0 && ((ed)->mode&2)))
|
||||
#else
|
||||
#define MIN_EXPO_WEIGHT 0
|
||||
#define EXPO_VALID(ed) ((ed)->mode)
|
||||
#define EXPO_MODE_ENABLE(ed, v) (((v)<0 && ((ed)->mode&1)) || ((v)>=0 && ((ed)->mode&2)))
|
||||
#endif
|
||||
|
||||
#if defined(CPUARM)
|
||||
#define limit_min_max_t int16_t
|
||||
#define LIMIT_EXT_PERCENT 150
|
||||
#define LIMIT_EXT_MAX (LIMIT_EXT_PERCENT*10)
|
||||
@@ -218,18 +160,6 @@ enum CurveRefType {
|
||||
#define LIMIT_MAX_RESX(lim) calc1000toRESX(LIMIT_MAX(lim))
|
||||
#define LIMIT_MIN_RESX(lim) calc1000toRESX(LIMIT_MIN(lim))
|
||||
#define LIMIT_OFS_RESX(lim) calc1000toRESX(LIMIT_OFS(lim))
|
||||
#else
|
||||
#define limit_min_max_t int8_t
|
||||
#define LIMIT_EXT_PERCENT 125
|
||||
#define LIMIT_EXT_MAX LIMIT_EXT_PERCENT
|
||||
#define PPM_CENTER_MAX 125
|
||||
#define LIMIT_MAX(lim) (lim->max+100)
|
||||
#define LIMIT_MIN(lim) (lim->min-100)
|
||||
#define LIMIT_OFS(lim) (lim->offset)
|
||||
#define LIMIT_MAX_RESX(lim) calc100toRESX(LIMIT_MAX(lim))
|
||||
#define LIMIT_MIN_RESX(lim) calc100toRESX(LIMIT_MIN(lim))
|
||||
#define LIMIT_OFS_RESX(lim) calc1000toRESX(LIMIT_OFS(lim))
|
||||
#endif
|
||||
|
||||
#define TRIM_OFF (1)
|
||||
#define TRIM_ON (0)
|
||||
@@ -249,7 +179,6 @@ enum CurveRefType {
|
||||
#define MLTPX_MUL 1
|
||||
#define MLTPX_REP 2
|
||||
|
||||
#if defined(CPUARM)
|
||||
#define GV1_SMALL 128
|
||||
#define GV1_LARGE 1024
|
||||
#define GV_RANGE_WEIGHT 500
|
||||
@@ -268,64 +197,20 @@ enum CurveRefType {
|
||||
#define MD_UNION_TO_OFFSET(var, md) md->offset = var.word
|
||||
// #define MD_SETOFFSET(md, val) md->offset = val
|
||||
|
||||
#else
|
||||
|
||||
// highest bit used for small values in mix 128 --> 8 bit is enough
|
||||
#define GV1_SMALL 128
|
||||
// highest bit used for large values in mix 256 --> 9 bits is used (8 bits + 1 extra bit from weightMode/offsetMode)
|
||||
#define GV1_LARGE 256
|
||||
|
||||
#define DELAY_STEP 2
|
||||
#define SLOW_STEP 2
|
||||
#define DELAY_MAX 15 /* 7.5 seconds */
|
||||
#define SLOW_MAX 15 /* 7.5 seconds */
|
||||
|
||||
PACK(union u_gvarint_t {
|
||||
struct {
|
||||
int8_t lo;
|
||||
uint8_t hi;
|
||||
} bytes_t;
|
||||
int16_t word;
|
||||
|
||||
u_gvarint_t(int8_t l, uint8_t h) {bytes_t.lo=l; bytes_t.hi=h?255:0;} // hi bit is negativ sign
|
||||
|
||||
private:
|
||||
// prevent unwanted constructors, also saves program
|
||||
u_gvarint_t() {}
|
||||
u_gvarint_t(const u_gvarint_t&) {}
|
||||
});
|
||||
#define MD_WEIGHT(md) (u_gvarint_t(md->weight,md->weightMode).word)
|
||||
|
||||
#define MD_WEIGHT_TO_UNION(md, var) var.bytes_t.lo=md->weight; var.bytes_t.hi=md->weightMode?255:0
|
||||
#define MD_UNION_TO_WEIGHT(var, md) md->weight=var.bytes_t.lo; if (var.word<0) md->weightMode=1; else md->weightMode=0
|
||||
// #define MD_SETWEIGHT(md, val) md->weight=val; if (val<0) md->weightMode=1; else md->weightMode=0
|
||||
|
||||
#define MD_OFFSET(md) (u_gvarint_t(md->offset,md->offsetMode).word)
|
||||
#define MD_OFFSET_TO_UNION(md, var) var.bytes_t.lo=md->offset; var.bytes_t.hi=md->offsetMode?255:0
|
||||
#define MD_UNION_TO_OFFSET(var, md) md->offset=var.bytes_t.lo; if (var.word<0) md->offsetMode=1; else md->offsetMode=0 /* set negative sign */
|
||||
// #define MD_SETOFFSET(md, val) md->offset=val; if (val<0) md->offsetMode=1; else md->offsetMode=0
|
||||
|
||||
#endif
|
||||
|
||||
enum LogicalSwitchesFunctions {
|
||||
LS_FUNC_NONE,
|
||||
#if defined(CPUARM)
|
||||
LS_FUNC_VEQUAL, // v==offset
|
||||
#endif
|
||||
LS_FUNC_VALMOSTEQUAL, // v~=offset
|
||||
LS_FUNC_VPOS, // v>offset
|
||||
LS_FUNC_VNEG, // v<offset
|
||||
#if defined(CPUARM)
|
||||
LS_FUNC_RANGE,
|
||||
#endif
|
||||
LS_FUNC_APOS, // |v|>offset
|
||||
LS_FUNC_ANEG, // |v|<offset
|
||||
LS_FUNC_AND,
|
||||
LS_FUNC_OR,
|
||||
LS_FUNC_XOR,
|
||||
#if defined(CPUARM)
|
||||
LS_FUNC_EDGE,
|
||||
#endif
|
||||
LS_FUNC_EQUAL,
|
||||
LS_FUNC_GREATER,
|
||||
LS_FUNC_LESS,
|
||||
@@ -337,15 +222,10 @@ enum LogicalSwitchesFunctions {
|
||||
LS_FUNC_MAX = LS_FUNC_COUNT-1
|
||||
};
|
||||
|
||||
#if defined(CPUARM)
|
||||
#define MAX_LS_DURATION 250 /*25s*/
|
||||
#define MAX_LS_DELAY 250 /*25s*/
|
||||
#define MAX_LS_ANDSW SWSRC_LAST
|
||||
#else
|
||||
#define MAX_LS_ANDSW 15
|
||||
#endif
|
||||
|
||||
#if defined(CPUARM)
|
||||
//#define TELEM_FLAG_TIMEOUT 0x01
|
||||
#define TELEM_FLAG_LOG 0x02
|
||||
//#define TELEM_FLAG_PERSISTENT 0x04
|
||||
@@ -373,7 +253,6 @@ enum TelemetrySensorFormula
|
||||
TELEM_FORMULA_DIST,
|
||||
TELEM_FORMULA_LAST = TELEM_FORMULA_DIST
|
||||
};
|
||||
#endif
|
||||
|
||||
enum VarioSource {
|
||||
#if !defined(TELEMETRY_FRSKY_SPORT)
|
||||
@@ -401,10 +280,8 @@ enum FrskyCurrentSource {
|
||||
FRSKY_CURRENT_SOURCE_NONE,
|
||||
FRSKY_CURRENT_SOURCE_A1,
|
||||
FRSKY_CURRENT_SOURCE_A2,
|
||||
#if defined(CPUARM)
|
||||
FRSKY_CURRENT_SOURCE_A3,
|
||||
FRSKY_CURRENT_SOURCE_A4,
|
||||
#endif
|
||||
FRSKY_CURRENT_SOURCE_FAS,
|
||||
FRSKY_CURRENT_SOURCE_LAST=FRSKY_CURRENT_SOURCE_FAS
|
||||
};
|
||||
@@ -412,10 +289,8 @@ enum FrskyCurrentSource {
|
||||
enum FrskyVoltsSource {
|
||||
FRSKY_VOLTS_SOURCE_A1,
|
||||
FRSKY_VOLTS_SOURCE_A2,
|
||||
#if defined(CPUARM)
|
||||
FRSKY_VOLTS_SOURCE_A3,
|
||||
FRSKY_VOLTS_SOURCE_A4,
|
||||
#endif
|
||||
FRSKY_VOLTS_SOURCE_FAS,
|
||||
FRSKY_VOLTS_SOURCE_CELLS,
|
||||
FRSKY_VOLTS_SOURCE_LAST=FRSKY_VOLTS_SOURCE_CELLS
|
||||
@@ -439,22 +314,10 @@ enum SwashType {
|
||||
|
||||
#define ROTARY_ENCODER_MAX 1024
|
||||
|
||||
#if defined(PCBSTD)
|
||||
#define TRIMS_ARRAY_SIZE 5
|
||||
#else
|
||||
#define TRIMS_ARRAY_SIZE 8
|
||||
#if defined(CPUARM)
|
||||
#define TRIM_MODE_NONE 0x1F // 0b11111
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(CPUARM)
|
||||
#define IS_MANUAL_RESET_TIMER(idx) (g_model.timers[idx].persistent == 2)
|
||||
#elif defined(CPUM2560)
|
||||
#define IS_MANUAL_RESET_TIMER(idx) (g_model.timers[idx].persistent == 2)
|
||||
#else
|
||||
#define IS_MANUAL_RESET_TIMER(idx) 0
|
||||
#endif
|
||||
|
||||
#if defined(CPUARM) && !defined(PCBSKY9X)
|
||||
#define TIMER_COUNTDOWN_START(x) (g_model.timers[x].countdownStart > 0 ? 5 : 10 - g_model.timers[x].countdownStart * 10)
|
||||
@@ -464,10 +327,6 @@ enum SwashType {
|
||||
|
||||
enum Protocols {
|
||||
PROTO_PPM,
|
||||
#if !defined(CPUARM)
|
||||
PROTO_PPM16,
|
||||
PROTO_PPMSIM,
|
||||
#endif
|
||||
#if defined(PXX) || defined(DSM2) || defined(IRPROTOS)
|
||||
PROTO_PXX,
|
||||
#endif
|
||||
@@ -476,9 +335,7 @@ enum Protocols {
|
||||
PROTO_DSM2_DSM2,
|
||||
PROTO_DSM2_DSMX,
|
||||
#endif
|
||||
#if defined(CPUARM)
|
||||
PROTO_CROSSFIRE,
|
||||
#endif
|
||||
#if defined(IRPROTOS)
|
||||
// only used on AVR
|
||||
// we will need 4 bits for proto :(
|
||||
@@ -487,10 +344,8 @@ enum Protocols {
|
||||
PROTO_PICZ,
|
||||
PROTO_SWIFT,
|
||||
#endif
|
||||
#if defined(CPUARM)
|
||||
PROTO_MULTIMODULE,
|
||||
PROTO_SBUS,
|
||||
#endif
|
||||
PROTO_MAX,
|
||||
PROTO_NONE
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user