2023-02-10 20:27:39 -04:00
|
|
|
#include "AP_Camera_Mount.h"
|
|
|
|
|
2023-03-06 18:15:58 -04:00
|
|
|
#if AP_CAMERA_MOUNT_ENABLED
|
2023-02-10 20:27:39 -04:00
|
|
|
#include <AP_Mount/AP_Mount.h>
|
|
|
|
|
|
|
|
extern const AP_HAL::HAL& hal;
|
|
|
|
|
|
|
|
// entry point to actually take a picture. returns true on success
|
|
|
|
bool AP_Camera_Mount::trigger_pic()
|
|
|
|
{
|
|
|
|
AP_Mount* mount = AP::mount();
|
|
|
|
if (mount != nullptr) {
|
|
|
|
mount->take_picture(0);
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
// start/stop recording video. returns true on success
|
|
|
|
// start_recording should be true to start recording, false to stop recording
|
|
|
|
bool AP_Camera_Mount::record_video(bool start_recording)
|
|
|
|
{
|
|
|
|
AP_Mount* mount = AP::mount();
|
|
|
|
if (mount != nullptr) {
|
|
|
|
return mount->record_video(0, start_recording);
|
|
|
|
}
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2023-04-06 21:49:46 -03:00
|
|
|
// set zoom specified as a rate or percentage
|
2023-04-18 22:06:16 -03:00
|
|
|
bool AP_Camera_Mount::set_zoom(ZoomType zoom_type, float zoom_value)
|
2023-02-10 20:27:39 -04:00
|
|
|
{
|
|
|
|
AP_Mount* mount = AP::mount();
|
|
|
|
if (mount != nullptr) {
|
2023-04-06 21:49:46 -03:00
|
|
|
return mount->set_zoom(0, zoom_type, zoom_value);
|
2023-02-10 20:27:39 -04:00
|
|
|
}
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2023-04-24 09:23:07 -03:00
|
|
|
// set focus specified as rate, percentage or auto
|
2023-02-10 20:27:39 -04:00
|
|
|
// focus in = -1, focus hold = 0, focus out = 1
|
2023-04-24 09:23:07 -03:00
|
|
|
bool AP_Camera_Mount::set_focus(FocusType focus_type, float focus_value)
|
2023-02-10 20:27:39 -04:00
|
|
|
{
|
|
|
|
AP_Mount* mount = AP::mount();
|
|
|
|
if (mount != nullptr) {
|
2023-04-24 09:23:07 -03:00
|
|
|
return mount->set_focus(0, focus_type, focus_value);
|
2023-02-10 20:27:39 -04:00
|
|
|
}
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2023-03-06 18:15:58 -04:00
|
|
|
#endif // AP_CAMERA_MOUNT_ENABLED
|