From 3b33f4ca4dc9d77d905d96a1f5daa9697ad9f7a7 Mon Sep 17 00:00:00 2001 From: Peter Barker Date: Thu, 4 Apr 2019 16:41:10 +1100 Subject: [PATCH] Copter: add floating-point-constant designators --- ArduCopter/mode.cpp | 2 +- ArduCopter/mode.h | 6 +++--- ArduCopter/radio.cpp | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/ArduCopter/mode.cpp b/ArduCopter/mode.cpp index 85009306f6..be28d36549 100644 --- a/ArduCopter/mode.cpp +++ b/ArduCopter/mode.cpp @@ -591,7 +591,7 @@ float Copter::Mode::get_pilot_desired_throttle() const throttle_in = 0.5f + ((float)(throttle_control-mid_stick)) * 0.5f / (float)(1000-mid_stick); } - float expo = constrain_float(-(thr_mid-0.5)/0.375, -0.5f, 1.0f); + const float expo = constrain_float(-(thr_mid-0.5f)/0.375f, -0.5f, 1.0f); // calculate the output throttle using the given expo function float throttle_out = throttle_in*(1.0f-expo) + expo*throttle_in*throttle_in*throttle_in; return throttle_out; diff --git a/ArduCopter/mode.h b/ArduCopter/mode.h index d7479519fd..365b0bf6c5 100644 --- a/ArduCopter/mode.h +++ b/ArduCopter/mode.h @@ -669,13 +669,13 @@ private: void update_height_estimate(void); // minimum assumed height - const float height_min = 0.1; + const float height_min = 0.1f; // maximum scaling height - const float height_max = 3.0; + const float height_max = 3.0f; AP_Float flow_max; - AC_PI_2D flow_pi_xy{0.2, 0.3, 3000, 5, 0.0025}; + AC_PI_2D flow_pi_xy{0.2f, 0.3f, 3000, 5, 0.0025f}; AP_Float flow_filter_hz; AP_Int8 flow_min_quality; AP_Int8 brake_rate_dps; diff --git a/ArduCopter/radio.cpp b/ArduCopter/radio.cpp index 72794ba663..8966148393 100644 --- a/ArduCopter/radio.cpp +++ b/ArduCopter/radio.cpp @@ -206,7 +206,7 @@ void Copter::radio_passthrough_to_motors() { motors->set_radio_passthrough(channel_roll->norm_input(), channel_pitch->norm_input(), - channel_throttle->get_control_in_zero_dz()*0.001, + channel_throttle->get_control_in_zero_dz()*0.001f, channel_yaw->norm_input()); }