Skip to content

Commit

Permalink
AP_Notify: allow display and oreo leds to be disabled
Browse files Browse the repository at this point in the history
  • Loading branch information
andyp1per authored and peterbarker committed Jun 16, 2021
1 parent 1cafbe1 commit 144bbd6
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 5 deletions.
9 changes: 6 additions & 3 deletions libraries/AP_Notify/AP_Notify.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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));
}
Expand All @@ -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
Expand Down
1 change: 1 addition & 0 deletions libraries/AP_Notify/Display.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
5 changes: 4 additions & 1 deletion libraries/AP_Notify/Display.h
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down Expand Up @@ -39,4 +43,3 @@ class Display: public NotifyDevice {
// stop showing text in display after this many millis:
const uint16_t _send_text_valid_millis = 20000;
};

5 changes: 4 additions & 1 deletion libraries/AP_Notify/OreoLED_I2C.h
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -196,4 +200,3 @@ class OreoLED_I2C : public NotifyDevice {
uint32_t _last_boot_ms;
uint32_t _last_sync_ms;
};

0 comments on commit 144bbd6

Please sign in to comment.