Browse Source

Mount: set primary to first instance

mission-4.1.18
Randy Mackay 10 years ago committed by Andrew Tridgell
parent
commit
b5127b680f
  1. 7
      libraries/AP_Mount/AP_Mount.cpp

7
libraries/AP_Mount/AP_Mount.cpp

@ -408,6 +408,9 @@ void AP_Mount::init()
return; return;
} }
// primary is reset to the first instantiated mount
bool primary_set = false;
// create each instance // create each instance
for (uint8_t instance=0; instance<AP_MOUNT_MAX_INSTANCES; instance++) { for (uint8_t instance=0; instance<AP_MOUNT_MAX_INSTANCES; instance++) {
MountType mount_type = get_mount_type(instance); MountType mount_type = get_mount_type(instance);
@ -431,6 +434,10 @@ void AP_Mount::init()
// init new instance // init new instance
if (_backends[instance] != NULL) { if (_backends[instance] != NULL) {
_backends[instance]->init(); _backends[instance]->init();
if (!primary_set) {
_primary = instance;
primary_set = true;
}
} }
} }
} }

Loading…
Cancel
Save