Make the kitchen strip a WS2805 RGBCCT colour light #107
Loading…
Reference in a new issue
No description provided.
Delete branch "feat/kitchen-cct"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Makes the kitchen strip an RGBCCT colour light (
EP_COLOUR_LIGHT) on a 12 V WS2805 strip. Adds theCMD_COLOUR/STATE_COLOURcodecs and shared vectors, aColourEndpointthat turns each change into one target colour, and two libraries:lib/led-strips(RMT frame-buffer driver) andlib/strip-animations(uniform fade and middle-out, picked by id). Kitchen uses 26 pixels on D1 with middle-out and QuadIn easing; touch is a plain toggle. Ticket CCS-LLA-5, reworked under CCS-LLA-29.Behaviour: brightness 0-100 %, colour temperature in K (clamped to 2700-6500), hue 0-359 degrees and saturation 0-100 %. Saturation 0 is pure white at the colour temperature, 100 is the pure hue, and values between blend the two. In
CMD_COLOUR,0xFF/0xFFFFleaves a field unchanged. Out-of-range values clamp and never become a sentinel. The light takesCMD_COLOURandCMD_SWITCH;CMD_LEVELis ignored.Wire change, approved by the owner: rebased onto main after the origin and lockout removal (#116), so nothing here carries either.
EP_CCT_LIGHT,CMD_CCTandSTATE_CCTbecomeEP_COLOUR_LIGHT,CMD_COLOURandSTATE_COLOURwith the same numeric values and new 8-byte layouts; the valid-flag byte is gone. Every node needs reflashing and the Home Assistant integration needs updating together. Shared vectors are regenerated.Tested:
pio test -e native(580 cases, pass),pio runfor all five envs. Not re-tested on the bench strip since the colour rework.Findings only.
Ease::QuintInis now applied to an 8-bit output (cct_endpoint.cppapplyOutput). x^5 * 255 rounds to 0 below roughly 26% brightness, then steps 0, 1, 1, 2. The bottom quarter of the slider is dark and coarse. The old PWM had far more bits. Use a milder curve (or Linear), or dither/gamma at higher precision. Please confirm on the strip.stripPixelCount = 60is a guess, flagged by a "not yet counted" comment. Either use the real count or leave the placeholder out of a merged PR. A comment saying "set this" is a TODO.applyOutput: ifwarmKelvin == coldKelvin,coldSharedivides by zero and the float to uint8_t cast is UB. Cheap guard, or reject the config.begin():items_is allocated beforermtInitand never checked. IfneworrmtInitfails,serviceonly guardsrmt_, so a faileditems_allocation would crash. Guard both.Nodedispatch; all go straight toonCommand. Nothing covers a command carrying both flags under an active lockout.emitStatewithOrigin::Failsafeand the failsafe flag is also untested. The pixel-timing and RMT code in ws2805.cpp has no test (the file is empty on native), so its bit timings are unchecked until it runs on hardware.0 | CctFlag::Brightnessis a needless idiom. Pass the flag alone, or build the combined flags the way the codec tests do.@ -0,0 +13,4 @@constexpr uint8_t bitsPerPixel = channelsPerPixel * 8;constexpr float tickNs = 50;constexpr uint32_t rmtItem(uint32_t highTicks, uint32_t lowTicks) { return highTicks | (1u << 15) | (lowTicks << 16); }What does
rmtItemmean?Replaced
rmtItemwith apulse()that sets the core's ownrmt_data_tfields (level0,duration0,level1,duration1). Timings unchanged.Findings only.
Serial.println("AAAA"). Remove it and the braces.lastRampReportMs_throttle from LevelEndpoint::loop, or change the spec in this PR.StopRamp,RampUpandRampDownfall todefault: return trueand do nothing. LevelEndpoint handles StopRamp. Either handle it or say in the spec that CCT ignores these.target.dark(). Clamp the lit channel to at least 1 when level > 0.running_ == trueand is never updated again. Switching mid-ramp leaves it stale. CalltransitionTo(colour(), 0, now)on the new one, or stop the old one.selectAnimationmid-ramp.test_state_cct...only checks the Ramping flag at the start and end.7c0e181c17f6a4e868fdMake the kitchen strip a WS2805 CCT lightto Make the kitchen strip a WS2805 RGBCCT colour lightThree small things, none blocking.
@ -85,1 +83,3 @@It links the SocketCAN backend so `Node` has a `CanBus` to resolve against, andThe `native` environment compiles `lib/can-protocol`, `lib/node-runtime`,`lib/led-strips` and `lib/strip-animations`, minus the endpoints that drivehardware, which compile to nothing off Arduino. It links the SocketCAN backend so `Node` has a `CanBus` to resolve against, andThe rewrap is half done: the
It links the SocketCAN backend...line now runs past the wrap width. Rewrap the paragraph.Stale: open question 2 still says "Addressable WWA strips". The kitchen strip is now an RGBCCT colour light. Reword it, or drop it if the per-segment question is settled.
@ -13,3 +13,3 @@constexpr EndpointType allTypes[] = {EndpointType::Switch, EndpointType::Dimmer, EndpointType::CctLight, EndpointType::Fan, EndpointType::Valve, EndpointType::Motor,EndpointType::Switch, EndpointType::Dimmer, EndpointType::ColourLight, EndpointType::Fan, EndpointType::Valve, EndpointType::Motor,The rename widened
allTypesand the rows no longer match clang-format (it flags lines 16-18). Runclang-format -ion this file.