diff --git a/.github/workflows/rpi-build.yml b/.github/workflows/rpi-build.yml index 349e1cf..d6f114f 100644 --- a/.github/workflows/rpi-build.yml +++ b/.github/workflows/rpi-build.yml @@ -33,9 +33,9 @@ jobs: apt-get update apt-get install -y libgstreamer1.0-dev libgstrtspserver-1.0-dev build-essential cmake git wget rubygems gem install fpm - wget https://github.com/mavlink/MAVSDK/releases/download/v2.4.0/libmavsdk-dev_2.4.0_debian12_arm64.deb - dpkg -i libmavsdk-dev_2.4.0_debian12_arm64.deb - rm libmavsdk-dev_2.4.0_debian12_arm64.deb + wget https://github.com/mavlink/MAVSDK/releases/download/v2.6.0/libmavsdk-dev_2.6.0_debian12_arm64.deb + dpkg -i libmavsdk-dev_2.6.0_debian12_arm64.deb + rm libmavsdk-dev_2.6.0_debian12_arm64.deb git config --global --add safe.directory "$GITHUB_WORKSPACE" cmake -DCMAKE_BUILD_TYPE=RelWithDebInfo -DBUILD_SHARED_LIBS=ON -DCMAKE_INSTALL_PREFIX=install -Bbuild -S. cmake --build build -j$(nproc) --target install diff --git a/camera-manager/camera_manager.cpp b/camera-manager/camera_manager.cpp index 6bdf89d..906e8e7 100644 --- a/camera-manager/camera_manager.cpp +++ b/camera-manager/camera_manager.cpp @@ -319,6 +319,37 @@ int main(int argc, char* argv[]) storage_information); }); + camera_server.subscribe_zoom_range([&](float zoom_factor) { + if (zoom_factor < 1.f) { + std::cout << "Zoom below 1x not possible" << std::endl; + camera_server.respond_zoom_range(mavsdk::CameraServer::CameraFeedback::Failed); + return; + } + if (zoom_factor > 6.f) { + std::cout << "Zoom above 6x not possible" << std::endl; + camera_server.respond_zoom_range(mavsdk::CameraServer::CameraFeedback::Failed); + return; + } + + siyi_camera.absolute_zoom(zoom_factor); + camera_server.respond_zoom_range(mavsdk::CameraServer::CameraFeedback::Ok); + }); + + camera_server.subscribe_zoom_in_start([&](int) { + siyi_camera.zoom(siyi::Camera::Zoom::In); + camera_server.respond_zoom_in_start(mavsdk::CameraServer::CameraFeedback::Ok); + }); + + camera_server.subscribe_zoom_out_start([&](int) { + siyi_camera.zoom(siyi::Camera::Zoom::Out); + camera_server.respond_zoom_in_start(mavsdk::CameraServer::CameraFeedback::Ok); + }); + + camera_server.subscribe_zoom_stop([&](int) { + siyi_camera.zoom(siyi::Camera::Zoom::Stop); + camera_server.respond_zoom_stop(mavsdk::CameraServer::CameraFeedback::Ok); + }); + // Run as a server and never quit while (true) { std::this_thread::sleep_for(std::chrono::seconds(1)); diff --git a/camera-manager/siyi_camera.hpp b/camera-manager/siyi_camera.hpp index d69b35f..aca14c5 100644 --- a/camera-manager/siyi_camera.hpp +++ b/camera-manager/siyi_camera.hpp @@ -301,11 +301,14 @@ class Camera { switch (option) { case Zoom::In: manual_zoom.zoom = 1; + std::cerr << "Starting to zoom in" << std::endl; break; case Zoom::Out: manual_zoom.zoom = -1; + std::cerr << "Starting to zoom out" << std::endl; break; case Zoom::Stop: + std::cerr << "Stopping to zoom" << std::endl; manual_zoom.zoom = 0; break; }