Optionally set led strip color order at runtime. (#2582)

This commit is contained in:
SpeakingOfBrad 2022-03-15 18:17:49 -05:00 committed by GitHub
parent 40dbfbe092
commit 4642205768
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 3 deletions

View File

@ -60,4 +60,7 @@ build_flags = ${common.build_flags_esp8266}
; -D ABL_MILLIAMPS_DEFAULT =850 ; -D ABL_MILLIAMPS_DEFAULT =850
; ;
; enable IR by setting remote type ; 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

View File

@ -60,6 +60,11 @@
#define DEFAULT_LED_TYPE TYPE_WS2812_RGB #define DEFAULT_LED_TYPE TYPE_WS2812_RGB
#endif #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 #if MAX_NUM_SEGMENTS < WLED_MAX_BUSSES
#error "Max segments must be at least max number of busses!" #error "Max segments must be at least max number of busses!"
#endif #endif
@ -87,7 +92,7 @@ void WS2812FX::finalizeInit(void)
uint16_t start = prevLen; uint16_t start = prevLen;
uint16_t count = defCounts[(i < defNumCounts) ? i : defNumCounts -1]; uint16_t count = defCounts[(i < defNumCounts) ? i : defNumCounts -1];
prevLen += count; 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); busses.add(defCfg);
} }
} }