Browse Source

Sub: use enum class for ArmingMethod and ArmingRequired

mission-4.1.18
Peter Barker 6 years ago committed by Peter Barker
parent
commit
c48042424b
  1. 2
      ArduSub/GCS_Mavlink.cpp
  2. 2
      ArduSub/Sub.h
  3. 4
      ArduSub/joystick.cpp
  4. 2
      ArduSub/motors.cpp

2
ArduSub/GCS_Mavlink.cpp

@ -562,7 +562,7 @@ MAV_RESULT GCS_MAVLINK_Sub::handle_command_long_packet(const mavlink_command_lon
case MAV_CMD_COMPONENT_ARM_DISARM: case MAV_CMD_COMPONENT_ARM_DISARM:
if (is_equal(packet.param1,1.0f)) { if (is_equal(packet.param1,1.0f)) {
// attempt to arm and return success or failure // attempt to arm and return success or failure
if (sub.init_arm_motors(AP_Arming::ArmingMethod::MAVLINK)) { if (sub.init_arm_motors(AP_Arming::Method::MAVLINK)) {
return MAV_RESULT_ACCEPTED; return MAV_RESULT_ACCEPTED;
} }
} else if (is_zero(packet.param1)) { } else if (is_zero(packet.param1)) {

2
ArduSub/Sub.h

@ -591,7 +591,7 @@ private:
void update_surface_and_bottom_detector(); void update_surface_and_bottom_detector();
void set_surfaced(bool at_surface); void set_surfaced(bool at_surface);
void set_bottomed(bool at_bottom); void set_bottomed(bool at_bottom);
bool init_arm_motors(AP_Arming::ArmingMethod method); bool init_arm_motors(AP_Arming::Method method);
void init_disarm_motors(); void init_disarm_motors();
void motors_output(); void motors_output();
Vector3f pv_location_to_vector(const Location& loc); Vector3f pv_location_to_vector(const Location& loc);

4
ArduSub/joystick.cpp

@ -130,11 +130,11 @@ void Sub::handle_jsbutton_press(uint8_t button, bool shift, bool held)
if (motors.armed()) { if (motors.armed()) {
init_disarm_motors(); init_disarm_motors();
} else { } else {
init_arm_motors(AP_Arming::ArmingMethod::MAVLINK); init_arm_motors(AP_Arming::Method::MAVLINK);
} }
break; break;
case JSButton::button_function_t::k_arm: case JSButton::button_function_t::k_arm:
init_arm_motors(AP_Arming::ArmingMethod::MAVLINK); init_arm_motors(AP_Arming::Method::MAVLINK);
break; break;
case JSButton::button_function_t::k_disarm: case JSButton::button_function_t::k_disarm:
init_disarm_motors(); init_disarm_motors();

2
ArduSub/motors.cpp

@ -8,7 +8,7 @@ void Sub::enable_motor_output()
// init_arm_motors - performs arming process including initialisation of barometer and gyros // init_arm_motors - performs arming process including initialisation of barometer and gyros
// returns false if arming failed because of pre-arm checks, arming checks or a gyro calibration failure // returns false if arming failed because of pre-arm checks, arming checks or a gyro calibration failure
bool Sub::init_arm_motors(AP_Arming::ArmingMethod method) bool Sub::init_arm_motors(AP_Arming::Method method)
{ {
static bool in_arm_motors = false; static bool in_arm_motors = false;

Loading…
Cancel
Save