From f3c1791341419cf78fe58bcf850300a779f757e1 Mon Sep 17 00:00:00 2001 From: Peter Barker Date: Sat, 22 Jun 2019 09:49:52 +1000 Subject: [PATCH] Copter: stop passing gcs chan into method which wants an object --- ArduCopter/Copter.h | 2 +- ArduCopter/GCS_Mavlink.cpp | 2 +- ArduCopter/compassmot.cpp | 8 +++----- 3 files changed, 5 insertions(+), 7 deletions(-) diff --git a/ArduCopter/Copter.h b/ArduCopter/Copter.h index f8a308e2fc..f543794f3b 100644 --- a/ArduCopter/Copter.h +++ b/ArduCopter/Copter.h @@ -670,7 +670,7 @@ private: bool far_from_EKF_origin(const Location& loc); // compassmot.cpp - MAV_RESULT mavlink_compassmot(mavlink_channel_t chan); + MAV_RESULT mavlink_compassmot(const GCS_MAVLINK &gcs_chan); // crash_check.cpp void crash_check(); diff --git a/ArduCopter/GCS_Mavlink.cpp b/ArduCopter/GCS_Mavlink.cpp index e83a3473ff..613d7d9b63 100644 --- a/ArduCopter/GCS_Mavlink.cpp +++ b/ArduCopter/GCS_Mavlink.cpp @@ -539,7 +539,7 @@ MAV_RESULT GCS_MAVLINK_Copter::_handle_command_preflight_calibration(const mavli { if (is_equal(packet.param6,1.0f)) { // compassmot calibration - return copter.mavlink_compassmot(chan); + return copter.mavlink_compassmot(*this); } return GCS_MAVLINK::_handle_command_preflight_calibration(packet); diff --git a/ArduCopter/compassmot.cpp b/ArduCopter/compassmot.cpp index 48a310f3f9..21bcd9fa1f 100644 --- a/ArduCopter/compassmot.cpp +++ b/ArduCopter/compassmot.cpp @@ -5,7 +5,7 @@ */ // setup_compassmot - sets compass's motor interference parameters -MAV_RESULT Copter::mavlink_compassmot(mavlink_channel_t chan) +MAV_RESULT Copter::mavlink_compassmot(const GCS_MAVLINK &gcs_chan) { #if FRAME_CONFIG == HELI_FRAME // compassmot not implemented for tradheli @@ -33,8 +33,6 @@ MAV_RESULT Copter::mavlink_compassmot(mavlink_channel_t chan) ap.compass_mot = true; } - GCS_MAVLINK_Copter &gcs_chan = gcs().chan(chan-MAVLINK_COMM_0); - // check compass is enabled if (!AP::compass().enabled()) { gcs_chan.send_text(MAV_SEVERITY_CRITICAL, "Compass disabled"); @@ -85,7 +83,7 @@ MAV_RESULT Copter::mavlink_compassmot(mavlink_channel_t chan) } // send back initial ACK - mavlink_msg_command_ack_send(chan, MAV_CMD_PREFLIGHT_CALIBRATION,0); + mavlink_msg_command_ack_send(gcs_chan.get_chan(), MAV_CMD_PREFLIGHT_CALIBRATION,0); // flash leds AP_Notify::flags.esc_calibration = true; @@ -215,7 +213,7 @@ MAV_RESULT Copter::mavlink_compassmot(mavlink_channel_t chan) if (AP_HAL::millis() - last_send_time > 500) { last_send_time = AP_HAL::millis(); - mavlink_msg_compassmot_status_send(chan, + mavlink_msg_compassmot_status_send(gcs_chan.get_chan(), channel_throttle->get_control_in(), battery.current_amps(), interference_pct[compass.get_primary()],