From 854ed8cfa9a7d5040af1a7efa47d449fffa25671 Mon Sep 17 00:00:00 2001 From: SpeakingOfBrad Date: Tue, 15 Mar 2022 18:35:49 -0500 Subject: [PATCH] ABL milliamps no longer hardcoded to 850 at runtime (#2581) --- platformio_override.ini.sample | 2 +- wled00/FX.h | 2 +- wled00/const.h | 8 +++++++- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/platformio_override.ini.sample b/platformio_override.ini.sample index 08cd6075..cd81c517 100644 --- a/platformio_override.ini.sample +++ b/platformio_override.ini.sample @@ -57,7 +57,7 @@ build_flags = ${common.build_flags_esp8266} ; -D DEFAULT_LED_COUNT=30 ; ; set milliampere limit when using ESP pin to power leds -; -D ABL_MILLIAMPS_DEFAULT =850 +; -D ABL_MILLIAMPS_DEFAULT=850 ; ; enable IR by setting remote type ; -D IRTYPE=0 ;0 Remote disabled | 1 24-key RGB | 2 24-key with CT | 3 40-key blue | 4 40-key RGB | 5 21-key RGB | 6 6-key black | 7 9-key red | 8 JSON remote diff --git a/wled00/FX.h b/wled00/FX.h index d3a7ab59..bb53726c 100644 --- a/wled00/FX.h +++ b/wled00/FX.h @@ -609,7 +609,7 @@ class WS2812FX { _brightness = DEFAULT_BRIGHTNESS; currentPalette = CRGBPalette16(CRGB::Black); targetPalette = CloudColors_p; - ablMilliampsMax = 850; + ablMilliampsMax = ABL_MILLIAMPS_DEFAULT; currentMilliamps = 0; timebase = 0; resetSegments(); diff --git a/wled00/const.h b/wled00/const.h index d961452f..bb55065a 100644 --- a/wled00/const.h +++ b/wled00/const.h @@ -292,7 +292,13 @@ #endif #endif -#define ABL_MILLIAMPS_DEFAULT 850 // auto lower brightness to stay close to milliampere limit +#ifndef ABL_MILLIAMPS_DEFAULT + #define ABL_MILLIAMPS_DEFAULT 850 // auto lower brightness to stay close to milliampere limit +#else + #if ABL_MILLIAMPS_DEFAULT < 250 // make sure value is at least 250 + #define ABL_MILLIAMPS_DEFAULT 250 + #endif +#endif // PWM settings #ifndef WLED_PWM_FREQ