AP_Notify: Delete drivers that are not present

This commit is contained in:
Michael du Breuil 2018-06-26 10:47:00 -07:00 committed by Andrew Tridgell
parent d0cd37fabb
commit 8e8e9a5a58
1 changed files with 7 additions and 4 deletions

View File

@ -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;
}
}
}
}