Skip to content

Commit

Permalink
Optionally set led strip color order at runtime. (Aircoookie#2582)
Browse files Browse the repository at this point in the history
  • Loading branch information
SpeakingOfBrad authored Mar 15, 2022
1 parent 40dbfbe commit 4642205
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
5 changes: 4 additions & 1 deletion platformio_override.ini.sample
Original file line number Diff line number Diff line change
Expand Up @@ -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
9 changes: 7 additions & 2 deletions wled00/FX_fcn.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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);
}
}
Expand Down Expand Up @@ -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;
uint8_t Bus::_autoWhiteMode = RGBW_MODE_DUAL;

0 comments on commit 4642205

Please sign in to comment.