Copter: replace fabs() with fabsf()
This commit is contained in:
parent
1127b716c4
commit
2e191e5a3d
@ -127,17 +127,17 @@ static void get_pilot_desired_angle_rates(int16_t roll_in, int16_t pitch_in, int
|
||||
rate_bf_level = rate_bf_level*acro_level_mix;
|
||||
|
||||
// Calculate rate limit to prevent change of rate through inverted
|
||||
rate_limit = fabs(fabs(rate_bf_request.x)-fabs(rate_bf_level.x));
|
||||
rate_limit = fabsf(fabsf(rate_bf_request.x)-fabsf(rate_bf_level.x));
|
||||
rate_bf_request.x += rate_bf_level.x;
|
||||
rate_bf_request.x = constrain_float(rate_bf_request.x, -rate_limit, rate_limit);
|
||||
|
||||
// Calculate rate limit to prevent change of rate through inverted
|
||||
rate_limit = fabs(fabs(rate_bf_request.y)-fabs(rate_bf_level.y));
|
||||
rate_limit = fabsf(fabs(rate_bf_request.y)-fabsf(rate_bf_level.y));
|
||||
rate_bf_request.y += rate_bf_level.y;
|
||||
rate_bf_request.y = constrain_float(rate_bf_request.y, -rate_limit, rate_limit);
|
||||
|
||||
// Calculate rate limit to prevent change of rate through inverted
|
||||
rate_limit = fabs(fabs(rate_bf_request.z)-fabs(rate_bf_level.z));
|
||||
rate_limit = fabsf(fabsf(rate_bf_request.z)-fabsf(rate_bf_level.z));
|
||||
rate_bf_request.z += rate_bf_level.z;
|
||||
rate_bf_request.z = constrain_float(rate_bf_request.z, -rate_limit, rate_limit);
|
||||
}
|
||||
|
@ -66,7 +66,7 @@ static void drift_run()
|
||||
float pitch_vel = vel.y * ahrs.sin_yaw() + vel.x * ahrs.cos_yaw(); // body pitch vel
|
||||
|
||||
// gain sceduling for Yaw
|
||||
float pitch_vel2 = min(fabs(pitch_vel), 2000);
|
||||
float pitch_vel2 = min(fabsf(pitch_vel), 2000);
|
||||
target_yaw_rate = ((float)target_roll/1.0f) * (1.0f - (pitch_vel2 / 5000.0f)) * g.acro_yaw_p;
|
||||
|
||||
roll_vel = constrain_float(roll_vel, -DRIFT_SPEEDLIMIT, DRIFT_SPEEDLIMIT);
|
||||
|
@ -188,14 +188,14 @@ static void flip_run()
|
||||
|
||||
if (flip_roll_dir != 0) {
|
||||
// we are rolling
|
||||
recovery_angle = fabs(flip_orig_attitude.x - (float)ahrs.roll_sensor);
|
||||
recovery_angle = fabsf(flip_orig_attitude.x - (float)ahrs.roll_sensor);
|
||||
} else {
|
||||
// we are pitching
|
||||
recovery_angle = fabs(flip_orig_attitude.y - (float)ahrs.pitch_sensor);
|
||||
recovery_angle = fabsf(flip_orig_attitude.y - (float)ahrs.pitch_sensor);
|
||||
}
|
||||
|
||||
// check for successful recovery
|
||||
if (fabs(recovery_angle) <= FLIP_RECOVERY_ANGLE) {
|
||||
if (fabsf(recovery_angle) <= FLIP_RECOVERY_ANGLE) {
|
||||
// restore original flight mode
|
||||
if (!set_mode(flip_orig_control_mode)) {
|
||||
// this should never happen but just in case
|
||||
|
@ -247,7 +247,7 @@ static void poshold_run()
|
||||
}
|
||||
|
||||
// if velocity is very low reduce braking time to 0.5seconds
|
||||
if ((fabs(vel_right) <= POSHOLD_SPEED_0) && (poshold.brake_timeout_roll > 50*LOOP_RATE_FACTOR)) {
|
||||
if ((fabsf(vel_right) <= POSHOLD_SPEED_0) && (poshold.brake_timeout_roll > 50*LOOP_RATE_FACTOR)) {
|
||||
poshold.brake_timeout_roll = 50*LOOP_RATE_FACTOR;
|
||||
}
|
||||
|
||||
@ -341,7 +341,7 @@ static void poshold_run()
|
||||
}
|
||||
|
||||
// if velocity is very low reduce braking time to 0.5seconds
|
||||
if ((fabs(vel_fw) <= POSHOLD_SPEED_0) && (poshold.brake_timeout_pitch > 50*LOOP_RATE_FACTOR)) {
|
||||
if ((fabsf(vel_fw) <= POSHOLD_SPEED_0) && (poshold.brake_timeout_pitch > 50*LOOP_RATE_FACTOR)) {
|
||||
poshold.brake_timeout_pitch = 50*LOOP_RATE_FACTOR;
|
||||
}
|
||||
|
||||
|
@ -308,7 +308,7 @@ static bool pre_arm_checks(bool display_failure)
|
||||
nav_filter_status filt_status = inertial_nav.get_filter_status();
|
||||
bool using_baro_ref = (!filt_status.flags.pred_horiz_pos_rel && filt_status.flags.pred_horiz_pos_abs);
|
||||
if (using_baro_ref) {
|
||||
if (fabs(inertial_nav.get_altitude() - baro_alt) > PREARM_MAX_ALT_DISPARITY_CM) {
|
||||
if (fabsf(inertial_nav.get_altitude() - baro_alt) > PREARM_MAX_ALT_DISPARITY_CM) {
|
||||
if (display_failure) {
|
||||
gcs_send_text_P(SEVERITY_HIGH,PSTR("PreArm: Altitude disparity"));
|
||||
}
|
||||
@ -674,7 +674,7 @@ static bool arm_checks(bool display_failure, bool arming_from_gcs)
|
||||
nav_filter_status filt_status = inertial_nav.get_filter_status();
|
||||
bool using_baro_ref = (!filt_status.flags.pred_horiz_pos_rel && filt_status.flags.pred_horiz_pos_abs);
|
||||
if (((g.arming_check == ARMING_CHECK_ALL) || (g.arming_check & ARMING_CHECK_BARO)) && using_baro_ref) {
|
||||
if (fabs(inertial_nav.get_altitude() - baro_alt) > PREARM_MAX_ALT_DISPARITY_CM) {
|
||||
if (fabsf(inertial_nav.get_altitude() - baro_alt) > PREARM_MAX_ALT_DISPARITY_CM) {
|
||||
if (display_failure) {
|
||||
gcs_send_text_P(SEVERITY_HIGH,PSTR("Arm: Altitude disparity"));
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user