1
0
Fork 0
mirror of https://github.com/opentx/opentx.git synced 2025-07-20 14:55:13 +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;
}
#if defined(PCBTARANIS)
#if defined(VIRTUALINPUTS)
void clearInputs()
{
memset(g_model.expoData, 0, sizeof(g_model.expoData)); // clear all expos
@ -355,7 +355,7 @@ inline void applyDefaultTemplate()
#else
void applyDefaultTemplate()
{
#if defined(PCBTARANIS)
#if defined(VIRTUALINPUTS)
defaultInputs();
#endif
@ -363,7 +363,7 @@ void applyDefaultTemplate()
MixData *mix = mixAddress(i);
mix->destCh = i;
mix->weight = 100;
#if defined(PCBTARANIS)
#if defined(VIRTUALINPUTS)
mix->srcRaw = i+1;
#else
mix->srcRaw = MIXSRC_Rud - 1 + channel_order(i+1);
@ -408,7 +408,7 @@ void modelDefault(uint8_t id)
}
#endif
#if defined(CPUARM) && !defined(PCBTARANIS)
#if defined(PCBSKY9X)
g_model.externalModule = MODULE_TYPE_PPM;
#endif
@ -431,7 +431,7 @@ void modelDefault(uint8_t id)
#endif
}
#if defined(PCBTARANIS)
#if defined(VIRTUALINPUTS)
bool isInputRecursive(int index)
{
ExpoData * line = expoAddress(0);
@ -453,7 +453,7 @@ int8_t getMovedSource(GET_MOVED_SOURCE_PARAMS)
int8_t result = 0;
static tmr10ms_t s_move_last_time = 0;
#if defined(PCBTARANIS)
#if defined(VIRTUALINPUTS)
static int16_t inputsStates[MAX_INPUTS];
if (min <= MIXSRC_FIRST_INPUT) {
for (uint8_t i=0; i<MAX_INPUTS; i++) {
@ -483,7 +483,7 @@ int8_t getMovedSource(GET_MOVED_SOURCE_PARAMS)
}
if (result || recent) {
#if defined(PCBTARANIS)
#if defined(VIRTUALINPUTS)
memcpy(inputsStates, anas, sizeof(inputsStates));
#endif
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)
{
#if defined(PCBTARANIS)
#if defined(VIRTUALINPUTS)
int result = 0;
for (uint8_t i=0; i<MAX_FLIGHT_MODES; i++) {
trim_t v = getRawTrimValue(phase, idx);
@ -545,7 +545,7 @@ int getTrimValue(uint8_t phase, uint8_t idx)
#endif
}
#if defined(PCBTARANIS)
#if defined(VIRTUALINPUTS)
bool setTrimValue(uint8_t phase, uint8_t idx, int trim)
{
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
#if !defined(PCBTARANIS)
#if !defined(VIRTUALINPUTS)
uint8_t getTrimFlightPhase(uint8_t phase, uint8_t idx)
{
for (uint8_t i=0; i<MAX_FLIGHT_MODES; i++) {
@ -1095,7 +1095,7 @@ void checkTHR()
}
else {
calibratedStick[thrchn] = -1024;
#if !defined(PCBTARANIS)
#if !defined(VIRTUALINPUTS)
if (thrchn < NUM_STICKS) {
rawAnas[thrchn] = anas[thrchn] = calibratedStick[thrchn];
}
@ -1201,7 +1201,7 @@ uint8_t checkTrim(uint8_t event)
}
else {
phase = getTrimFlightPhase(mixerCurrentFlightMode, idx);
#if defined(PCBTARANIS)
#if defined(VIRTUALINPUTS)
before = getTrimValue(phase, idx);
#else
before = getRawTrimValue(phase, idx);
@ -1210,7 +1210,7 @@ uint8_t checkTrim(uint8_t event)
}
#else
phase = getTrimFlightPhase(mixerCurrentFlightMode, idx);
#if defined(PCBTARANIS)
#if defined(VIRTUALINPUTS)
before = getTrimValue(phase, idx);
#else
before = getRawTrimValue(phase, idx);
@ -1251,7 +1251,7 @@ uint8_t checkTrim(uint8_t event)
else
#endif
{
#if defined(PCBTARANIS)
#if defined(VIRTUALINPUTS)
if (!setTrimValue(phase, idx, after)) {
// we don't play a beep, so we exit now the function
return;
@ -1318,7 +1318,7 @@ uint16_t BandGap ;
#if !defined(SIMU)
uint16_t anaIn(uint8_t chan)
{
#if defined(PCBTARANIS)
#if defined(VIRTUALINPUTS)
return s_anaFilt[chan];
#elif defined(PCBSKY9X) && !defined(REVA)
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++) {
temp[x] += getAnalogValue(x);
}
#if defined(PCBTARANIS)
#if defined(VIRTUALINPUTS)
if (calibrationState) break;
#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
}
else {
#ifdef PCBTARANIS
#if defined(VIRTUALINPUTS)
val = RESX + calibratedStick[g_model.thrTraceSrc == 0 ? THR_STICK : g_model.thrTraceSrc+NUM_STICKS-1];
#else
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
#if defined(PCBTARANIS)
#if defined(VIRTUALINPUTS)
#define INSTANT_TRIM_MARGIN 10 /* around 1% */
#else
#define INSTANT_TRIM_MARGIN 15 /* around 1.5% */
@ -2228,7 +2228,7 @@ ISR(USART0_UDRE_vect)
void instantTrim()
{
#if defined(PCBTARANIS)
#if defined(VIRTUALINPUTS)
int16_t anas_0[NUM_INPUTS];
evalInputs(e_perout_mode_notrainer | e_perout_mode_nosticks);
memcpy(anas_0, anas, sizeof(anas_0));
@ -2240,7 +2240,7 @@ void instantTrim()
if (stick!=THR_STICK) {
// don't instant trim the throttle stick
uint8_t trim_phase = getTrimFlightPhase(mixerCurrentFlightMode, stick);
#if defined(PCBTARANIS)
#if defined(VIRTUALINPUTS)
int16_t delta = 0;
for (int e=0; e<MAX_EXPOS; 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) {
int16_t original_trim = getTrimValue(mixerCurrentFlightMode, i);
for (uint8_t phase=0; phase<MAX_FLIGHT_MODES; phase++) {
#if defined(PCBTARANIS)
#if defined(VIRTUALINPUTS)
trim_t trim = getRawTrimValue(phase, i);
if (trim.mode / 2 == phase)
setTrimValue(phase, i, trim.value - original_trim);

View file

@ -1185,15 +1185,6 @@ LimitData *limitAddress(uint8_t idx);
int8_t *curveAddress(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
// It's also easier to initialize them here.
#if defined(VIRTUALINPUTS)