From 2bcdcb459b22ce4195783629d631f569d848d0d7 Mon Sep 17 00:00:00 2001 From: olliw42 Date: Wed, 30 Oct 2019 17:14:10 +0100 Subject: [PATCH 1/2] CameraManager: identify camera component by MAV_TYPE, not compID --- src/Camera/QGCCameraManager.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Camera/QGCCameraManager.cc b/src/Camera/QGCCameraManager.cc index e85a455..6f45a44 100644 --- a/src/Camera/QGCCameraManager.cc +++ b/src/Camera/QGCCameraManager.cc @@ -107,8 +107,8 @@ QGCCameraManager::_handleHeartbeat(const mavlink_message_t &message) { mavlink_heartbeat_t heartbeat; mavlink_msg_heartbeat_decode(&message, &heartbeat); - //-- Only pay attention to "camera" component IDs - if(_vehicleReadyState && _vehicle->id() == message.sysid && message.compid >= MAV_COMP_ID_CAMERA && message.compid <= MAV_COMP_ID_CAMERA6) { + //-- Only pay attention to camera components, as identified by their MAV_TYPE + if(_vehicleReadyState && _vehicle->id() == message.sysid && heartbeat.autopilot == MAV_AUTOPILOT_INVALID && heartbeat.type == MAV_TYPE_CAMERA) { //-- First time hearing from this one? QString sCompID = QString::number(message.compid); if(!_cameraInfoRequest.contains(sCompID)) { From 097ddfe775c3af01d71878bb459b1b3e83542f15 Mon Sep 17 00:00:00 2001 From: olliw42 Date: Wed, 30 Oct 2019 21:29:48 +0100 Subject: [PATCH 2/2] accomodate suggestion by dogmaphobixc and keep compId check as fallback --- src/Camera/QGCCameraManager.cc | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/Camera/QGCCameraManager.cc b/src/Camera/QGCCameraManager.cc index 6f45a44..a09486f 100644 --- a/src/Camera/QGCCameraManager.cc +++ b/src/Camera/QGCCameraManager.cc @@ -107,8 +107,10 @@ QGCCameraManager::_handleHeartbeat(const mavlink_message_t &message) { mavlink_heartbeat_t heartbeat; mavlink_msg_heartbeat_decode(&message, &heartbeat); - //-- Only pay attention to camera components, as identified by their MAV_TYPE - if(_vehicleReadyState && _vehicle->id() == message.sysid && heartbeat.autopilot == MAV_AUTOPILOT_INVALID && heartbeat.type == MAV_TYPE_CAMERA) { + //-- Only pay attention to camera components, as identified by their MAV_TYPE, and as fallback by their compId + if(_vehicleReadyState && _vehicle->id() == message.sysid && + ((heartbeat.autopilot == MAV_AUTOPILOT_INVALID && heartbeat.type == MAV_TYPE_CAMERA) || + (message.compid >= MAV_COMP_ID_CAMERA && message.compid <= MAV_COMP_ID_CAMERA6))) { //-- First time hearing from this one? QString sCompID = QString::number(message.compid); if(!_cameraInfoRequest.contains(sCompID)) {