From 64b1277a66e3c6541e7125a7a96ca687073ecd16 Mon Sep 17 00:00:00 2001 From: olliw42 Date: Wed, 7 Sep 2022 17:37:56 +0900 Subject: [PATCH] AP_Mount: storm integrates find_by_mavtype_and_compid Note that this forces users to set their gimbal's component id while before any component id was acceptable --- libraries/AP_Mount/AP_Mount_SToRM32.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/libraries/AP_Mount/AP_Mount_SToRM32.cpp b/libraries/AP_Mount/AP_Mount_SToRM32.cpp index 0733c0f1b8..03775f9cdc 100644 --- a/libraries/AP_Mount/AP_Mount_SToRM32.cpp +++ b/libraries/AP_Mount/AP_Mount_SToRM32.cpp @@ -136,7 +136,10 @@ void AP_Mount_SToRM32::find_gimbal() return; } - if (GCS_MAVLINK::find_by_mavtype(MAV_TYPE_GIMBAL, _sysid, _compid, _chan)) { + // we expect that instance 0 has compid = MAV_COMP_ID_GIMBAL, instance 1 has compid = MAV_COMP_ID_GIMBAL2, etc + uint8_t compid = (_instance == 0) ? MAV_COMP_ID_GIMBAL : MAV_COMP_ID_GIMBAL2 + (_instance - 1); + if (GCS_MAVLINK::find_by_mavtype_and_compid(MAV_TYPE_GIMBAL, compid, _sysid, _chan)) { + _compid = compid; _initialised = true; } }