From 99fe905039a3f191ddb8072fee8094b05dbe7d51 Mon Sep 17 00:00:00 2001 From: Dan Halbert Date: Fri, 1 Nov 2019 13:37:36 -0400 Subject: [PATCH] Reduce DotStar status brightness; macros for status colors --- supervisor/shared/rgb_led_colors.h | 24 +++++++++++++++--------- supervisor/shared/rgb_led_status.c | 2 +- 2 files changed, 16 insertions(+), 10 deletions(-) diff --git a/supervisor/shared/rgb_led_colors.h b/supervisor/shared/rgb_led_colors.h index 48994ad62c..c723fbab36 100644 --- a/supervisor/shared/rgb_led_colors.h +++ b/supervisor/shared/rgb_led_colors.h @@ -1,12 +1,18 @@ -#define BLACK 0x000000 -#define GREEN 0x003000 -#define BLUE 0x000030 -#define CYAN 0x003030 -#define RED 0x300000 -#define ORANGE 0x302000 -#define YELLOW 0x303000 -#define PURPLE 0x300030 -#define WHITE 0x303030 + +#define COLOR(r, g, b) (((r) << 16) | ((g) << 8) | (b)) +// For brightness == 255 (full). This will be adjusted downward for various different RGB indicators, +// which vary in brightness. +#define INTENSITY (0x30) + +#define BLACK COLOR(0, 0, 0) +#define GREEN COLOR(0, INTENSITY, 0) +#define BLUE COLOR(0, 0, INTENSITY) +#define CYAN COLOR(0, INTENSITY, INTENSITY) +#define RED COLOR(INTENSITY, 0, 0) +#define ORANGE COLOR(INTENSITY, INTENSITY*2/3, 0) +#define YELLOW COLOR(INTENSITY, INTENSITY, 0) +#define PURPLE COLOR(INTENSITY, 0, INTENSITY) +#define WHITE COLOR(INTENSITY, INTENSITY, INTENSITY) #define BOOT_RUNNING BLUE #define MAIN_RUNNING GREEN diff --git a/supervisor/shared/rgb_led_status.c b/supervisor/shared/rgb_led_status.c index ebb20b4cc1..05df4c628a 100644 --- a/supervisor/shared/rgb_led_status.c +++ b/supervisor/shared/rgb_led_status.c @@ -38,7 +38,7 @@ static digitalio_digitalinout_obj_t status_neopixel; #if defined(MICROPY_HW_APA102_MOSI) && defined(MICROPY_HW_APA102_SCK) -uint8_t rgb_status_brightness = 255; +uint8_t rgb_status_brightness = 50; #define APA102_BUFFER_LENGTH 12 static uint8_t status_apa102_color[APA102_BUFFER_LENGTH] = {0, 0, 0, 0, 0xff, 0, 0, 0, 0xff, 0xff, 0xff, 0xff};