Browse Source

AP_Notify: make LED_NTF_LEN changes require a reboot

don't dynamically update LED length
c415-sdk
Andy Piper 4 years ago committed by Andrew Tridgell
parent
commit
3371c272fb
  1. 1
      libraries/AP_Notify/AP_Notify.cpp
  2. 14
      libraries/AP_Notify/SerialLED.cpp
  3. 6
      libraries/AP_Notify/SerialLED.h

1
libraries/AP_Notify/AP_Notify.cpp

@ -188,6 +188,7 @@ const AP_Param::GroupInfo AP_Notify::var_info[] = { @@ -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

14
libraries/AP_Notify/SerialLED.cpp

@ -25,22 +25,10 @@ SerialLED::SerialLED(uint8_t led_off, uint8_t led_bright, uint8_t led_medium, ui @@ -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) {

6
libraries/AP_Notify/SerialLED.h

@ -39,11 +39,5 @@ protected: @@ -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;
};

Loading…
Cancel
Save