From b199fb22a2c1f7f3f39070b0b68cd950d6340ccf Mon Sep 17 00:00:00 2001 From: Jason Short Date: Fri, 29 Jun 2012 21:37:28 -0700 Subject: [PATCH] Added code for self centering throttle - disabled by default. --- ArduCopter/ArduCopter.pde | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/ArduCopter/ArduCopter.pde b/ArduCopter/ArduCopter.pde index ad923451e1..3f09fe155f 100644 --- a/ArduCopter/ArduCopter.pde +++ b/ArduCopter/ArduCopter.pde @@ -1298,6 +1298,13 @@ static void super_slow_loop() if (g.log_bitmask & MASK_LOG_CUR && motors.armed()) Log_Write_Current(); + + #if 0 //CENTER_THROTTLE == 1 + // recalibrate the throttle_cruise to center on the sticks + g.rc_3.set_range((g.throttle_cruise - (MAXIMUM_THROTTLE - g.throttle_cruise)), MAXIMUM_THROTTLE); + g.rc_3.set_range_out(0,1000); + #endif + // this function disarms the copter if it has been sitting on the ground for any moment of time greater than 25 seconds // but only of the control mode is manual if((control_mode <= ACRO) && (g.rc_3.control_in == 0)){ @@ -1675,7 +1682,7 @@ void update_throttle_mode(void) } // calc average throttle if ((g.rc_3.control_in > g.throttle_min) && abs(climb_rate) < 60){ - throttle_avg = throttle_avg * .98 + (float)g.rc_3.control_in * .02; + throttle_avg = throttle_avg * .99 + (float)g.rc_3.control_in * .01; g.throttle_cruise = throttle_avg; } #endif