AP_Notify: allow display and oreo leds to be disabled

This commit is contained in:
Andy Piper 2021-06-09 18:30:59 +01:00 committed by Andrew Tridgell
parent 9a2f52215e
commit 69ef1e5058
4 changed files with 15 additions and 5 deletions

View File

@ -150,14 +150,16 @@ const AP_Param::GroupInfo AP_Notify::var_info[] = {
// @User: Advanced
AP_GROUPINFO("LED_OVERRIDE", 2, AP_Notify, _rgb_led_override, NOTIFY_LED_OVERRIDE_DEFAULT),
#if HAL_DISPLAY_ENABLED
// @Param: DISPLAY_TYPE
// @DisplayName: Type of on-board I2C display
// @Description: This sets up the type of on-board I2C display. Disabled by default.
// @Values: 0:Disable,1:ssd1306,2:sh1106,10:SITL
// @User: Advanced
AP_GROUPINFO("DISPLAY_TYPE", 3, AP_Notify, _display_type, 0),
#endif
#if !HAL_MINIMIZE_FEATURES
#if HAL_OREO_LED_ENABLED
// @Param: OREO_THEME
// @DisplayName: OreoLED Theme
// @Description: Enable/Disable Solo Oreo LED driver, 0 to disable, 1 for Aircraft theme, 2 for Rover theme
@ -311,7 +313,7 @@ void AP_Notify::add_backends(void)
ADD_BACKEND(new ProfiLED());
break;
case Notify_LED_OreoLED:
#if !HAL_MINIMIZE_FEATURES
#if HAL_OREO_LED_ENABLED
if (_oreo_theme) {
ADD_BACKEND(new OreoLED_I2C(0, _oreo_theme));
}
@ -337,9 +339,10 @@ void AP_Notify::add_backends(void)
}
}
#if HAL_DISPLAY_ENABLED
// Always try and add a display backend
ADD_BACKEND(new Display());
#endif
// ChibiOS noise makers
#if CONFIG_HAL_BOARD == HAL_BOARD_CHIBIOS

View File

@ -15,6 +15,7 @@
/* Notify display driver for 128 x 64 pixel displays */
#include "Display.h"
#include "Display_SH1106_I2C.h"
#include "Display_SSD1306_I2C.h"
#include "Display_SITL.h"

View File

@ -2,6 +2,10 @@
#include "NotifyDevice.h"
#ifndef HAL_DISPLAY_ENABLED
#define HAL_DISPLAY_ENABLED !HAL_MINIMIZE_FEATURES && BOARD_FLASH_SIZE > 1024
#endif
#define ROW(Y) ((Y * 10) + 6)
#define COLUMN(X) ((X * 7) + 0)
@ -39,4 +43,3 @@ private:
// stop showing text in display after this many millis:
const uint16_t _send_text_valid_millis = 20000;
};

View File

@ -19,6 +19,10 @@
#include <AP_HAL/AP_HAL.h>
#include "NotifyDevice.h"
#ifndef HAL_OREO_LED_ENABLED
#define HAL_OREO_LED_ENABLED 0
#endif
#define OREOLED_NUM_LEDS 4 // maximum number of individual LEDs connected to the oreo led cpu
#define OREOLED_INSTANCE_ALL 0xff // instance number to indicate all LEDs (used for set_rgb and set_macro)
#define OREOLED_BRIGHT 0xff // maximum brightness when flying (disconnected from usb)
@ -196,4 +200,3 @@ private:
uint32_t _last_boot_ms;
uint32_t _last_sync_ms;
};