GCS_MAVLink: fix airspeed cal / format commands via non-USB telemetry

This commit is contained in:
Peter Barker 2023-08-12 11:14:23 +10:00 committed by Randy Mackay
parent 9fc8078df4
commit 049a3f187b
2 changed files with 5 additions and 4 deletions

View File

@ -169,7 +169,7 @@ public:
Type task;
MAV_CMD mav_cmd;
static class GCS_MAVLINK_InProgress *get_task(MAV_CMD cmd, Type t, uint8_t sysid, uint8_t compid);
static class GCS_MAVLINK_InProgress *get_task(MAV_CMD cmd, Type t, uint8_t sysid, uint8_t compid, mavlink_channel_t chan);
static void check_tasks();

View File

@ -1251,7 +1251,7 @@ bool GCS_MAVLINK_InProgress::conclude(MAV_RESULT result)
return true;
}
GCS_MAVLINK_InProgress *GCS_MAVLINK_InProgress::get_task(MAV_CMD mav_cmd, GCS_MAVLINK_InProgress::Type t, uint8_t sysid, uint8_t compid)
GCS_MAVLINK_InProgress *GCS_MAVLINK_InProgress::get_task(MAV_CMD mav_cmd, GCS_MAVLINK_InProgress::Type t, uint8_t sysid, uint8_t compid, mavlink_channel_t chan)
{
// we can't have two outstanding tasks for the same command from
// the same mavlink node or the result is ambiguous:
@ -1270,6 +1270,7 @@ GCS_MAVLINK_InProgress *GCS_MAVLINK_InProgress::get_task(MAV_CMD mav_cmd, GCS_MA
if (_task.task != Type::NONE) {
continue;
}
_task.chan = chan;
_task.task = t;
_task.mav_cmd = mav_cmd;
_task.requesting_sysid = sysid;
@ -4227,7 +4228,7 @@ MAV_RESULT GCS_MAVLINK::_handle_command_preflight_calibration_baro(const mavlink
AP_Airspeed *airspeed = AP_Airspeed::get_singleton();
if (airspeed != nullptr) {
GCS_MAVLINK_InProgress *task = GCS_MAVLINK_InProgress::get_task(MAV_CMD_PREFLIGHT_CALIBRATION, GCS_MAVLINK_InProgress::Type::AIRSPEED_CAL, msg.sysid, msg.compid);
GCS_MAVLINK_InProgress *task = GCS_MAVLINK_InProgress::get_task(MAV_CMD_PREFLIGHT_CALIBRATION, GCS_MAVLINK_InProgress::Type::AIRSPEED_CAL, msg.sysid, msg.compid, chan);
if (task == nullptr) {
return MAV_RESULT_TEMPORARILY_REJECTED;
}
@ -5097,7 +5098,7 @@ MAV_RESULT GCS_MAVLINK::handle_command_storage_format(const mavlink_command_int_
!is_equal(packet.param2, 1.0f)) {
return MAV_RESULT_UNSUPPORTED;
}
GCS_MAVLINK_InProgress *task = GCS_MAVLINK_InProgress::get_task(MAV_CMD_STORAGE_FORMAT, GCS_MAVLINK_InProgress::Type::SD_FORMAT, msg.sysid, msg.compid);
GCS_MAVLINK_InProgress *task = GCS_MAVLINK_InProgress::get_task(MAV_CMD_STORAGE_FORMAT, GCS_MAVLINK_InProgress::Type::SD_FORMAT, msg.sysid, msg.compid, chan);
if (task == nullptr) {
return MAV_RESULT_TEMPORARILY_REJECTED;
}