GCS_MAVLink: move switch for sending camera messages into AP_Camera

neatens GCS_Common a bit, reduces repetitive code
This commit is contained in:
Peter Barker 2024-05-29 17:32:06 +10:00 committed by Peter Barker
parent 5538f6735f
commit 78fcf7057c
1 changed files with 2 additions and 40 deletions

View File

@ -6014,46 +6014,10 @@ bool GCS_MAVLINK::try_send_message(const enum ap_message id)
#if AP_CAMERA_ENABLED
case MSG_CAMERA_FEEDBACK:
{
AP_Camera *camera = AP::camera();
if (camera == nullptr) {
break;
}
CHECK_PAYLOAD_SIZE(CAMERA_FEEDBACK);
camera->send_feedback(chan);
}
break;
case MSG_CAMERA_INFORMATION:
{
AP_Camera *camera = AP::camera();
if (camera == nullptr) {
break;
}
CHECK_PAYLOAD_SIZE(CAMERA_INFORMATION);
camera->send_camera_information(chan);
}
break;
case MSG_CAMERA_SETTINGS:
{
AP_Camera *camera = AP::camera();
if (camera == nullptr) {
break;
}
CHECK_PAYLOAD_SIZE(CAMERA_SETTINGS);
camera->send_camera_settings(chan);
}
break;
#if AP_CAMERA_SEND_FOV_STATUS_ENABLED
case MSG_CAMERA_FOV_STATUS:
{
AP_Camera *camera = AP::camera();
if (camera == nullptr) {
break;
}
CHECK_PAYLOAD_SIZE(CAMERA_FOV_STATUS);
camera->send_camera_fov_status(chan);
}
break;
#endif
case MSG_CAMERA_CAPTURE_STATUS:
{
@ -6061,11 +6025,9 @@ bool GCS_MAVLINK::try_send_message(const enum ap_message id)
if (camera == nullptr) {
break;
}
CHECK_PAYLOAD_SIZE(CAMERA_CAPTURE_STATUS);
camera->send_camera_capture_status(chan);
return camera->send_mavlink_message(*this, id);
}
break;
#endif
#endif // AP_CAMERA_ENABLED
case MSG_SYSTEM_TIME:
CHECK_PAYLOAD_SIZE(SYSTEM_TIME);