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

Cosmetics

This commit is contained in:
Bertrand Songis 2019-06-01 15:51:50 +02:00
parent 882e9638cc
commit 34cfcc3fe4
No known key found for this signature in database
GPG key ID: F189F79290FEC50F
8 changed files with 18 additions and 20 deletions

View file

@ -26,7 +26,7 @@
int expoFn(int x) int expoFn(int x)
{ {
ExpoData * ed = expoAddress(s_currIdx); ExpoData * ed = expoAddress(s_currIdx);
int16_t anas[NUM_INPUTS] = {0}; int16_t anas[MAX_INPUTS] = {0};
applyExpos(anas, e_perout_mode_inactive_flight_mode, ed->srcRaw, x); applyExpos(anas, e_perout_mode_inactive_flight_mode, ed->srcRaw, x);
return anas[ed->chn]; return anas[ed->chn];
} }

View file

@ -26,7 +26,7 @@
int expoFn(int x) int expoFn(int x)
{ {
ExpoData *ed = expoAddress(s_currIdx); ExpoData *ed = expoAddress(s_currIdx);
int16_t anas[NUM_INPUTS] = {0}; int16_t anas[MAX_INPUTS] = {0};
anas[ed->chn] = x; anas[ed->chn] = x;
applyExpos(anas, e_perout_mode_inactive_flight_mode); applyExpos(anas, e_perout_mode_inactive_flight_mode);
return anas[ed->chn]; return anas[ed->chn];
@ -153,7 +153,7 @@ bool swapExpoMix(uint8_t expo, uint8_t &idx, uint8_t up)
} }
if (tgt_idx == MAX_EXPOS) { if (tgt_idx == MAX_EXPOS) {
if (((ExpoData *)x)->chn == NUM_INPUTS-1) if (((ExpoData *)x)->chn == MAX_INPUTS-1)
return false; return false;
((ExpoData *)x)->chn++; ((ExpoData *)x)->chn++;
return true; return true;
@ -166,7 +166,7 @@ bool swapExpoMix(uint8_t expo, uint8_t &idx, uint8_t up)
else return false; else return false;
} }
else { else {
if (((ExpoData *)x)->chn<NUM_INPUTS-1) ((ExpoData *)x)->chn++; if (((ExpoData *)x)->chn<MAX_INPUTS-1) ((ExpoData *)x)->chn++;
else return false; else return false;
} }
return true; return true;
@ -741,7 +741,7 @@ void menuModelExpoMix(uint8_t expo, event_t event)
uint8_t cur = 1; uint8_t cur = 1;
uint8_t i = 0; uint8_t i = 0;
for (uint8_t ch=1; ch<=(expo ? NUM_INPUTS : MAX_OUTPUT_CHANNELS); ch++) { for (uint8_t ch=1; ch<=(expo ? MAX_INPUTS : MAX_OUTPUT_CHANNELS); ch++) {
void *pointer = NULL; MixData * &md = (MixData * &)pointer; ExpoData * &ed = (ExpoData * &)pointer; void *pointer = NULL; MixData * &md = (MixData * &)pointer; ExpoData * &ed = (ExpoData * &)pointer;
coord_t y = MENU_HEADER_HEIGHT-FH+1+(cur-menuVerticalOffset)*FH; coord_t y = MENU_HEADER_HEIGHT-FH+1+(cur-menuVerticalOffset)*FH;
if (expo ? (i<MAX_EXPOS && (ed=expoAddress(i))->chn+1 == ch && EXPO_VALID(ed)) : (i<MAX_MIXERS && (md=mixAddress(i))->srcRaw && md->destCh+1 == ch)) { if (expo ? (i<MAX_EXPOS && (ed=expoAddress(i))->chn+1 == ch && EXPO_VALID(ed)) : (i<MAX_MIXERS && (md=mixAddress(i))->srcRaw && md->destCh+1 == ch)) {

View file

@ -25,7 +25,7 @@
int expoFn(int x) int expoFn(int x)
{ {
ExpoData * ed = expoAddress(s_currIdx); ExpoData * ed = expoAddress(s_currIdx);
int16_t anas[NUM_INPUTS] = {0}; int16_t anas[MAX_INPUTS] = {0};
applyExpos(anas, e_perout_mode_inactive_flight_mode, ed->srcRaw, x); applyExpos(anas, e_perout_mode_inactive_flight_mode, ed->srcRaw, x);
return anas[ed->chn]; return anas[ed->chn];
} }

View file

@ -26,7 +26,7 @@
int expoFn(int x) int expoFn(int x)
{ {
ExpoData * ed = expoAddress(s_currIdx); ExpoData * ed = expoAddress(s_currIdx);
int16_t anas[NUM_INPUTS] = {0}; int16_t anas[MAX_INPUTS] = {0};
applyExpos(anas, e_perout_mode_inactive_flight_mode, ed->srcRaw, x); applyExpos(anas, e_perout_mode_inactive_flight_mode, ed->srcRaw, x);
return anas[ed->chn]; return anas[ed->chn];
} }
@ -128,7 +128,7 @@ bool swapExpos(uint8_t & idx, uint8_t up)
} }
if (tgt_idx == MAX_EXPOS) { if (tgt_idx == MAX_EXPOS) {
if (x->chn == NUM_INPUTS-1) if (x->chn == MAX_INPUTS-1)
return false; return false;
x->chn++; x->chn++;
return true; return true;
@ -141,7 +141,7 @@ bool swapExpos(uint8_t & idx, uint8_t up)
else return false; else return false;
} }
else { else {
if (x->chn<NUM_INPUTS-1) x->chn++; if (x->chn<MAX_INPUTS-1) x->chn++;
else return false; else return false;
} }
return true; return true;
@ -499,7 +499,7 @@ bool menuModelExposAll(event_t event)
int cur = 0; int cur = 0;
int i = 0; int i = 0;
for (int ch=1; ch<=NUM_INPUTS; ch++) { for (int ch=1; ch<=MAX_INPUTS; ch++) {
ExpoData * ed; ExpoData * ed;
coord_t y = MENU_CONTENT_TOP + (cur-menuVerticalOffset)*FH; coord_t y = MENU_CONTENT_TOP + (cur-menuVerticalOffset)*FH;
if ((i<MAX_EXPOS && (ed=expoAddress(i))->chn+1 == ch && EXPO_VALID(ed))) { if ((i<MAX_EXPOS && (ed=expoAddress(i))->chn+1 == ch && EXPO_VALID(ed))) {

View file

@ -87,7 +87,7 @@ bool swapExpos(uint8_t & idx, uint8_t up)
} }
if (tgt_idx == MAX_EXPOS) { if (tgt_idx == MAX_EXPOS) {
if (x->chn == NUM_INPUTS-1) if (x->chn == MAX_INPUTS-1)
return false; return false;
x->chn++; x->chn++;
return true; return true;
@ -100,7 +100,7 @@ bool swapExpos(uint8_t & idx, uint8_t up)
else return false; else return false;
} }
else { else {
if (x->chn<NUM_INPUTS-1) x->chn++; if (x->chn<MAX_INPUTS-1) x->chn++;
else return false; else return false;
} }
return true; return true;
@ -387,7 +387,7 @@ void menuModelExposAll(event_t event)
int cur = 0; int cur = 0;
int i = 0; int i = 0;
for (int ch=1; ch<=NUM_INPUTS; ch++) { for (int ch=1; ch<=MAX_INPUTS; ch++) {
ExpoData * ed; ExpoData * ed;
coord_t y = MENU_HEADER_HEIGHT+1+(cur-menuVerticalOffset)*FH; coord_t y = MENU_HEADER_HEIGHT+1+(cur-menuVerticalOffset)*FH;
if (i<MAX_EXPOS && (ed=expoAddress(i))->chn+1 == ch && EXPO_VALID(ed)) { if (i<MAX_EXPOS && (ed=expoAddress(i))->chn+1 == ch && EXPO_VALID(ed)) {

View file

@ -21,8 +21,8 @@
#include "opentx.h" #include "opentx.h"
#include "timers.h" #include "timers.h"
int8_t virtualInputsTrims[NUM_INPUTS]; int8_t virtualInputsTrims[MAX_INPUTS];
int16_t anas [NUM_INPUTS] = {0}; int16_t anas [MAX_INPUTS] = {0};
int16_t trims[NUM_TRIMS] = {0}; int16_t trims[NUM_TRIMS] = {0};
int32_t chans[MAX_OUTPUT_CHANNELS] = {0}; int32_t chans[MAX_OUTPUT_CHANNELS] = {0};
BeepANACenter bpanaCenter = 0; BeepANACenter bpanaCenter = 0;

View file

@ -1617,7 +1617,7 @@ void opentxResume()
void instantTrim() void instantTrim()
{ {
int16_t anas_0[NUM_INPUTS]; int16_t anas_0[MAX_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));

View file

@ -748,8 +748,6 @@ extern int32_t chans[MAX_OUTPUT_CHANNELS];
extern int16_t ex_chans[MAX_OUTPUT_CHANNELS]; // Outputs (before LIMITS) of the last perMain extern int16_t ex_chans[MAX_OUTPUT_CHANNELS]; // Outputs (before LIMITS) of the last perMain
extern int16_t channelOutputs[MAX_OUTPUT_CHANNELS]; extern int16_t channelOutputs[MAX_OUTPUT_CHANNELS];
#define NUM_INPUTS (MAX_INPUTS)
int expo(int x, int k); int expo(int x, int k);
inline void getMixSrcRange(const int source, int16_t & valMin, int16_t & valMax, LcdFlags * flags = 0) inline void getMixSrcRange(const int source, int16_t & valMin, int16_t & valMax, LcdFlags * flags = 0)
@ -865,9 +863,9 @@ LogicalSwitchData * lswAddress(uint8_t idx);
// 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.
extern int8_t virtualInputsTrims[NUM_INPUTS]; extern int8_t virtualInputsTrims[MAX_INPUTS];
extern int16_t anas [NUM_INPUTS]; extern int16_t anas [MAX_INPUTS];
extern int16_t trims[NUM_TRIMS]; extern int16_t trims[NUM_TRIMS];
extern BeepANACenter bpanaCenter; extern BeepANACenter bpanaCenter;