From b5127b680fa39e1e56baefed9c545b3d5bfe0293 Mon Sep 17 00:00:00 2001 From: Randy Mackay Date: Mon, 19 Jan 2015 10:21:47 +0900 Subject: [PATCH] Mount: set primary to first instance --- libraries/AP_Mount/AP_Mount.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/libraries/AP_Mount/AP_Mount.cpp b/libraries/AP_Mount/AP_Mount.cpp index 46f0677666..be5d3a87e0 100644 --- a/libraries/AP_Mount/AP_Mount.cpp +++ b/libraries/AP_Mount/AP_Mount.cpp @@ -408,6 +408,9 @@ void AP_Mount::init() return; } + // primary is reset to the first instantiated mount + bool primary_set = false; + // create each instance for (uint8_t instance=0; instanceinit(); + if (!primary_set) { + _primary = instance; + primary_set = true; + } } } }