88#include " const.h"
99
1010// colors.cpp
11- uint32_t colorBalanceFromKelvin (uint16_t kelvin, uint32_t rgb);
1211uint16_t approximateKelvinFromRGB (uint32_t rgb);
13- void colorRGBtoRGBW (byte* rgb);
1412
1513#define GET_BIT (var,bit ) (((var)>>(bit))&0x01 )
1614#define SET_BIT (var,bit ) ((var)|=(uint16_t )(0x0001 <<(bit)))
@@ -175,6 +173,28 @@ class Bus {
175173 if (_cctBlend > WLED_MAX_CCT_BLEND) _cctBlend = WLED_MAX_CCT_BLEND;
176174 #endif
177175 }
176+ inline void setAutoWhiteMode (uint8_t m) { if (m < 5 ) _autoWhiteMode = m; }
177+ inline uint8_t getAutoWhiteMode () { return _autoWhiteMode; }
178+ inline static void setGlobalAWMode (uint8_t m) { if (m < 5 ) _gAWM = m; else _gAWM = AW_GLOBAL_DISABLED; }
179+ inline static uint8_t getGlobalAWMode () { return _gAWM; }
180+
181+ protected:
182+ uint8_t _type;
183+ uint8_t _bri;
184+ uint16_t _start;
185+ uint16_t _len;
186+ bool _reversed;
187+ bool _valid;
188+ bool _needsRefresh;
189+ uint8_t _autoWhiteMode;
190+ uint8_t *_data;
191+ static uint8_t _gAWM;
192+ static int16_t _cct;
193+ static uint8_t _cctBlend;
194+
195+ uint32_t autoWhiteCalc (uint32_t c);
196+ uint8_t *allocData (size_t size = 1 );
197+ void freeData () { if (_data != nullptr ) free (_data); _data = nullptr ; }
178198 static void calculateCCT (uint32_t c, uint8_t &ww, uint8_t &cw) {
179199 uint8_t cct = 0 ; // 0 - full warm white, 255 - full cold white
180200 uint8_t w = byte (c >> 24 );
@@ -201,28 +221,6 @@ class Bus {
201221 cw = (w * cw) / 255 ;
202222 #endif
203223 }
204- inline void setAutoWhiteMode (uint8_t m) { if (m < 5 ) _autoWhiteMode = m; }
205- inline uint8_t getAutoWhiteMode () { return _autoWhiteMode; }
206- inline static void setGlobalAWMode (uint8_t m) { if (m < 5 ) _gAWM = m; else _gAWM = AW_GLOBAL_DISABLED; }
207- inline static uint8_t getGlobalAWMode () { return _gAWM; }
208-
209- protected:
210- uint8_t _type;
211- uint8_t _bri;
212- uint16_t _start;
213- uint16_t _len;
214- bool _reversed;
215- bool _valid;
216- bool _needsRefresh;
217- uint8_t _autoWhiteMode;
218- uint8_t *_data;
219- static uint8_t _gAWM;
220- static int16_t _cct;
221- static uint8_t _cctBlend;
222-
223- uint32_t autoWhiteCalc (uint32_t c);
224- uint8_t *allocData (size_t size = 1 );
225- void freeData () { if (_data != nullptr ) free (_data); _data = nullptr ; }
226224};
227225
228226
0 commit comments