AP_Motors: correct initialised_ok state for HeliDual+Quad
initialised_ok was being set to false when frame/class was set as the method was not overridden and thus Heli's set_frame_and_class was setting initialised_ok to false. When the init_output method was called it would be unconditionally reset to true.
This commit is contained in:
parent
4240ad7ae9
commit
434f49e6b6
@ -190,12 +190,6 @@ void AP_MotorsHeli::init(motor_frame_class frame_class, motor_frame_type frame_t
|
||||
_mav_type = MAV_TYPE_HELICOPTER;
|
||||
}
|
||||
|
||||
// set frame class (i.e. quad, hexa, heli) and type (i.e. x, plus)
|
||||
void AP_MotorsHeli::set_frame_class_and_type(motor_frame_class frame_class, motor_frame_type frame_type)
|
||||
{
|
||||
set_initialised_ok(frame_class == MOTOR_FRAME_HELI);
|
||||
}
|
||||
|
||||
// output_min - sets servos to neutral point with motors stopped
|
||||
void AP_MotorsHeli::output_min()
|
||||
{
|
||||
|
@ -52,7 +52,10 @@ public:
|
||||
void init(motor_frame_class frame_class, motor_frame_type frame_type) override;
|
||||
|
||||
// set frame class (i.e. quad, hexa, heli) and type (i.e. x, plus)
|
||||
void set_frame_class_and_type(motor_frame_class frame_class, motor_frame_type frame_type) override;
|
||||
void set_frame_class_and_type(motor_frame_class frame_class, motor_frame_type frame_type) override {
|
||||
_frame_class = frame_class;
|
||||
_frame_type = frame_type;
|
||||
}
|
||||
|
||||
// set update rate to motors - a value in hertz
|
||||
virtual void set_update_rate( uint16_t speed_hz ) override = 0;
|
||||
@ -198,7 +201,8 @@ protected:
|
||||
// reset_swash_servo - free up swash servo for maximum movement
|
||||
void reset_swash_servo(SRV_Channel::Aux_servo_function_t function);
|
||||
|
||||
// init_outputs - initialise Servo/PWM ranges and endpoints
|
||||
// init_outputs - initialise Servo/PWM ranges and endpoints. This
|
||||
// method also updates the initialised flag.
|
||||
virtual bool init_outputs() = 0;
|
||||
|
||||
// calculate_armed_scalars - must be implemented by child classes
|
||||
|
@ -267,7 +267,7 @@ bool AP_MotorsHeli_Dual::init_outputs()
|
||||
reset_swash_servo(SRV_Channels::get_motor_function(7));
|
||||
}
|
||||
|
||||
set_initialised_ok(true);
|
||||
set_initialised_ok(_frame_class == MOTOR_FRAME_HELI_DUAL);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -67,7 +67,7 @@ bool AP_MotorsHeli_Quad::init_outputs()
|
||||
_main_rotor.set_ext_gov_arot_bail(0);
|
||||
}
|
||||
|
||||
set_initialised_ok(true);
|
||||
set_initialised_ok(_frame_class == MOTOR_FRAME_HELI_QUAD);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -215,7 +215,7 @@ bool AP_MotorsHeli_Single::init_outputs()
|
||||
// yaw servo is an angle from -4500 to 4500
|
||||
SRV_Channels::set_angle(SRV_Channel::k_motor4, YAW_SERVO_MAX_ANGLE);
|
||||
|
||||
set_initialised_ok(true);
|
||||
set_initialised_ok(_frame_class == MOTOR_FRAME_HELI);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user