From 464220576821e89f90c831e0c363065e2e6d0ac7 Mon Sep 17 00:00:00 2001 From: SpeakingOfBrad Date: Tue, 15 Mar 2022 18:17:49 -0500 Subject: [PATCH] Optionally set led strip color order at runtime. (#2582) --- platformio_override.ini.sample | 5 ++++- wled00/FX_fcn.cpp | 9 +++++++-- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/platformio_override.ini.sample b/platformio_override.ini.sample index 422a5f7e..08cd6075 100644 --- a/platformio_override.ini.sample +++ b/platformio_override.ini.sample @@ -60,4 +60,7 @@ build_flags = ${common.build_flags_esp8266} ; -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 +; -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 +; +; set default color order of your led strip +; -D DEFAULT_LED_COLOR_ORDER=COL_ORDER_GRB diff --git a/wled00/FX_fcn.cpp b/wled00/FX_fcn.cpp index 8bbec34a..35b6c07d 100644 --- a/wled00/FX_fcn.cpp +++ b/wled00/FX_fcn.cpp @@ -60,6 +60,11 @@ #define DEFAULT_LED_TYPE TYPE_WS2812_RGB #endif +#ifndef DEFAULT_LED_COLOR_ORDER + #define DEFAULT_LED_COLOR_ORDER COL_ORDER_GRB //default to GRB +#endif + + #if MAX_NUM_SEGMENTS < WLED_MAX_BUSSES #error "Max segments must be at least max number of busses!" #endif @@ -87,7 +92,7 @@ void WS2812FX::finalizeInit(void) uint16_t start = prevLen; uint16_t count = defCounts[(i < defNumCounts) ? i : defNumCounts -1]; prevLen += count; - BusConfig defCfg = BusConfig(DEFAULT_LED_TYPE, defPin, start, count, COL_ORDER_GRB); + BusConfig defCfg = BusConfig(DEFAULT_LED_TYPE, defPin, start, count, DEFAULT_LED_COLOR_ORDER); busses.add(defCfg); } } @@ -1256,4 +1261,4 @@ WS2812FX* WS2812FX::instance = nullptr; //Bus static member definition, would belong in bus_manager.cpp int16_t Bus::_cct = -1; uint8_t Bus::_cctBlend = 0; -uint8_t Bus::_autoWhiteMode = RGBW_MODE_DUAL; \ No newline at end of file +uint8_t Bus::_autoWhiteMode = RGBW_MODE_DUAL;