From 3f99204de298c14827a98d866774f1f232565cd0 Mon Sep 17 00:00:00 2001
From: DanielePettenuzzo <daniele@px4.io>
Date: Sat, 25 Aug 2018 14:46:36 +0200
Subject: [PATCH] camera_trigger.msg: add feedback field to understand if
 message camera from trigger or capture driver

---
 msg/camera_trigger.msg                        | 1 +
 src/drivers/camera_capture/camera_capture.cpp | 1 +
 src/drivers/camera_trigger/camera_trigger.cpp | 1 +
 3 files changed, 3 insertions(+)

diff --git a/msg/camera_trigger.msg b/msg/camera_trigger.msg
index 5f937a7e5e..6c3ffdeb94 100644
--- a/msg/camera_trigger.msg
+++ b/msg/camera_trigger.msg
@@ -2,3 +2,4 @@ uint64 timestamp	# time since system start (microseconds)
 uint64 timestamp_utc # UTC timestamp
 
 uint32 seq		# Image sequence number
+bool feedback	# Trigger feedback from camera
diff --git a/src/drivers/camera_capture/camera_capture.cpp b/src/drivers/camera_capture/camera_capture.cpp
index baf329f653..bf2f575659 100644
--- a/src/drivers/camera_capture/camera_capture.cpp
+++ b/src/drivers/camera_capture/camera_capture.cpp
@@ -104,6 +104,7 @@ CameraCapture::capture_callback(uint32_t chan_index,
 		}
 
 		trigger.seq = _capture_seq++;
+		trigger.feedback = true;
 
 		if (_camera_capture_feedback) {
 			orb_publish(ORB_ID(camera_trigger), _trigger_pub, &trigger);
diff --git a/src/drivers/camera_trigger/camera_trigger.cpp b/src/drivers/camera_trigger/camera_trigger.cpp
index 3762300dbb..a5db64b3ef 100644
--- a/src/drivers/camera_trigger/camera_trigger.cpp
+++ b/src/drivers/camera_trigger/camera_trigger.cpp
@@ -768,6 +768,7 @@ CameraTrigger::engage(void *arg)
 	trigger.timestamp_utc = (uint64_t) tv.tv_sec * 1000000 + tv.tv_nsec / 1000;
 
 	trigger.seq = trig->_trigger_seq;
+	trigger.feedback = false;
 
 	orb_publish(ORB_ID(camera_trigger), trig->_trigger_pub, &trigger);
 
-- 
GitLab