diff --git a/ArduCopter/Copter.cpp b/ArduCopter/Copter.cpp index 90909334a5..c297f3b5c9 100644 --- a/ArduCopter/Copter.cpp +++ b/ArduCopter/Copter.cpp @@ -99,7 +99,7 @@ Copter::Copter(void) : #endif #if FRAME_CONFIG == HELI_FRAME // ToDo: Input Manager is only used by Heli for 3.3, but will be used by all frames for 3.4 - input_manager(MAIN_LOOP_RATE), + input_manager(), #endif in_mavlink_delay(false), gcs_out_of_time(false), diff --git a/ArduCopter/config.h b/ArduCopter/config.h index 360a50515c..d56a8dd6f4 100644 --- a/ArduCopter/config.h +++ b/ArduCopter/config.h @@ -49,7 +49,6 @@ #define MAGNETOMETER ENABLED // run at 400Hz on all systems -# define MAIN_LOOP_RATE 400 # define MAIN_LOOP_SECONDS 0.0025f #ifndef ARMING_DELAY_SEC diff --git a/ArduCopter/system.cpp b/ArduCopter/system.cpp index 19c06243b4..5791bf0809 100644 --- a/ArduCopter/system.cpp +++ b/ArduCopter/system.cpp @@ -117,7 +117,10 @@ void Copter::init_ardupilot() // trad heli specific initialisation heli_init(); #endif - +#if FRAME_CONFIG == HELI_FRAME + input_manager.set_loop_rate(scheduler.get_loop_rate_hz()); +#endif + init_rc_in(); // sets up rc channels from radio // default frame class to match firmware if possible @@ -515,36 +518,36 @@ void Copter::allocate_motors(void) case AP_Motors::MOTOR_FRAME_OCTAQUAD: case AP_Motors::MOTOR_FRAME_DODECAHEXA: default: - motors = new AP_MotorsMatrix(MAIN_LOOP_RATE); + motors = new AP_MotorsMatrix(copter.scheduler.get_loop_rate_hz()); motors_var_info = AP_MotorsMatrix::var_info; break; case AP_Motors::MOTOR_FRAME_TRI: - motors = new AP_MotorsTri(MAIN_LOOP_RATE); + motors = new AP_MotorsTri(copter.scheduler.get_loop_rate_hz()); motors_var_info = AP_MotorsTri::var_info; AP_Param::set_frame_type_flags(AP_PARAM_FRAME_TRICOPTER); break; case AP_Motors::MOTOR_FRAME_SINGLE: - motors = new AP_MotorsSingle(MAIN_LOOP_RATE); + motors = new AP_MotorsSingle(copter.scheduler.get_loop_rate_hz()); motors_var_info = AP_MotorsSingle::var_info; break; case AP_Motors::MOTOR_FRAME_COAX: - motors = new AP_MotorsCoax(MAIN_LOOP_RATE); + motors = new AP_MotorsCoax(copter.scheduler.get_loop_rate_hz()); motors_var_info = AP_MotorsCoax::var_info; break; case AP_Motors::MOTOR_FRAME_TAILSITTER: - motors = new AP_MotorsTailsitter(MAIN_LOOP_RATE); + motors = new AP_MotorsTailsitter(copter.scheduler.get_loop_rate_hz()); motors_var_info = AP_MotorsTailsitter::var_info; break; #else // FRAME_CONFIG == HELI_FRAME case AP_Motors::MOTOR_FRAME_HELI_DUAL: - motors = new AP_MotorsHeli_Dual(MAIN_LOOP_RATE); + motors = new AP_MotorsHeli_Dual(copter.scheduler.get_loop_rate_hz()); motors_var_info = AP_MotorsHeli_Dual::var_info; AP_Param::set_frame_type_flags(AP_PARAM_FRAME_HELI); break; case AP_Motors::MOTOR_FRAME_HELI: default: - motors = new AP_MotorsHeli_Single(MAIN_LOOP_RATE); + motors = new AP_MotorsHeli_Single(copter.scheduler.get_loop_rate_hz()); motors_var_info = AP_MotorsHeli_Single::var_info; AP_Param::set_frame_type_flags(AP_PARAM_FRAME_HELI); break;