Skip to content

Commit

Permalink
AP_Mount: initialize backends after all mounts were added
Browse files Browse the repository at this point in the history
  • Loading branch information
olliw42 authored and tridge committed Sep 1, 2021
1 parent 88f2f7c commit af634f0
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion libraries/AP_Mount/AP_Mount.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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; instance<AP_MOUNT_MAX_INSTANCES; instance++) {
if (_backends[instance] != nullptr) {
_backends[instance]->init();
}
}
}

// update - give mount opportunity to update servos. should be called at 10hz or higher
Expand Down

0 comments on commit af634f0

Please sign in to comment.