From 6af709e61727b40512995734cc4fa1aee93d1e41 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Fri, 12 Oct 2018 10:44:00 +1100 Subject: [PATCH] SRV_Channel: fixed build warnings --- libraries/SRV_Channel/SRV_Channel_aux.cpp | 74 +++++++++++------------ 1 file changed, 37 insertions(+), 37 deletions(-) diff --git a/libraries/SRV_Channel/SRV_Channel_aux.cpp b/libraries/SRV_Channel/SRV_Channel_aux.cpp index b743ec0b4f..9affa3b068 100644 --- a/libraries/SRV_Channel/SRV_Channel_aux.cpp +++ b/libraries/SRV_Channel/SRV_Channel_aux.cpp @@ -291,9 +291,9 @@ SRV_Channels::set_failsafe_pwm(SRV_Channel::Aux_servo_function_t function, uint1 return; } for (uint8_t i = 0; i < NUM_SERVO_CHANNELS; i++) { - const SRV_Channel &ch = channels[i]; - if (ch.function.get() == function) { - hal.rcout->set_failsafe_pwm(1U<set_failsafe_pwm(1U<set_failsafe_pwm(1U<set_failsafe_pwm(1U<set_safety_pwm(1U<set_safety_pwm(1U<set_radio_in(pwm); + cin->set_radio_in(pwm); } } } @@ -386,11 +386,11 @@ SRV_Channels::move_servo(SRV_Channel::Aux_servo_function_t function, float v = float(value - angle_min) / float(angle_max - angle_min); v = constrain_float(v, 0.0f, 1.0f); for (uint8_t i = 0; i < NUM_SERVO_CHANNELS; i++) { - SRV_Channel &ch = channels[i]; - if (ch.function.get() == function) { - float v2 = ch.get_reversed()? (1-v) : v; - uint16_t pwm = ch.servo_min + v2 * (ch.servo_max - ch.servo_min); - ch.set_output_pwm(pwm); + SRV_Channel &c = channels[i]; + if (c.function.get() == function) { + float v2 = c.get_reversed()? (1-v) : v; + uint16_t pwm = c.servo_min + v2 * (c.servo_max - c.servo_min); + c.set_output_pwm(pwm); } } } @@ -618,21 +618,21 @@ void SRV_Channels::limit_slew_rate(SRV_Channel::Aux_servo_function_t function, f return; } for (uint8_t i=0; iread_last_sent(ch.ch_num); - if (last_pwm == ch.output_pwm) { + SRV_Channel &c = channels[i]; + if (c.function == function) { + c.calc_pwm(functions[function].output_scaled); + uint16_t last_pwm = hal.rcout->read_last_sent(c.ch_num); + if (last_pwm == c.output_pwm) { continue; } - uint16_t max_change = (ch.get_output_max() - ch.get_output_min()) * slew_rate * dt * 0.01f; + uint16_t max_change = (c.get_output_max() - c.get_output_min()) * slew_rate * dt * 0.01f; if (max_change == 0 || dt > 1) { // always allow some change. If dt > 1 then assume we // are just starting out, and only allow a small // change for this loop max_change = 1; } - ch.output_pwm = constrain_int16(ch.output_pwm, last_pwm-max_change, last_pwm+max_change); + c.output_pwm = constrain_int16(c.output_pwm, last_pwm-max_change, last_pwm+max_change); } } } @@ -672,9 +672,9 @@ void SRV_Channels::set_output_min_max(SRV_Channel::Aux_servo_function_t function void SRV_Channels::constrain_pwm(SRV_Channel::Aux_servo_function_t function) { for (uint8_t i=0; i