From d9498b9b24b24c316ddf014a2f3c9f8263f1527f Mon Sep 17 00:00:00 2001 From: Julian Oes Date: Sat, 14 Dec 2024 11:30:23 +1300 Subject: [PATCH] camera: fixes to pass system tests --- src/mavsdk/plugins/camera/camera_impl.cpp | 3 --- src/mavsdk/plugins/camera_server/camera_server_impl.cpp | 6 ++++-- src/mavsdk/plugins/camera_server/camera_server_impl.h | 2 ++ 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/mavsdk/plugins/camera/camera_impl.cpp b/src/mavsdk/plugins/camera/camera_impl.cpp index 364c2c37d..d6deb34e2 100644 --- a/src/mavsdk/plugins/camera/camera_impl.cpp +++ b/src/mavsdk/plugins/camera/camera_impl.cpp @@ -1136,9 +1136,6 @@ void CameraImpl::process_camera_image_captured(const mavlink_message_t& message) capture_info.is_success = (image_captured.capture_result == 1); capture_info.index = image_captured.image_index; - _capture_info_callbacks.queue( - capture_info, [this](const auto& func) { _system_impl->call_user_callback(func); }); - camera.capture_status.photo_list.insert( std::make_pair(image_captured.image_index, capture_info)); diff --git a/src/mavsdk/plugins/camera_server/camera_server_impl.cpp b/src/mavsdk/plugins/camera_server/camera_server_impl.cpp index eaf02fb61..91fba9688 100644 --- a/src/mavsdk/plugins/camera_server/camera_server_impl.cpp +++ b/src/mavsdk/plugins/camera_server/camera_server_impl.cpp @@ -944,12 +944,14 @@ void CameraServerImpl::start_image_capture_interval(float interval_s, int32_t co // If count == 0, it means capture "forever" until a stop command is received. auto remaining = std::make_shared(count == 0 ? INT32_MAX : count); + _last_interval_index = index; + _image_capture_timer_cookie = _server_component_impl->add_call_every( - [this, remaining, index]() { + [this, remaining]() { LogDebug() << "capture image timer triggered"; if (!_take_photo_callbacks.empty()) { - _take_photo_callbacks(index); + _take_photo_callbacks(_last_interval_index++); (*remaining)--; } diff --git a/src/mavsdk/plugins/camera_server/camera_server_impl.h b/src/mavsdk/plugins/camera_server/camera_server_impl.h index a3ccdfbb6..ae8a5ac0e 100644 --- a/src/mavsdk/plugins/camera_server/camera_server_impl.h +++ b/src/mavsdk/plugins/camera_server/camera_server_impl.h @@ -264,6 +264,8 @@ class CameraServerImpl : public ServerPluginImplBase { MavlinkCommandReceiver::CommandLong _last_zoom_out_start_command; MavlinkCommandReceiver::CommandLong _last_zoom_stop_command; MavlinkCommandReceiver::CommandLong _last_zoom_range_command; + + int32_t _last_interval_index{0}; }; } // namespace mavsdk