mirror of
https://github.com/paparazzi/paparazzi.git
synced 2026-05-09 22:49:53 +08:00
[fixedwing] use min/max_cruise_throttle variables instead of defines
closes #1057
This commit is contained in:
@@ -214,8 +214,8 @@ static void nav_ground_speed_loop(void)
|
|||||||
&& nav_ground_speed_setpoint < MAXIMUM_AIRSPEED) {
|
&& nav_ground_speed_setpoint < MAXIMUM_AIRSPEED) {
|
||||||
float err = nav_ground_speed_setpoint - (*stateGetHorizontalSpeedNorm_f());
|
float err = nav_ground_speed_setpoint - (*stateGetHorizontalSpeedNorm_f());
|
||||||
v_ctl_auto_throttle_cruise_throttle += nav_ground_speed_pgain * err;
|
v_ctl_auto_throttle_cruise_throttle += nav_ground_speed_pgain * err;
|
||||||
Bound(v_ctl_auto_throttle_cruise_throttle, V_CTL_AUTO_THROTTLE_MIN_CRUISE_THROTTLE,
|
Bound(v_ctl_auto_throttle_cruise_throttle, v_ctl_auto_throttle_min_cruise_throttle,
|
||||||
V_CTL_AUTO_THROTTLE_MAX_CRUISE_THROTTLE);
|
v_ctl_auto_throttle_max_cruise_throttle);
|
||||||
} else {
|
} else {
|
||||||
/* Reset cruise throttle to nominal value */
|
/* Reset cruise throttle to nominal value */
|
||||||
v_ctl_auto_throttle_cruise_throttle = V_CTL_AUTO_THROTTLE_NOMINAL_CRUISE_THROTTLE;
|
v_ctl_auto_throttle_cruise_throttle = V_CTL_AUTO_THROTTLE_NOMINAL_CRUISE_THROTTLE;
|
||||||
|
|||||||
@@ -434,10 +434,10 @@ inline static void loiter(void)
|
|||||||
#else
|
#else
|
||||||
float throttle_diff = v_ctl_auto_throttle_cruise_throttle - v_ctl_auto_throttle_nominal_cruise_throttle;
|
float throttle_diff = v_ctl_auto_throttle_cruise_throttle - v_ctl_auto_throttle_nominal_cruise_throttle;
|
||||||
if (throttle_diff > 0) {
|
if (throttle_diff > 0) {
|
||||||
float max_diff = Max(V_CTL_AUTO_THROTTLE_MAX_CRUISE_THROTTLE - v_ctl_auto_throttle_nominal_cruise_throttle, 0.1);
|
float max_diff = Max(v_ctl_auto_throttle_max_cruise_throttle - v_ctl_auto_throttle_nominal_cruise_throttle, 0.1);
|
||||||
pitch_trim = throttle_diff / max_diff * v_ctl_pitch_dash_trim;
|
pitch_trim = throttle_diff / max_diff * v_ctl_pitch_dash_trim;
|
||||||
} else {
|
} else {
|
||||||
float max_diff = Max(v_ctl_auto_throttle_nominal_cruise_throttle - V_CTL_AUTO_THROTTLE_MIN_CRUISE_THROTTLE, 0.1);
|
float max_diff = Max(v_ctl_auto_throttle_nominal_cruise_throttle - v_ctl_auto_throttle_min_cruise_throttle, 0.1);
|
||||||
pitch_trim = -throttle_diff / max_diff * v_ctl_pitch_loiter_trim;
|
pitch_trim = -throttle_diff / max_diff * v_ctl_pitch_loiter_trim;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -414,10 +414,10 @@ inline static float loiter(void)
|
|||||||
|
|
||||||
float throttle_dif = v_ctl_auto_throttle_cruise_throttle - v_ctl_auto_throttle_nominal_cruise_throttle;
|
float throttle_dif = v_ctl_auto_throttle_cruise_throttle - v_ctl_auto_throttle_nominal_cruise_throttle;
|
||||||
if (throttle_dif > 0) {
|
if (throttle_dif > 0) {
|
||||||
float max_dif = Max(V_CTL_AUTO_THROTTLE_MAX_CRUISE_THROTTLE - v_ctl_auto_throttle_nominal_cruise_throttle, 0.1);
|
float max_dif = Max(v_ctl_auto_throttle_max_cruise_throttle - v_ctl_auto_throttle_nominal_cruise_throttle, 0.1);
|
||||||
elevator_trim = throttle_dif / max_dif * v_ctl_auto_throttle_dash_trim;
|
elevator_trim = throttle_dif / max_dif * v_ctl_auto_throttle_dash_trim;
|
||||||
} else {
|
} else {
|
||||||
float max_dif = Max(v_ctl_auto_throttle_nominal_cruise_throttle - V_CTL_AUTO_THROTTLE_MIN_CRUISE_THROTTLE, 0.1);
|
float max_dif = Max(v_ctl_auto_throttle_nominal_cruise_throttle - v_ctl_auto_throttle_min_cruise_throttle, 0.1);
|
||||||
elevator_trim = - throttle_dif / max_dif * v_ctl_auto_throttle_loiter_trim;
|
elevator_trim = - throttle_dif / max_dif * v_ctl_auto_throttle_loiter_trim;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user