diff --git a/libraries/AP_Notify/AP_Notify.cpp b/libraries/AP_Notify/AP_Notify.cpp index e21fa51b5b..97b5ccb029 100644 --- a/libraries/AP_Notify/AP_Notify.cpp +++ b/libraries/AP_Notify/AP_Notify.cpp @@ -26,7 +26,6 @@ #include "ToneAlarm_Linux.h" #include "ToneAlarm_ChibiOS.h" #include "ToneAlarm_PX4.h" -#include "ToshibaLED.h" #include "ToshibaLED_I2C.h" #include "VRBoard_LED.h" #include "DiscreteRGBLed.h" @@ -77,12 +76,14 @@ const AP_Param::GroupInfo AP_Notify::var_info[] = { // @User: Advanced AP_GROUPINFO("DISPLAY_TYPE", 3, AP_Notify, _display_type, 0), +#if CONFIG_HAL_BOARD == HAL_BOARD_PX4 && CONFIG_HAL_BOARD_SUBTYPE == HAL_BOARD_SUBTYPE_PX4_V3 // @Param: OREO_THEME // @DisplayName: OreoLED Theme // @Description: Enable/Disable Solo Oreo LED driver, 0 to disable, 1 for Aircraft theme, 2 for Rover theme // @Values: 0:Disabled,1:Aircraft,2:Rover // @User: Advanced AP_GROUPINFO("OREO_THEME", 4, AP_Notify, _oreo_theme, 0), +#endif // CONFIG_HAL_BOARD == HAL_BOARD_PX4 && CONFIG_HAL_BOARD_SUBTYPE == HAL_BOARD_SUBTYPE_PX4_V3 #if !defined(HAL_BUZZER_PIN) // @Param: BUZZ_PIN @@ -265,11 +266,6 @@ void AP_Notify::init(bool enable_external_leds) memset(&AP_Notify::flags, 0, sizeof(AP_Notify::flags)); memset(&AP_Notify::events, 0, sizeof(AP_Notify::events)); - // clear flight mode string and text buffer - memset(_flight_mode_str, 0, sizeof(_flight_mode_str)); - memset(_send_text, 0, sizeof(_send_text)); - _send_text_updated_millis = 0; - AP_Notify::flags.external_leds = enable_external_leds; for (uint8_t i = 0; i < _num_devices; i++) { diff --git a/libraries/AP_Notify/Buzzer.h b/libraries/AP_Notify/Buzzer.h index 5191872a5f..22eb2487cf 100644 --- a/libraries/AP_Notify/Buzzer.h +++ b/libraries/AP_Notify/Buzzer.h @@ -27,12 +27,7 @@ class Buzzer: public NotifyDevice { public: /// Constructor - Buzzer() : - _counter(0), - _pattern(NONE), - _pattern_counter(0), - _arming_buzz_start_ms(0) - {} + Buzzer() {} /// init - initialise the buzzer bool init(void); diff --git a/libraries/AP_Notify/ExternalLED.h b/libraries/AP_Notify/ExternalLED.h index e6fc7eac26..98aee27cc5 100644 --- a/libraries/AP_Notify/ExternalLED.h +++ b/libraries/AP_Notify/ExternalLED.h @@ -28,7 +28,7 @@ class ExternalLED: public NotifyDevice { public: // constructor - ExternalLED() : _counter(0), _counter2(0), _pattern(NONE), _pattern_counter(0) {} + ExternalLED() : _pattern(NONE) {} // initialise the LED driver bool init(void); diff --git a/libraries/AP_Notify/NavioLED.cpp b/libraries/AP_Notify/NavioLED.cpp deleted file mode 100644 index 8d799c829b..0000000000 --- a/libraries/AP_Notify/NavioLED.cpp +++ /dev/null @@ -1,29 +0,0 @@ -/* - NavioLED driver -*/ - -/* - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - -*/ - -#include "NavioLED.h" - -#define NAVIO_LED_BRIGHT 0x0 // full brightness -#define NAVIO_LED_MEDIUM 0x7F // medium brightness -#define NAVIO_LED_DIM 0x4F // dim brightness -#define NAVIO_LED_OFF 0xFF // off - -NavioLED::NavioLED() : - RGBLed(NAVIO_LED_OFF, NAVIO_LED_BRIGHT, NAVIO_LED_MEDIUM, NAVIO_LED_DIM) -{ - -} diff --git a/libraries/AP_Notify/NavioLED.h b/libraries/AP_Notify/NavioLED.h deleted file mode 100644 index 495a8f3bf6..0000000000 --- a/libraries/AP_Notify/NavioLED.h +++ /dev/null @@ -1,27 +0,0 @@ -/* - * AP_Notify Library. - * based upon a prototype library by David "Buzz" Bussenschutt. - */ - -/* - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . - */ -#pragma once - -#include "RGBLed.h" - -class NavioLED: public RGBLed { -public: - NavioLED(); -}; diff --git a/libraries/AP_Notify/NavioLED_I2C.cpp b/libraries/AP_Notify/NavioLED_I2C.cpp index 0c4770eae2..c124882d8f 100644 --- a/libraries/AP_Notify/NavioLED_I2C.cpp +++ b/libraries/AP_Notify/NavioLED_I2C.cpp @@ -19,11 +19,21 @@ #include +#define NAVIO_LED_BRIGHT 0x0 // full brightness +#define NAVIO_LED_MEDIUM 0x7F // medium brightness +#define NAVIO_LED_DIM 0x4F // dim brightness +#define NAVIO_LED_OFF 0xFF // off + #define PCA9685_ADDRESS 0x40 #define PCA9685_PWM 0x6 extern const AP_HAL::HAL& hal; +NavioLED_I2C::NavioLED_I2C() : + RGBLed(NAVIO_LED_OFF, NAVIO_LED_BRIGHT, NAVIO_LED_MEDIUM, NAVIO_LED_DIM) +{ +} + bool NavioLED_I2C::hw_init() { _dev = hal.i2c_mgr->get_device(1, PCA9685_ADDRESS); diff --git a/libraries/AP_Notify/NavioLED_I2C.h b/libraries/AP_Notify/NavioLED_I2C.h index be0f928e93..f5113ea35f 100644 --- a/libraries/AP_Notify/NavioLED_I2C.h +++ b/libraries/AP_Notify/NavioLED_I2C.h @@ -16,11 +16,13 @@ */ #pragma once -#include "NavioLED.h" #include +#include "RGBLed.h" -class NavioLED_I2C : public NavioLED +class NavioLED_I2C : public RGBLed { +public: + NavioLED_I2C(void); protected: bool hw_init(void) override; bool hw_set_rgb(uint8_t r, uint8_t g, uint8_t b) override; diff --git a/libraries/AP_Notify/OreoLED_PX4.cpp b/libraries/AP_Notify/OreoLED_PX4.cpp index ee8534262e..517a6c8fcc 100644 --- a/libraries/AP_Notify/OreoLED_PX4.cpp +++ b/libraries/AP_Notify/OreoLED_PX4.cpp @@ -44,11 +44,7 @@ extern const AP_HAL::HAL& hal; // constructor OreoLED_PX4::OreoLED_PX4(uint8_t theme): NotifyDevice(), - _overall_health(false), _oreoled_fd(-1), - _send_required(false), - _state_desired_semaphore(false), - _pattern_override(0), _oreo_theme(theme) { // initialise desired and sent state diff --git a/libraries/AP_Notify/RGBLed.cpp b/libraries/AP_Notify/RGBLed.cpp index ab9547d860..bce7c2ab3e 100644 --- a/libraries/AP_Notify/RGBLed.cpp +++ b/libraries/AP_Notify/RGBLed.cpp @@ -24,15 +24,6 @@ extern const AP_HAL::HAL& hal; RGBLed::RGBLed(uint8_t led_off, uint8_t led_bright, uint8_t led_medium, uint8_t led_dim): - counter(0), - step(0), - _healthy(false), - _red_des(0), - _green_des(0), - _blue_des(0), - _red_curr(0), - _green_curr(0), - _blue_curr(0), _led_off(led_off), _led_bright(led_bright), _led_medium(led_medium), diff --git a/libraries/AP_Notify/ToshibaLED.cpp b/libraries/AP_Notify/ToshibaLED.cpp deleted file mode 100644 index 265d6cb193..0000000000 --- a/libraries/AP_Notify/ToshibaLED.cpp +++ /dev/null @@ -1,31 +0,0 @@ -/* - ToshibaLED driver -*/ - -/* - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . - */ - -#include "ToshibaLED.h" - -#define TOSHIBA_LED_BRIGHT 0xFF // full brightness -#define TOSHIBA_LED_MEDIUM 0x80 // medium brightness -#define TOSHIBA_LED_DIM 0x11 // dim -#define TOSHIBA_LED_OFF 0x00 // off - -ToshibaLED::ToshibaLED(): - RGBLed(TOSHIBA_LED_OFF, TOSHIBA_LED_BRIGHT, TOSHIBA_LED_MEDIUM, TOSHIBA_LED_DIM) -{ - -} diff --git a/libraries/AP_Notify/ToshibaLED.h b/libraries/AP_Notify/ToshibaLED.h deleted file mode 100644 index 6f182dbf19..0000000000 --- a/libraries/AP_Notify/ToshibaLED.h +++ /dev/null @@ -1,27 +0,0 @@ -/* - * AP_Notify Library. - * based upon a prototype library by David "Buzz" Bussenschutt. - */ - -/* - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . - */ -#pragma once - -#include "RGBLed.h" - -class ToshibaLED: public RGBLed { -public: - ToshibaLED(); -}; diff --git a/libraries/AP_Notify/ToshibaLED_I2C.cpp b/libraries/AP_Notify/ToshibaLED_I2C.cpp index 2cd8b6d25c..34f30d74cc 100644 --- a/libraries/AP_Notify/ToshibaLED_I2C.cpp +++ b/libraries/AP_Notify/ToshibaLED_I2C.cpp @@ -26,6 +26,11 @@ extern const AP_HAL::HAL& hal; +#define TOSHIBA_LED_BRIGHT 0xFF // full brightness +#define TOSHIBA_LED_MEDIUM 0x80 // medium brightness +#define TOSHIBA_LED_DIM 0x11 // dim +#define TOSHIBA_LED_OFF 0x00 // off + #define TOSHIBA_LED_I2C_ADDR 0x55 // default I2C bus address #define TOSHIBA_LED_PWM0 0x01 // pwm0 register @@ -34,7 +39,7 @@ extern const AP_HAL::HAL& hal; #define TOSHIBA_LED_ENABLE 0x04 // enable register ToshibaLED_I2C::ToshibaLED_I2C(uint8_t bus) - : ToshibaLED() + : RGBLed(TOSHIBA_LED_OFF, TOSHIBA_LED_BRIGHT, TOSHIBA_LED_MEDIUM, TOSHIBA_LED_DIM) , _bus(bus) { } diff --git a/libraries/AP_Notify/ToshibaLED_I2C.h b/libraries/AP_Notify/ToshibaLED_I2C.h index adddaa1f79..a6a7bb2117 100644 --- a/libraries/AP_Notify/ToshibaLED_I2C.h +++ b/libraries/AP_Notify/ToshibaLED_I2C.h @@ -17,9 +17,9 @@ #pragma once #include -#include "ToshibaLED.h" +#include "RGBLed.h" -class ToshibaLED_I2C : public ToshibaLED +class ToshibaLED_I2C : public RGBLed { public: ToshibaLED_I2C(uint8_t bus);