mirror of
https://github.com/opentx/opentx.git
synced 2025-07-13 11:29:51 +03:00
Remarks from Damjan in e8aaa67450
taken into account
This commit is contained in:
parent
d85ee61cb3
commit
efb37a4419
5 changed files with 50 additions and 62 deletions
|
@ -49,7 +49,7 @@ int16_t ex_chans[NUM_CHNOUT] = {0}; // Outputs (before LIMITS) of the last perMa
|
|||
int16_t cyc_anas[3] = {0};
|
||||
#endif
|
||||
|
||||
void applyExpos(int16_t *anas, uint8_t mode APPLY_EXPOS_EXTRA_PARAMS)
|
||||
void applyExpos(int16_t * anas, uint8_t mode APPLY_EXPOS_EXTRA_PARAMS)
|
||||
{
|
||||
#if !defined(VIRTUALINPUTS)
|
||||
int16_t anas2[NUM_INPUTS]; // values before expo, to ensure same expo base when multiple expo lines are used
|
||||
|
@ -70,7 +70,7 @@ void applyExpos(int16_t *anas, uint8_t mode APPLY_EXPOS_EXTRA_PARAMS)
|
|||
continue;
|
||||
if (getSwitch(ed->swtch)) {
|
||||
#if defined(VIRTUALINPUTS)
|
||||
int v;
|
||||
int32_t v;
|
||||
if (ed->srcRaw == ovwrIdx) {
|
||||
v = ovwrValue;
|
||||
}
|
||||
|
@ -108,7 +108,7 @@ void applyExpos(int16_t *anas, uint8_t mode APPLY_EXPOS_EXTRA_PARAMS)
|
|||
//========== WEIGHT ===============
|
||||
#if defined(CPUARM)
|
||||
int32_t weight = GET_GVAR_PREC1(ed->weight, MIN_EXPO_WEIGHT, 100, mixerCurrentFlightMode);
|
||||
v = ((int32_t)v * weight) / 1000;
|
||||
v = div_and_round<1000>((int32_t)v * weight);
|
||||
#else
|
||||
int16_t weight = GET_GVAR(ed->weight, MIN_EXPO_WEIGHT, 100, mixerCurrentFlightMode);
|
||||
weight = calc100to256(weight);
|
||||
|
@ -118,7 +118,7 @@ void applyExpos(int16_t *anas, uint8_t mode APPLY_EXPOS_EXTRA_PARAMS)
|
|||
#if defined(VIRTUALINPUTS)
|
||||
//========== OFFSET ===============
|
||||
int32_t offset = GET_GVAR_PREC1(ed->offset, -100, 100, mixerCurrentFlightMode);
|
||||
if (offset) v += calc100toRESX(offset) / 10;
|
||||
if (offset) v += div_and_round<10>(calc100toRESX(offset));
|
||||
|
||||
//========== TRIMS ================
|
||||
if (ed->carryTrim < TRIM_ON)
|
||||
|
@ -856,14 +856,14 @@ void evalFlightModeMixes(uint8_t mode, uint8_t tick10ms)
|
|||
//========== WEIGHT ===============
|
||||
int32_t dv = (int32_t)v * weight;
|
||||
#if defined(CPUARM)
|
||||
dv /= 10;
|
||||
dv = div_and_round<10>(dv);
|
||||
#endif
|
||||
|
||||
//========== OFFSET / AFTER ===============
|
||||
if (apply_offset_and_curve) {
|
||||
#if defined(CPUARM)
|
||||
int32_t offset = GET_GVAR_PREC1(MD_OFFSET(md), GV_RANGELARGE_NEG, GV_RANGELARGE, mixerCurrentFlightMode);
|
||||
if (offset) dv += int32_t(calc100toRESX_16Bits(offset) / 10) << 8;
|
||||
if (offset) dv += div_and_round<10>(calc100toRESX_16Bits(offset)) << 8;
|
||||
#else
|
||||
int16_t offset = GET_GVAR(MD_OFFSET(md), GV_RANGELARGE_NEG, GV_RANGELARGE, mixerCurrentFlightMode);
|
||||
if (offset) dv += int32_t(calc100toRESX_16Bits(offset)) << 8;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue