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:
+1
-29
@@ -21,12 +21,6 @@
|
||||
#ifndef _GVARS_H_
|
||||
#define _GVARS_H_
|
||||
|
||||
#if defined(PCBSTD)
|
||||
// GVars are common to all flight modes
|
||||
#define GVAR_VALUE(x, p) g_model.gvars[x]
|
||||
#define SET_GVAR_VALUE(idx, phase, value) \
|
||||
(GVAR_VALUE(idx, phase) = value, storageDirty(EE_MODEL))
|
||||
#else
|
||||
// GVars have one value per flight mode
|
||||
#define GVAR_VALUE(gv, fm) g_model.flightModeData[fm].gvars[gv]
|
||||
#define SET_GVAR_VALUE(idx, phase, value) \
|
||||
@@ -36,15 +30,8 @@
|
||||
gvarLastChanged = idx; \
|
||||
gvarDisplayTimer = GVAR_DISPLAY_TIME; \
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(GVARS)
|
||||
#if defined(PCBSTD)
|
||||
int16_t getGVarFieldValue(int16_t x, int16_t min, int16_t max);
|
||||
void setGVarValue(uint8_t x, int8_t value);
|
||||
#define GET_GVAR(x, min, max, fm) getGVarFieldValue(x, min, max)
|
||||
#define SET_GVAR(idx, val, fm) setGVarValue(idx, val)
|
||||
#else
|
||||
uint8_t getGVarFlightMode(uint8_t fm, uint8_t gv);
|
||||
int16_t getGVarFieldValue(int16_t x, int16_t min, int16_t max, int8_t fm);
|
||||
int32_t getGVarFieldValuePrec1(int16_t x, int16_t min, int16_t max, int8_t fm);
|
||||
@@ -57,21 +44,14 @@
|
||||
#define GET_GVAR_PREC1(x, min, max, fm) getGVarFieldValuePrec1(x, min, max, fm)
|
||||
extern uint8_t gvarDisplayTimer;
|
||||
extern uint8_t gvarLastChanged;
|
||||
#endif
|
||||
#else
|
||||
#define GET_GVAR(x, ...) (x)
|
||||
#define GET_GVAR_PREC1(x, ...) (x*10)
|
||||
#endif
|
||||
|
||||
#if defined(CPUARM)
|
||||
#define GV_GET_GV1_VALUE(max) ((max<=GV_RANGESMALL && min>=GV_RANGESMALL_NEG) ? GV1_SMALL : GV1_LARGE)
|
||||
#define GV_INDEX_CALCULATION(x,max) ((max<=GV_RANGESMALL && min>=GV_RANGESMALL_NEG) ? (uint8_t) x-GV1_SMALL : ((x&(GV1_LARGE*2-1))-GV1_LARGE))
|
||||
#define GV_IS_GV_VALUE(x,min,max) ((max>GV1_SMALL || min<-GV1_SMALL) ? (x>GV_RANGELARGE || x<GV_RANGELARGE_NEG) : (x>max) || (x<min))
|
||||
#else
|
||||
#define GV_GET_GV1_VALUE(max) ((max<=GV_RANGESMALL) ? GV1_SMALL : GV1_LARGE)
|
||||
#define GV_INDEX_CALCULATION(x,max) ((max<=GV1_SMALL) ? (uint8_t) x-GV1_SMALL : ((x&(GV1_LARGE*2-1))-GV1_LARGE))
|
||||
#define GV_IS_GV_VALUE(x,min,max) ((x>max) || (x<min) )
|
||||
#endif
|
||||
|
||||
#define GV_INDEX_CALC_DELTA(x,delta) ((x&(delta*2-1)) - delta)
|
||||
|
||||
@@ -83,7 +63,6 @@
|
||||
#define GV_RANGELARGE (GV1_LARGE - (RESERVE_RANGE_FOR_GVARS+1))
|
||||
#define GV_RANGELARGE_NEG (-GV1_LARGE + (RESERVE_RANGE_FOR_GVARS+1))
|
||||
|
||||
#if defined(CPUARM)
|
||||
// the define GV1_LARGE marks the highest bit value used for this variables
|
||||
// because this would give too big numbers for ARM, we limit it further for
|
||||
// offset and weight
|
||||
@@ -91,12 +70,5 @@
|
||||
#define GV_RANGELARGE_WEIGHT_NEG (-GV_RANGE_WEIGHT)
|
||||
#define GV_RANGELARGE_OFFSET (GV_RANGE_OFFSET)
|
||||
#define GV_RANGELARGE_OFFSET_NEG (-GV_RANGE_OFFSET)
|
||||
#else
|
||||
// for stock we just use as much as possible
|
||||
#define GV_RANGELARGE_WEIGHT GV_RANGELARGE
|
||||
#define GV_RANGELARGE_WEIGHT_NEG GV_RANGELARGE_NEG
|
||||
#define GV_RANGELARGE_OFFSET GV_RANGELARGE
|
||||
#define GV_RANGELARGE_OFFSET_NEG GV_RANGELARGE_NEG
|
||||
#endif
|
||||
|
||||
#endif // _GVARS_H_
|
||||
#endif // _GVARS_H_
|
||||
|
||||
Reference in New Issue
Block a user