GCS_MAVLink: make compass.mag_cal_fixed_yaw return boolean

this method could be used from a transmitter without GCS enabled, for example
This commit is contained in:
Peter Barker 2024-02-02 11:34:22 +11:00 committed by Andrew Tridgell
parent 4c272d21ee
commit 4a1adc69da
1 changed files with 13 additions and 6 deletions

View File

@ -3832,19 +3832,24 @@ void GCS_MAVLINK::handle_optical_flow(const mavlink_message_t &msg)
#endif
#if COMPASS_CAL_ENABLED
#if AP_COMPASS_CALIBRATION_FIXED_YAW_ENABLED
/*
handle MAV_CMD_FIXED_MAG_CAL_YAW
*/
MAV_RESULT GCS_MAVLINK::handle_command_fixed_mag_cal_yaw(const mavlink_command_int_t &packet)
{
Compass &compass = AP::compass();
return compass.mag_cal_fixed_yaw(packet.param1,
uint8_t(packet.param2),
packet.param3,
packet.param4);
if (!compass.mag_cal_fixed_yaw(packet.param1,
uint8_t(packet.param2),
packet.param3,
packet.param4)) {
return MAV_RESULT_FAILED;
}
return MAV_RESULT_ACCEPTED;
}
#endif // AP_COMPASS_CALIBRATION_FIXED_YAW_ENABLED
#if COMPASS_CAL_ENABLED
MAV_RESULT GCS_MAVLINK::handle_command_mag_cal(const mavlink_command_int_t &packet)
{
return AP::compass().handle_mag_cal_command(packet);
@ -5226,9 +5231,11 @@ MAV_RESULT GCS_MAVLINK::handle_command_int_packet(const mavlink_command_int_t &p
case MAV_CMD_COMPONENT_ARM_DISARM:
return handle_command_component_arm_disarm(packet);
#if COMPASS_CAL_ENABLED
#if AP_COMPASS_CALIBRATION_FIXED_YAW_ENABLED
case MAV_CMD_FIXED_MAG_CAL_YAW:
return handle_command_fixed_mag_cal_yaw(packet);
#endif
#if COMPASS_CAL_ENABLED
case MAV_CMD_DO_START_MAG_CAL:
case MAV_CMD_DO_ACCEPT_MAG_CAL:
case MAV_CMD_DO_CANCEL_MAG_CAL: