From 3371c272fb309b4e19162fe71d17d5e90c55183a Mon Sep 17 00:00:00 2001 From: Andy Piper Date: Tue, 16 Feb 2021 16:58:56 +0000 Subject: [PATCH] AP_Notify: make LED_NTF_LEN changes require a reboot don't dynamically update LED length --- libraries/AP_Notify/AP_Notify.cpp | 1 + libraries/AP_Notify/SerialLED.cpp | 14 +------------- libraries/AP_Notify/SerialLED.h | 6 ------ 3 files changed, 2 insertions(+), 19 deletions(-) diff --git a/libraries/AP_Notify/AP_Notify.cpp b/libraries/AP_Notify/AP_Notify.cpp index 92f2c45167..b270f5f6c2 100644 --- a/libraries/AP_Notify/AP_Notify.cpp +++ b/libraries/AP_Notify/AP_Notify.cpp @@ -188,6 +188,7 @@ const AP_Param::GroupInfo AP_Notify::var_info[] = { // @Description: The number of Serial LED's to use for notifications (NeoPixel's and ProfiLED) // @Range: 1 32 // @User: Advanced + // @RebootRequired: True AP_GROUPINFO("LED_LEN", 9, AP_Notify, _led_len, NOTIFY_LED_LEN_DEFAULT), AP_GROUPEND diff --git a/libraries/AP_Notify/SerialLED.cpp b/libraries/AP_Notify/SerialLED.cpp index 7459e80108..c378410af3 100644 --- a/libraries/AP_Notify/SerialLED.cpp +++ b/libraries/AP_Notify/SerialLED.cpp @@ -25,22 +25,10 @@ SerialLED::SerialLED(uint8_t led_off, uint8_t led_bright, uint8_t led_medium, ui bool SerialLED::hw_init() { - init_ports(); - hal.scheduler->register_io_process(FUNCTOR_BIND_MEMBER(&SerialLED::timer, void)); + enable_mask = init_ports(); return true; } -void SerialLED::timer() -{ - WITH_SEMAPHORE(_sem); - - const uint32_t now_ms = AP_HAL::millis(); - if (now_ms - _last_init_ms >= 1000) { - _last_init_ms = now_ms; - enable_mask = init_ports(); - } -} - bool SerialLED::hw_set_rgb(uint8_t red, uint8_t green, uint8_t blue) { if (enable_mask == 0) { diff --git a/libraries/AP_Notify/SerialLED.h b/libraries/AP_Notify/SerialLED.h index 43fbd5bdfa..e1e5e88f8a 100644 --- a/libraries/AP_Notify/SerialLED.h +++ b/libraries/AP_Notify/SerialLED.h @@ -39,11 +39,5 @@ protected: private: uint16_t enable_mask; - // perdiodic tick to re-init - uint32_t _last_init_ms; - - // periodic callback - void timer(); - HAL_Semaphore _sem; };