Browse Source

AP_Notify: Delete drivers that are not present

master
Michael du Breuil 7 years ago committed by Andrew Tridgell
parent
commit
8e8e9a5a58
  1. 11
      libraries/AP_Notify/AP_Notify.cpp

11
libraries/AP_Notify/AP_Notify.cpp

@ -259,19 +259,22 @@ void AP_Notify::add_backends(void) @@ -259,19 +259,22 @@ void AP_Notify::add_backends(void)
// initialisation
void AP_Notify::init(bool enable_external_leds)
{
// add all the backends
add_backends();
// clear all flags and events
memset(&AP_Notify::flags, 0, sizeof(AP_Notify::flags));
memset(&AP_Notify::events, 0, sizeof(AP_Notify::events));
AP_Notify::flags.external_leds = enable_external_leds;
// add all the backends
add_backends();
for (uint8_t i = 0; i < _num_devices; i++) {
if (_devices[i] != nullptr) {
_devices[i]->pNotify = this;
_devices[i]->init();
if(!_devices[i]->init()) {
delete _devices[i];
_devices[i] = nullptr;
}
}
}
}

Loading…
Cancel
Save