From af634f0421be89d2a1a65e62ae807f8c29c3b9a2 Mon Sep 17 00:00:00 2001 From: olliw42 Date: Tue, 24 Aug 2021 17:05:18 +0200 Subject: [PATCH] AP_Mount: initialize backends after all mounts were added --- libraries/AP_Mount/AP_Mount.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/libraries/AP_Mount/AP_Mount.cpp b/libraries/AP_Mount/AP_Mount.cpp index 206130ef5d84a..03caeeb29f74b 100644 --- a/libraries/AP_Mount/AP_Mount.cpp +++ b/libraries/AP_Mount/AP_Mount.cpp @@ -470,13 +470,19 @@ void AP_Mount::init() // init new instance if (_backends[instance] != nullptr) { - _backends[instance]->init(); if (!primary_set) { _primary = instance; primary_set = true; } } } + + // init each instance, do it after all instances were created, so that they all know things + for (uint8_t instance=0; instanceinit(); + } + } } // update - give mount opportunity to update servos. should be called at 10hz or higher