1424,13 → 1424,15 |
LIMIT_MIN_MAX(tmp_long, -255 * STICK_GAIN, 255 * STICK_GAIN); // more than 2 times the full range makes no sense |
HCGas -= tmp_long; |
// ------------------------- D-Part 1: Vario Meter ---------------------------- |
tmp_long = VarioMeter / 8; |
if(tmp_long > 8) tmp_long = 8; // limit quadratic part on upward movement to avoid to much gas reduction |
if(tmp_long > 0) tmp_long = VarioMeter + (tmp_long * tmp_long) / 4L; |
else tmp_long = VarioMeter - (tmp_long * tmp_long) / 4L; |
tmp_long = (tmp_long * (long)Parameter_Luftdruck_D) / 128L; // scale to d-gain parameter |
LIMIT_MIN_MAX(tmp_long,-32 * STICK_GAIN, 64 * STICK_GAIN); |
HCGas -= tmp_long; |
tmp_int = VarioMeter / 8; |
LIMIT_MIN_MAX(tmp_int, -180, 180); // avoid overflow when squared |
tmp_int2 = tmp_int; |
LIMIT_MAX(tmp_int2,8); // limit quadratic part on upward movement to avoid to much gas reduction |
if(tmp_int2 > 0) tmp_int = tmp_int + (tmp_int2 * tmp_int2) / 4L; |
else tmp_int = tmp_int - (tmp_int2 * tmp_int2) / 4L; |
tmp_int = (tmp_int * (long)Parameter_Luftdruck_D) / 128L; // scale to d-gain parameter |
LIMIT_MIN_MAX(tmp_int,-32 * STICK_GAIN, 64 * STICK_GAIN); |
HCGas -= tmp_int; |
// ------------------------ D-Part 2: ACC-Z Integral ------------------------ |
tmp_long = ((Mess_Integral_Hoch / 128L) * (int32_t) Parameter_Hoehe_ACC_Wirkung) / (128L / STICK_GAIN); |
LIMIT_MIN_MAX(tmp_long, -32 * STICK_GAIN, 64 * STICK_GAIN); |
1438,8 → 1440,8 |
|
if(BaroExpandActive) HCGas = HoverGas; |
// ------------------------ D-Part 3: GpsZ ---------------------------------- |
tmp_int = (Parameter_Hoehe_GPS_Z * (long)FromNaviCtrl_Value.GpsZ)/128L; |
LIMIT_MIN_MAX(tmp_long, -32 * STICK_GAIN, 64 * STICK_GAIN); |
tmp_int = (Parameter_Hoehe_GPS_Z * (int)FromNaviCtrl_Value.GpsZ)/128L; |
LIMIT_MIN_MAX(tmp_int, -32 * STICK_GAIN, 64 * STICK_GAIN); |
HCGas -= tmp_int; |
|
// limit deviation from hoover point within the target region |