1
0
Fork 0
mirror of https://github.com/opentx/opentx.git synced 2025-07-21 15:25:17 +03:00

Cosmetics again

This commit is contained in:
Bertrand Songis 2015-03-14 10:37:19 +01:00
parent 2cb536469f
commit 04bb6b7835
2 changed files with 21 additions and 30 deletions

View file

@ -314,7 +314,7 @@ uint16_t evalChkSum()
return sum; return sum;
} }
#if defined(PCBTARANIS) #if defined(VIRTUALINPUTS)
void clearInputs() void clearInputs()
{ {
memset(g_model.expoData, 0, sizeof(g_model.expoData)); // clear all expos memset(g_model.expoData, 0, sizeof(g_model.expoData)); // clear all expos
@ -355,7 +355,7 @@ inline void applyDefaultTemplate()
#else #else
void applyDefaultTemplate() void applyDefaultTemplate()
{ {
#if defined(PCBTARANIS) #if defined(VIRTUALINPUTS)
defaultInputs(); defaultInputs();
#endif #endif
@ -363,7 +363,7 @@ void applyDefaultTemplate()
MixData *mix = mixAddress(i); MixData *mix = mixAddress(i);
mix->destCh = i; mix->destCh = i;
mix->weight = 100; mix->weight = 100;
#if defined(PCBTARANIS) #if defined(VIRTUALINPUTS)
mix->srcRaw = i+1; mix->srcRaw = i+1;
#else #else
mix->srcRaw = MIXSRC_Rud - 1 + channel_order(i+1); mix->srcRaw = MIXSRC_Rud - 1 + channel_order(i+1);
@ -408,7 +408,7 @@ void modelDefault(uint8_t id)
} }
#endif #endif
#if defined(CPUARM) && !defined(PCBTARANIS) #if defined(PCBSKY9X)
g_model.externalModule = MODULE_TYPE_PPM; g_model.externalModule = MODULE_TYPE_PPM;
#endif #endif
@ -431,7 +431,7 @@ void modelDefault(uint8_t id)
#endif #endif
} }
#if defined(PCBTARANIS) #if defined(VIRTUALINPUTS)
bool isInputRecursive(int index) bool isInputRecursive(int index)
{ {
ExpoData * line = expoAddress(0); ExpoData * line = expoAddress(0);
@ -453,7 +453,7 @@ int8_t getMovedSource(GET_MOVED_SOURCE_PARAMS)
int8_t result = 0; int8_t result = 0;
static tmr10ms_t s_move_last_time = 0; static tmr10ms_t s_move_last_time = 0;
#if defined(PCBTARANIS) #if defined(VIRTUALINPUTS)
static int16_t inputsStates[MAX_INPUTS]; static int16_t inputsStates[MAX_INPUTS];
if (min <= MIXSRC_FIRST_INPUT) { if (min <= MIXSRC_FIRST_INPUT) {
for (uint8_t i=0; i<MAX_INPUTS; i++) { for (uint8_t i=0; i<MAX_INPUTS; i++) {
@ -483,7 +483,7 @@ int8_t getMovedSource(GET_MOVED_SOURCE_PARAMS)
} }
if (result || recent) { if (result || recent) {
#if defined(PCBTARANIS) #if defined(VIRTUALINPUTS)
memcpy(inputsStates, anas, sizeof(inputsStates)); memcpy(inputsStates, anas, sizeof(inputsStates));
#endif #endif
memcpy(sourcesStates, calibratedStick, sizeof(sourcesStates)); memcpy(sourcesStates, calibratedStick, sizeof(sourcesStates));
@ -519,7 +519,7 @@ trim_t getRawTrimValue(uint8_t phase, uint8_t idx)
int getTrimValue(uint8_t phase, uint8_t idx) int getTrimValue(uint8_t phase, uint8_t idx)
{ {
#if defined(PCBTARANIS) #if defined(VIRTUALINPUTS)
int result = 0; int result = 0;
for (uint8_t i=0; i<MAX_FLIGHT_MODES; i++) { for (uint8_t i=0; i<MAX_FLIGHT_MODES; i++) {
trim_t v = getRawTrimValue(phase, idx); trim_t v = getRawTrimValue(phase, idx);
@ -545,7 +545,7 @@ int getTrimValue(uint8_t phase, uint8_t idx)
#endif #endif
} }
#if defined(PCBTARANIS) #if defined(VIRTUALINPUTS)
bool setTrimValue(uint8_t phase, uint8_t idx, int trim) bool setTrimValue(uint8_t phase, uint8_t idx, int trim)
{ {
for (uint8_t i=0; i<MAX_FLIGHT_MODES; i++) { for (uint8_t i=0; i<MAX_FLIGHT_MODES; i++) {
@ -584,7 +584,7 @@ void setTrimValue(uint8_t phase, uint8_t idx, int trim)
} }
#endif #endif
#if !defined(PCBTARANIS) #if !defined(VIRTUALINPUTS)
uint8_t getTrimFlightPhase(uint8_t phase, uint8_t idx) uint8_t getTrimFlightPhase(uint8_t phase, uint8_t idx)
{ {
for (uint8_t i=0; i<MAX_FLIGHT_MODES; i++) { for (uint8_t i=0; i<MAX_FLIGHT_MODES; i++) {
@ -1095,7 +1095,7 @@ void checkTHR()
} }
else { else {
calibratedStick[thrchn] = -1024; calibratedStick[thrchn] = -1024;
#if !defined(PCBTARANIS) #if !defined(VIRTUALINPUTS)
if (thrchn < NUM_STICKS) { if (thrchn < NUM_STICKS) {
rawAnas[thrchn] = anas[thrchn] = calibratedStick[thrchn]; rawAnas[thrchn] = anas[thrchn] = calibratedStick[thrchn];
} }
@ -1201,7 +1201,7 @@ uint8_t checkTrim(uint8_t event)
} }
else { else {
phase = getTrimFlightPhase(mixerCurrentFlightMode, idx); phase = getTrimFlightPhase(mixerCurrentFlightMode, idx);
#if defined(PCBTARANIS) #if defined(VIRTUALINPUTS)
before = getTrimValue(phase, idx); before = getTrimValue(phase, idx);
#else #else
before = getRawTrimValue(phase, idx); before = getRawTrimValue(phase, idx);
@ -1210,7 +1210,7 @@ uint8_t checkTrim(uint8_t event)
} }
#else #else
phase = getTrimFlightPhase(mixerCurrentFlightMode, idx); phase = getTrimFlightPhase(mixerCurrentFlightMode, idx);
#if defined(PCBTARANIS) #if defined(VIRTUALINPUTS)
before = getTrimValue(phase, idx); before = getTrimValue(phase, idx);
#else #else
before = getRawTrimValue(phase, idx); before = getRawTrimValue(phase, idx);
@ -1251,7 +1251,7 @@ uint8_t checkTrim(uint8_t event)
else else
#endif #endif
{ {
#if defined(PCBTARANIS) #if defined(VIRTUALINPUTS)
if (!setTrimValue(phase, idx, after)) { if (!setTrimValue(phase, idx, after)) {
// we don't play a beep, so we exit now the function // we don't play a beep, so we exit now the function
return; return;
@ -1318,7 +1318,7 @@ uint16_t BandGap ;
#if !defined(SIMU) #if !defined(SIMU)
uint16_t anaIn(uint8_t chan) uint16_t anaIn(uint8_t chan)
{ {
#if defined(PCBTARANIS) #if defined(VIRTUALINPUTS)
return s_anaFilt[chan]; return s_anaFilt[chan];
#elif defined(PCBSKY9X) && !defined(REVA) #elif defined(PCBSKY9X) && !defined(REVA)
static const uint8_t crossAna[]={1,5,7,0,4,6,2,3}; static const uint8_t crossAna[]={1,5,7,0,4,6,2,3};
@ -1352,7 +1352,7 @@ void getADC()
for (uint32_t x=0; x<NUMBER_ANALOG; x++) { for (uint32_t x=0; x<NUMBER_ANALOG; x++) {
temp[x] += getAnalogValue(x); temp[x] += getAnalogValue(x);
} }
#if defined(PCBTARANIS) #if defined(VIRTUALINPUTS)
if (calibrationState) break; if (calibrationState) break;
#endif #endif
} }
@ -1682,7 +1682,7 @@ void doMixerCalculations()
if (val<0) val=0; // prevent val be negative, which would corrupt throttle trace and timers; could occur if safetyswitch is smaller than limits if (val<0) val=0; // prevent val be negative, which would corrupt throttle trace and timers; could occur if safetyswitch is smaller than limits
} }
else { else {
#ifdef PCBTARANIS #if defined(VIRTUALINPUTS)
val = RESX + calibratedStick[g_model.thrTraceSrc == 0 ? THR_STICK : g_model.thrTraceSrc+NUM_STICKS-1]; val = RESX + calibratedStick[g_model.thrTraceSrc == 0 ? THR_STICK : g_model.thrTraceSrc+NUM_STICKS-1];
#else #else
val = RESX + (g_model.thrTraceSrc == 0 ? rawAnas[THR_STICK] : calibratedStick[g_model.thrTraceSrc+NUM_STICKS-1]); val = RESX + (g_model.thrTraceSrc == 0 ? rawAnas[THR_STICK] : calibratedStick[g_model.thrTraceSrc+NUM_STICKS-1]);
@ -2220,7 +2220,7 @@ ISR(USART0_UDRE_vect)
#endif #endif
#endif #endif
#if defined(PCBTARANIS) #if defined(VIRTUALINPUTS)
#define INSTANT_TRIM_MARGIN 10 /* around 1% */ #define INSTANT_TRIM_MARGIN 10 /* around 1% */
#else #else
#define INSTANT_TRIM_MARGIN 15 /* around 1.5% */ #define INSTANT_TRIM_MARGIN 15 /* around 1.5% */
@ -2228,7 +2228,7 @@ ISR(USART0_UDRE_vect)
void instantTrim() void instantTrim()
{ {
#if defined(PCBTARANIS) #if defined(VIRTUALINPUTS)
int16_t anas_0[NUM_INPUTS]; int16_t anas_0[NUM_INPUTS];
evalInputs(e_perout_mode_notrainer | e_perout_mode_nosticks); evalInputs(e_perout_mode_notrainer | e_perout_mode_nosticks);
memcpy(anas_0, anas, sizeof(anas_0)); memcpy(anas_0, anas, sizeof(anas_0));
@ -2240,7 +2240,7 @@ void instantTrim()
if (stick!=THR_STICK) { if (stick!=THR_STICK) {
// don't instant trim the throttle stick // don't instant trim the throttle stick
uint8_t trim_phase = getTrimFlightPhase(mixerCurrentFlightMode, stick); uint8_t trim_phase = getTrimFlightPhase(mixerCurrentFlightMode, stick);
#if defined(PCBTARANIS) #if defined(VIRTUALINPUTS)
int16_t delta = 0; int16_t delta = 0;
for (int e=0; e<MAX_EXPOS; e++) { for (int e=0; e<MAX_EXPOS; e++) {
ExpoData * ed = expoAddress(e); ExpoData * ed = expoAddress(e);
@ -2342,7 +2342,7 @@ void moveTrimsToOffsets() // copy state of 3 primary to subtrim
if (i!=THR_STICK || !g_model.thrTrim) { if (i!=THR_STICK || !g_model.thrTrim) {
int16_t original_trim = getTrimValue(mixerCurrentFlightMode, i); int16_t original_trim = getTrimValue(mixerCurrentFlightMode, i);
for (uint8_t phase=0; phase<MAX_FLIGHT_MODES; phase++) { for (uint8_t phase=0; phase<MAX_FLIGHT_MODES; phase++) {
#if defined(PCBTARANIS) #if defined(VIRTUALINPUTS)
trim_t trim = getRawTrimValue(phase, i); trim_t trim = getRawTrimValue(phase, i);
if (trim.mode / 2 == phase) if (trim.mode / 2 == phase)
setTrimValue(phase, i, trim.value - original_trim); setTrimValue(phase, i, trim.value - original_trim);

View file

@ -1185,15 +1185,6 @@ LimitData *limitAddress(uint8_t idx);
int8_t *curveAddress(uint8_t idx); int8_t *curveAddress(uint8_t idx);
LogicalSwitchData *lswAddress(uint8_t idx); LogicalSwitchData *lswAddress(uint8_t idx);
#if !defined(BOOT) && !defined(XCURVES)
struct CurveInfo {
int8_t *crv;
uint8_t points;
bool custom;
};
extern CurveInfo curveInfo(uint8_t idx);
#endif
// static variables used in evalFlightModeMixes - moved here so they don't interfere with the stack // static variables used in evalFlightModeMixes - moved here so they don't interfere with the stack
// It's also easier to initialize them here. // It's also easier to initialize them here.
#if defined(VIRTUALINPUTS) #if defined(VIRTUALINPUTS)