Subversion Repositories FlightCtrl

Compare Revisions

Ignore whitespace Rev 1748 → Rev 1749

/branches/MartinW_Jeti+/fc.c
57,6 → 57,18
#include "mymath.h"
#include "isqrt.h"
 
#ifdef NODISPLAY // main.h
 
 
 
#endif
unsigned char loop1, loop2, loop3, loop4;
int keynumber=-7;
 
 
unsigned char pos1, pos2, pos3, pos4=0;
unsigned char Motors0,Motors1,Motors2,Motors3,Motors4,Motors5,Motors6,Motors7;
unsigned char updatemotors=5;
unsigned char h,m,s;
unsigned int BaroExpandActive = 0;
int MesswertNick,MesswertRoll,MesswertGier,MesswertGierBias, RohMesswertNick,RohMesswertRoll;
1700,9 → 1712,40
else if(Mixer.Motor[i][3] == -64) tmp_int -= GierMischanteil;
else tmp_int += ((long)GierMischanteil * Mixer.Motor[i][3]) / 64L;
 
if(tmp_int > tmp_motorwert[i]) tmp_int = (tmp_motorwert[i] + tmp_int) / 2; // MotorSmoothing
else tmp_int = 2 * tmp_int - tmp_motorwert[i]; // MotorSmoothing
 
 
 
 
if(tmp_int > tmp_motorwert[i]) tmp_int = (tmp_motorwert[i] + tmp_int) / 2; // MotorSmoothing
// else tmp_int = 2 * tmp_int - tmp_motorwert[i]; // MotorSmoothing
// Arthur P: the original code allowed the motor value to drop to 0 or negative values
// straight off, i.e. could amplify an intended decrease excessively while upregulation
// is dampened. The modification would still allow immediate drop below intended value
// but would dampen this. This would still allow for airbraking of the prop to have effect
// but it might lead to less sudden excessive drops in rpm with only gradual recovery.
// 090807 Arthur P: Due to problems with uart.c which still refers to user parameter 1 and 2 and
// possible timing issues with the shutter interval load, removed the shutter interval functions
// and switched to use of userparam6 for the motor smoothing.
// 091114 Inserted modification into 0.76g source code.
// 20100804 Modified v.0.80d code where motorsmoothing is no longer a separate function.
// Downsmoothing either uses default v.0.7x+ 150% downstep (user para 7 == 0),
// 50% downstep (user para 7 == 1 or 2), or downsteps of x% (userpara7 ==):
// 66.6% (3), 75% (4), 80% (5), 90% (10), 95% (20), 97.5% (40), 98% (50), 99% (100).
else
{
if(Parameter_UserParam7 < 2)
{ // Original function
tmp_int = 2 * tmp_int - tmp_motorwert[i];
}
else
{
// If userpara7 >= 2 then allow >= 50% of the intended step down to rapidly reach the intended value.
tmp_int = tmp_int + ((tmp_motorwert[i] - tmp_int)/Parameter_UserParam7);
}
}
LIMIT_MIN_MAX(tmp_int,MIN_GAS * 4,MAX_GAS * 4);
Motor[i].SetPoint = tmp_int / 4;
Motor[i].SetPointLowerBits = (tmp_int % 4)<<1; // (3 bits total)