fix(artnet): drive each effect with its own parameters, and pair Plasma with plasma - #296
Merged
Merged
Conversation
…ma with plasma Every effect on the relay declares its own parameter set, and the relay ignores anything it does not recognise -- silently, with a 200. 3.1.0 sent the spot's shape (r,g,b,cx,cy,diameter,softness) to whichever effect was configured, so `effect:plasma`, which takes scale/speed/brightness and no colour at all, received seven keys it had no use for and ran at its defaults forever. It looked wired up and was not, and nothing anywhere failed. EFFECT_DRIVERS now maps each of the seven field effects to the parameters it actually accepts, driven from the frame: colour where the effect takes colour, brightness and scale where it generates its own, a centre where it has one, and integer counts where the relay indexes discrete things. The ten effects the relay cannot nudge are started once and left alone -- their parameters can only change by re-POSTing, which resets the animation phase, so nudging them every second would stutter in exchange for nothing. Plasma, Metaballs and Wave Tank now pair with plasma, blobs and ripple by default. Only pairings where the effect genuinely mirrors the screen: a mismatched effect puts the room out of step with the wall, which is worse than the dominant colour. Mutation testing then found a bug in that pairing. The settings UI stores 'Reactive' by DELETING the entry, so for a paired saver the dropdown read 'Reactive' while the pairing silently applied, and choosing Reactive deleted the key and fell straight back through to the effect -- opting out was impossible. The list now shows the effective mode, and writes 'reactive' explicitly where a pairing exists. modeForSaver uses hasOwnProperty for the same reason: a truthiness check let a deliberately-cleared entry fall through to the pairing. Also removed a genuinely unreachable branch: every driver is field-based, a test enforces it, and the non-field guard could never fire. Dead code whose comment implies otherwise is worse than none. 780 tests, 33 new. All 19 mutations caught; three escaped first -- integer parameters sampled only at a spread that lands on a whole number, an unreachable guard, and the opt-out bug above. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Groundwork for better Art-Net visuals, and a fix for a bug 3.1.0 shipped.
effect:plasmanever actually workedEvery effect on the relay declares its own parameter set, and the relay ignores anything it doesn't recognise — silently, with a 200. 3.1.0 sent the spot's shape (
r,g,b,cx,cy,diameter,softness) to whichever effect was configured. Butplasmatakesscale,speed,brightness— and no colour at all. So it received seven keys it had no use for, ran at its defaults forever, and never responded to the picture. It looked wired up and wasn't; nothing failed anywhere.EFFECT_DRIVERSnow maps each of the seven field effects to what it actually accepts:spot,rippleplasma,aurorablobssweeptunnelThe other ten effects (
fire,police,sparkle,chase, …) aren't field-based, so the relay can't nudge them — their parameters only change by re-POSTing, which resets the animation phase. Those are now started once and left alone rather than nudged pointlessly every second.Default pairings
Plasma →
plasma, Metaballs →blobs, Wave Tank →ripple. Only where the effect genuinely mirrors the screen — a mismatched effect puts the room out of step with the wall, which is worse than the dominant colour. Everything else stays reactive, and Reactive is selectable to opt out.Mutation testing found a bug in that pairing
The settings UI stores "Reactive" by deleting the entry. For a paired saver that meant:
Reactivewhile the pairing was silently in effect — stating the opposite of what the room was doingReactivedeleted the key, fell back through to the pairing, and opting out was impossibleThe list now shows the effective mode and writes
'reactive'explicitly where a pairing exists.modeForSaveruseshasOwnPropertyfor the same reason — a truthiness check let a deliberately-cleared entry fall through.Also removed a genuinely unreachable branch: every driver is field-based, a test enforces it, so the non-field guard could never fire.
Verification
GET /effects, so drift in our table is detectable.Still unverified against the rig (#274) — this is all parameter shaping, checked against the published schema rather than against light on a wall.
Next: the spatial part of the ask — mapping specific colours on specific parts of the wall onto the strips nearest them, using
POST /strips/{name}/pixels.🤖 Generated with Claude Code