From 46b8037a736a24531c5f55505243fe6f5d8ff28f Mon Sep 17 00:00:00 2001 From: Pat Hickey Date: Sun, 1 Jan 2012 16:17:23 -0500 Subject: [PATCH] ArduCopter motors_octa: rewrite janky loops to use ch_of_mot * Previously the loop was written over channels, now it is over motors * the correct channel for that motor is determined by ch_of_mot. * ch_of_mot is defined correctly based on the config_channels macros. --- ArduCopter/motors_octa.pde | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/ArduCopter/motors_octa.pde b/ArduCopter/motors_octa.pde index 929d08be64..8c921ce07d 100644 --- a/ArduCopter/motors_octa.pde +++ b/ArduCopter/motors_octa.pde @@ -150,14 +150,13 @@ static void output_motors_armed() // this filter slows the acceleration of motors vs the deceleration // Idea by Denny Rowland to help with his Yaw issue - for(int8_t i = CH_1; i <= CH_11; i++ ) { - if(i == CH_5 || i == CH_6 || i == CH_9) - continue; - if(motor_filtered[i] < motor_out[i]){ - motor_filtered[i] = (motor_out[i] + motor_filtered[i]) / 2; + for(int8_t m = 0; m <= 8; m++ ) { + int c = ch_of_mot(m); + if(motor_filtered[c] < motor_out[c]){ + motor_filtered[c] = (motor_out[c] + motor_filtered[c]) / 2; }else{ // don't filter - motor_filtered[i] = motor_out[i]; + motor_filtered[c] = motor_out[c]; } }