From ca980b0c9f03350e7cab6ec9cdd00a3411b48896 Mon Sep 17 00:00:00 2001 From: Fabian Schlenz Date: Wed, 12 Jun 2019 20:48:56 +0200 Subject: [PATCH] You can now set LED_MAX_MILLIAMPS if your power supply is limited. --- include/config.sample.h | 1 + src/fastled.cpp | 3 +++ 2 files changed, 4 insertions(+) diff --git a/include/config.sample.h b/include/config.sample.h index fb53d01..3417a69 100644 --- a/include/config.sample.h +++ b/include/config.sample.h @@ -18,6 +18,7 @@ #define COLOR_ORDER GRB // Order of the colors of the LEDs. If you get unexpected colors, you should change this. #define BRIGHTNESS 20 // Default brightness of the LEDs. 1 (lowest)-255 (brightest) #define TEMPORAL_DITHERING 0 // Use temporal dithering. Can lead to flickering. +#define LED_MAX_MILLIAMPS 0 // If your power supply is too small, you can set this to a maximum mA value. FastLED should then honor this. Setting it to 0 disables this limit. #define NTP_SERVER "pool.ntp.org" // NTP server to use to fetch the current time #define NTP_INTERVAL 300000 // Interval in ms to update the time from the NTP server. 300000 ms = 5 minutes diff --git a/src/fastled.cpp b/src/fastled.cpp index 0e72c7e..5f5bff3 100644 --- a/src/fastled.cpp +++ b/src/fastled.cpp @@ -6,4 +6,7 @@ void fastled_setup() { FastLED.addLeds(leds, LED_COUNT).setCorrection(TypicalLEDStrip); FastLED.setBrightness(BRIGHTNESS); FastLED.setDither(TEMPORAL_DITHERING); + if (LED_MAX_MILLIAMPS > 0) { + FastLED.setMaxPowerInVoltsAndMilliamps(5, LED_MAX_MILLIAMPS); + } };