Repository navigation
CCT (color white balance support) - #2285
Conversation
Other minor fixes.
Introduced color mangling macros. Minor optimizations/fixes.
|
Any progress on this @Aircoookie ? |
|
Not yet 😅 |
|
|
||
| usermods.readFromJsonState(root); | ||
|
|
||
| int8_t ledmap = root[F("ledmap")] | -1; |
There was a problem hiding this comment.
Nice to have. But it would be better to store the ledmap number in a var and load the map after the JSON request. Otherwise it will create a second JSON buffer, which will in the best case not work and in the worst case crash on ESP8266. As an alternative, the JSON buffer could be reused by giving deserializeMap a pointer to the doc.
There was a problem hiding this comment.
It does if you click in UI rapidly (or have multiple clients) but loads nice from playlist or preset.
But then...
... there is a single JSON buffer PR. 😁 Which now works flawlessly on my installs.
There was a problem hiding this comment.
Won't work in single buffer since the doc will be locked, so it has to be re-used. Might as well implement that immediately :)
There was a problem hiding this comment.
Indeed that part I missed when moving code into single JSON branch from my fork.
It has been fixed now.
There was a problem hiding this comment.
It can be removed here since correct implementation is in single JSON buffer.
| #define WLED_ENABLE_MQTT // saves 12kb | ||
| #endif | ||
| #define WLED_ENABLE_ADALIGHT // saves 500b only | ||
| //#define WLED_ENABLE_ADALIGHT // saves 500b only (uses GPIO3 (RX) for serial) |
There was a problem hiding this comment.
Don't sneak this in 😉 Serial is important and must be enabled by default.
There was a problem hiding this comment.
if (pinManager.isPinAllocated(3)) return; in wled_serial.cpp already 100% takes care of it. Should also perhaps rename it to WLED_ENABLE_SERIAL later since it now handles not only Adalight, but also Serial JSON, tpm2.net, and most importantly now Improv.
There was a problem hiding this comment.
Sorry. This was not intentional.
|
Found some old notes of mine, thought I'd share. Seems like your implementation aligns pretty well with approach 1! CCT Notes / WLED white management: Case 1: Only RGB busses Case 2: At least one bus with white channel Case 3: Only White / CCT busses: Case 4: At least one RGB bus and at least one CCT bus (or RGBCCT bus) -> Approach 2: *just one color temp slider could be used, which would affect the RGB color for RGB(W) setups and CCT for RGBCCT setups |
|
Performance results Average FPS: Auto WB performance (allowCCT) is abysmal as expected. I love the feature though and would like to keep it. Luckily I can think the code can be optimized so that the expensive |
|
Yeah... Approach 2 IMO isn't good since CCT may vary according to pixel color which is not what should be expected. Th disadvantage of two temp. sliders for Approach 1 don't seem to make sense to me. Why would you want 2 sliders? |
|
Approach 2 would in fact be the only thing that makes sense if 5 channel addressable is ever available - please chip makers - make that a thing! You are correct, 2 sliders would only make sense if you want to set the RGB color to a Kelvin value and independently control channel 4 & 5 CCT. For RGB and RGBW busses, I think a single slider that sets the color temperature directly is more intuitive than having to set the RGB color to On that note, managed to improve WB performance to 31 fps avg! Tradeoff is 6 extra bytes of memory. |
| d.getElementById('picker').style.display = ccfg.picker ? "block":"none"; | ||
| d.getElementById('vwrap').style.display = ccfg.picker ? "block":"none"; | ||
| d.getElementById('kwrap').style.display = ccfg.picker ? "block":"none"; | ||
| d.getElementById('vwrap').style.display = ccfg.picker ? "block":"none"; |
There was a problem hiding this comment.
Thanks!
These indentations were indeed horrible if you use a tab size >2. I prefer tab size 2 for my editor, since it makes indentations more compact. Github uses a default of 8 (!), so my code rendered fine in my VS Code, but horribly in the web view and (I assume) VS Code with tab size 4.
I had the option enabled though in VS Code which inserted 2 spaces instead of a tab, which is bad, since it essentially forces tab size 2 upon everyone, but only for the lines I edited recently. Turned that off now, we should replace all indentations with spaces with tab indentations. That way indentations should render correctly no matter what tab size you prefer.
There was a problem hiding this comment.
https://softwareengineering.stackexchange.com/questions/57/tabs-versus-spaces-what-is-the-proper-indentation-character-for-everything-in-e 😅
No "100% correct" way as it seems.
Let's go with the style proposed by Peter Boughton:
Use tabs to indent the start of the line, one tab per indent level, and let everyone pick how wide they want that to be.
Use spaces if you're lining up characters within a line, so they always line up regardless of tab size.
Revert auto white to global setting Rounded /settings buttons by blazoncek Removed obsolete script from /settings
(to be implemented in #2336 )
|
Codacy is a bit buggy, it doesn't let me disable the PR check at all... perhaps I need to remove it from the repo entirely, though it is useful on occasion. Ready to merge IMO 🎉 |
|
|
||
| WS2812FX* WS2812FX::instance = nullptr; | ||
| int16_t Bus::_cct = -1; No newline at end of file | ||
| int16_t Bus::_cct = -1; |
There was a problem hiding this comment.
I do not like this at this place.
Perhaps moving it to util.cpp at the beginning or converting bus_manager.h into .cpp & .h combo.
There was a problem hiding this comment.
Agreed, me neither. Should really make a bus_manager.cpp, though I dislike it for two reasons. a) Too many files and b) always have to change/add functions in two places.
| } | ||
| } | ||
|
|
||
| void setSegmentCCT(int16_t cct, bool allowWBCorrection = false) { |
There was a problem hiding this comment.
You are hijacking bus manager?
There was a problem hiding this comment.
Would not call it hijacking :) more setting a value that applies globally for all busses. Essentially it is a BusManager::setPixelColor(), just separately for just CCT. The alternatives would be 1) passing it as part of setPixelColor() like you implemented initially, which I liked, but increased complexity (two setPixelColor() methods) and 2) having it as a global var that can be modified from all parts of WLED, running the risk to unintentionally setting an invalid value since all the checks run by setSegmentCCT would need to be implemented in strip.service() which is less clean imo.
There was a problem hiding this comment.
Ah! Ok, I thought it was linked to segment as seen in strip.
|
You are making my life hard with all those changes in UI. |
|
Sorry about that. I will definitely go over index.js when I have time and add comments for a lot of things. The current "already minified" code style is still from the time where we didn't have cdata.js and it needs to go. UI Changes in this PR are:
Makes slider updates easier overall since everything (but white channel) is managed by the picker color. |
|
While you're at it, add void setStatusPixel(uint32_t c) {
if (_skip && canShow()) {
for (uint8_t i=0; i<_skip; i--) PolyBus::setPixelColor(_busPtr, _iType, i, c, _colorOrder);
PolyBus::show(_busPtr, _iType);
}
}just in front of BusDigital::setPixelColor() and void setStatusPixel(uint32_t c) {
for (uint8_t i = 0; i < numBusses; i++) busses[i]->setStatusPixel(c);
}just in front of BusManager::setPixelColor(). Then we can use sacrificial pixel in handleStatusLed(). 😉 |
|
BTW, I don't like color picker sliders except for V. 😁 |
|
Status pixel is a good idea, will add that. Don't have a use for RGB sliders personally either, some people like them though. Kelvin is great though for non-CCT strips, trying to dial in a non-greenish and non-pinkish RGB "white" of your desired temperature using the picker wheel alone is an absolute pain (of course WB correction can fix that too - but it does not allow e.g. separate BG colors) |
CCT (color white balance support)
#978