Skip to content

Commit

Permalink
camera: fixes to pass system tests
Browse files Browse the repository at this point in the history
  • Loading branch information
julianoes committed Dec 13, 2024
1 parent f544e83 commit d9498b9
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
3 changes: 0 additions & 3 deletions src/mavsdk/plugins/camera/camera_impl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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));

Expand Down
6 changes: 4 additions & 2 deletions src/mavsdk/plugins/camera_server/camera_server_impl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<int32_t>(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)--;
}

Expand Down
2 changes: 2 additions & 0 deletions src/mavsdk/plugins/camera_server/camera_server_impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit d9498b9

Please sign in to comment.