|
|
|
@ -36,7 +36,7 @@ uint8_t Sub::mavlink_compassmot(mavlink_channel_t chan)
@@ -36,7 +36,7 @@ uint8_t Sub::mavlink_compassmot(mavlink_channel_t chan)
|
|
|
|
|
|
|
|
|
|
// check compass is enabled
|
|
|
|
|
if (!g.compass_enabled) { |
|
|
|
|
gcs[chan-MAVLINK_COMM_0].send_text(MAV_SEVERITY_CRITICAL, "Compass disabled"); |
|
|
|
|
gcs_chan[chan-MAVLINK_COMM_0].send_text(MAV_SEVERITY_CRITICAL, "Compass disabled"); |
|
|
|
|
ap.compass_mot = false; |
|
|
|
|
return 1; |
|
|
|
|
} |
|
|
|
@ -45,7 +45,7 @@ uint8_t Sub::mavlink_compassmot(mavlink_channel_t chan)
@@ -45,7 +45,7 @@ uint8_t Sub::mavlink_compassmot(mavlink_channel_t chan)
|
|
|
|
|
compass.read(); |
|
|
|
|
for (uint8_t i=0; i<compass.get_count(); i++) { |
|
|
|
|
if (!compass.healthy(i)) { |
|
|
|
|
gcs[chan-MAVLINK_COMM_0].send_text(MAV_SEVERITY_CRITICAL, "Check compass"); |
|
|
|
|
gcs_chan[chan-MAVLINK_COMM_0].send_text(MAV_SEVERITY_CRITICAL, "Check compass"); |
|
|
|
|
ap.compass_mot = false; |
|
|
|
|
return 1; |
|
|
|
|
} |
|
|
|
@ -54,7 +54,7 @@ uint8_t Sub::mavlink_compassmot(mavlink_channel_t chan)
@@ -54,7 +54,7 @@ uint8_t Sub::mavlink_compassmot(mavlink_channel_t chan)
|
|
|
|
|
// check if radio is calibrated
|
|
|
|
|
pre_arm_rc_checks(); |
|
|
|
|
if (!ap.pre_arm_rc_check) { |
|
|
|
|
gcs[chan-MAVLINK_COMM_0].send_text(MAV_SEVERITY_CRITICAL, "RC not calibrated"); |
|
|
|
|
gcs_chan[chan-MAVLINK_COMM_0].send_text(MAV_SEVERITY_CRITICAL, "RC not calibrated"); |
|
|
|
|
ap.compass_mot = false; |
|
|
|
|
return 1; |
|
|
|
|
} |
|
|
|
@ -62,7 +62,7 @@ uint8_t Sub::mavlink_compassmot(mavlink_channel_t chan)
@@ -62,7 +62,7 @@ uint8_t Sub::mavlink_compassmot(mavlink_channel_t chan)
|
|
|
|
|
// check throttle is at zero
|
|
|
|
|
read_radio(); |
|
|
|
|
if (channel_throttle->get_control_in() != 0) { |
|
|
|
|
gcs[chan-MAVLINK_COMM_0].send_text(MAV_SEVERITY_CRITICAL, "Throttle not zero"); |
|
|
|
|
gcs_chan[chan-MAVLINK_COMM_0].send_text(MAV_SEVERITY_CRITICAL, "Throttle not zero"); |
|
|
|
|
ap.compass_mot = false; |
|
|
|
|
return 1; |
|
|
|
|
} |
|
|
|
@ -87,13 +87,13 @@ uint8_t Sub::mavlink_compassmot(mavlink_channel_t chan)
@@ -87,13 +87,13 @@ uint8_t Sub::mavlink_compassmot(mavlink_channel_t chan)
|
|
|
|
|
AP_Notify::flags.esc_calibration = true; |
|
|
|
|
|
|
|
|
|
// warn user we are starting calibration
|
|
|
|
|
gcs[chan-MAVLINK_COMM_0].send_text(MAV_SEVERITY_INFO, "Starting calibration"); |
|
|
|
|
gcs_chan[chan-MAVLINK_COMM_0].send_text(MAV_SEVERITY_INFO, "Starting calibration"); |
|
|
|
|
|
|
|
|
|
// inform what type of compensation we are attempting
|
|
|
|
|
if (comp_type == AP_COMPASS_MOT_COMP_CURRENT) { |
|
|
|
|
gcs[chan-MAVLINK_COMM_0].send_text(MAV_SEVERITY_INFO, "Current"); |
|
|
|
|
gcs_chan[chan-MAVLINK_COMM_0].send_text(MAV_SEVERITY_INFO, "Current"); |
|
|
|
|
} else { |
|
|
|
|
gcs[chan-MAVLINK_COMM_0].send_text(MAV_SEVERITY_INFO, "Throttle"); |
|
|
|
|
gcs_chan[chan-MAVLINK_COMM_0].send_text(MAV_SEVERITY_INFO, "Throttle"); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// disable battery failsafe
|
|
|
|
@ -236,10 +236,10 @@ uint8_t Sub::mavlink_compassmot(mavlink_channel_t chan)
@@ -236,10 +236,10 @@ uint8_t Sub::mavlink_compassmot(mavlink_channel_t chan)
|
|
|
|
|
} |
|
|
|
|
compass.save_motor_compensation(); |
|
|
|
|
// display success message
|
|
|
|
|
gcs[chan-MAVLINK_COMM_0].send_text(MAV_SEVERITY_INFO, "Calibration successful"); |
|
|
|
|
gcs_chan[chan-MAVLINK_COMM_0].send_text(MAV_SEVERITY_INFO, "Calibration successful"); |
|
|
|
|
} else { |
|
|
|
|
// compensation vector never updated, report failure
|
|
|
|
|
gcs[chan-MAVLINK_COMM_0].send_text(MAV_SEVERITY_NOTICE, "Failed"); |
|
|
|
|
gcs_chan[chan-MAVLINK_COMM_0].send_text(MAV_SEVERITY_NOTICE, "Failed"); |
|
|
|
|
compass.motor_compensation_type(AP_COMPASS_MOT_COMP_DISABLED); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|