diff --git a/lib/hardware/GwHardware.h b/lib/hardware/GwHardware.h index ddf5f95..d14376b 100644 --- a/lib/hardware/GwHardware.h +++ b/lib/hardware/GwHardware.h @@ -19,6 +19,7 @@ #define GWSERIAL_TYPE_TX 4 #include #include +#include "GwAppInfo.h" #include "GwUserTasks.h" //general definitions for M5AtomLite @@ -230,4 +231,13 @@ #endif #endif +#ifdef GWLED_FASTLED + #define CFGMODE_ledBrightness GwConfigInterface::NORMAL + #ifdef GWLED_BRIGHTNESS + #define CFGDEFAULT_ledBrightness GWSTRINGIFY(GWLED_BRIGHTNESS) + #endif +#else + #define CFGMODE_ledBrightness GwConfigInterface::HIDDEN +#endif + #endif diff --git a/lib/led/GwLeds.cpp b/lib/led/GwLeds.cpp index 3c16d4c..36de526 100644 --- a/lib/led/GwLeds.cpp +++ b/lib/led/GwLeds.cpp @@ -38,11 +38,7 @@ void handleLeds(void *param){ #else FastLED.addLeds(leds,1); #endif - #ifdef GWLED_BRIGHTNESS - uint8_t brightness=GWLED_BRIGHTNESS; - #else - uint8_t brightness=128; //50% - #endif + uint8_t brightness=api->getConfig()->getInt(GwConfigDefinitions::ledBrightness,128); GwLedMode currentMode=mode; leds[0]=colorFromMode(currentMode); FastLED.setBrightness(brightness); diff --git a/web/config.json b/web/config.json index 78e3196..126819f 100644 --- a/web/config.json +++ b/web/config.json @@ -156,6 +156,16 @@ "description": "log level at the USB port", "category":"system" }, + { + "name":"ledBrightness", + "label":"led brightness", + "type":"number", + "default":64, + "min":0, + "max":255, + "description":"the brightness of the led (0..255)", + "category":"system" + }, { "name": "minXdrInterval", "label":"min XDR interval",