jetson/ · the edge box
zdeck — the physical control surface
Six physical keys in the cab driving the tracker light, so nobody is aiming a moving head by typing DMX values over ssh, or by tapping a touchscreen while driving.
0fd9:0063, firmware 3.03.002, 6 keys in a 2×3 layout, 80×80 BMP key imagesplugdev group — a group, not TAG+="uaccess", because the service is headlessLayout
BLACKOUT LAMP HOME
DIM - DIM + COLOUR
| Key | Does | Notes |
|---|---|---|
| BLACKOUT | Dimmer → 0, and zeroes the whole universe via dmxpark.park() | Red when the head is lit, grey when already dark — a kill control that looks armed over a dark head is noise. Deliberately bypasses OlaDmxSink, which swallows its own send failures by design: right for a tracker frame, wrong for a kill. park() retries and reports. |
| LAMP | Toggle 0 ↔ full | Shows ON / OFF |
| HOME | Pan + tilt to mid-travel | Mid-pan is where the head should be mounted; mid-tilt is dead vertical |
| DIM − / DIM + | Step by 32 | Both keys show the live level in purple |
| COLOUR | Cycle on-palette slots | white / blue 34 / green 128 / purple 78 |
Colours follow ui/concepts/ConceptTheme exactly as the screens do: green for
controls, purple for live values, red for faults and kill only. The amber bands of the
colour wheel (ch5 40–58, 90–118) are rejected at config construction, not merely
avoided by convention.
Arbitration with the tracker is UNRESOLVED
Today this works only because zvision runs --dmx none,
so nothing else writes the universe and the deck owns it outright.
The moment the tracker is live at 8 Hz it overwrites anything the deck writes within ~125 ms. BLACKOUT would flicker, not kill — which is worse than not having the key at all, because the operator would believe the light was off.
The proposed mechanism, for when this is picked up
A mode latch at /run/zodiac/light-mode, written atomically by
zdeck only, read by zvision once per frame (a stat() on tmpfs
— nanoseconds, no locks, cannot block, so the constraint that a control-surface fault must
never stall the threat broadcaster still holds).
| Latch value | Meaning |
|---|---|
TRACK / absent | Tracker owns the light |
MANUAL | Deck owns it |
KILL | Nobody lights anything |
In MANUAL / KILL the tracker skips its send entirely
rather than interleaving frames, so there is no flicker. KILL is belt-and-braces: the
latch and a direct retrying dmxpark write.
Staleness is deliberately asymmetric: a stale MANUAL reverts to
TRACK (a dead deck must not freeze the beam), while a stale KILL
stays killed (a kill must never un-kill itself because its author died).
/run clears on reboot, so cold start is TRACK.
Two alternatives were rejected: olad port merging (HTP takes the maximum, so a kill of 0 structurally cannot win) and deck-sends-intents-to-zvision (the kill would depend on the liveness of the process being overridden).
Design notes
| Decision | Reason |
|---|---|
| Separate process, deliberately | A wedged USB button hub must never be able to stall the threat broadcaster the driver's night HUD depends on. The unit is After=olad but explicitly not After=zvision: the operator's physical control should come up whether or not the vision box is healthy. |
| A failed kill is visible | If the blackout send throws, key 0 re-renders as DMX FAIL in red and LAMP turns red too. A calm grey panel over a live beam is the one lie that matters on this device, so the panel says it does not know rather than saying “dark”. |
| Never leaves the head hot | The runner parks on every exit path and when the deck itself disappears — the case most likely to happen on a vehicle. While the panel is gone the operator has no kill control, so the beam must not be left burning. The unit also carries the same ExecStopPost fail-safe, which systemd runs on crash and kill. Necessary because olad owns frame timing and retransmits the last universe forever, so a dead writer leaves a frozen beam — and the fixture's own BLnd=blac cannot help, since from its side the signal never stopped. |
| A missing deck is normal, not an error | This rig loses USB devices over bumps. The runner waits and re-enumerates rather than exiting into a systemd restart loop. Only a specific DeckNotPresent is retried quietly, so a programming error cannot wear an unplugged cable's clothes forever. |
| Brightness starts at 20/100 | A Stream Deck at default brightness is a small floodlight in a dark cab, and it would undo the same night-vision work the OLED discipline and the $ZENV auto-dim exist for. |
| Fixture wiring is borrowed, not restated | Channel numbers come from zvision.tracker.TrackerConfig, so the deck and the tracker cannot disagree about which channel is the dimmer — a disagreement that on this fixture puts brightness on the colour wheel and makes the head look dead. |
Structure mirrors zvision: a pure model (model.py), the surface behind a
protocol with a fake (surface.py), and the vendor library isolated in one file
(hardware.py) — so CI needs neither the library nor a deck. DeckConfig
rejects amber colour slots and auto-spin wheel values at construction, and
DeckModel.channels() refuses to emit a frame touching a forbidden channel. 59 tests,
mutation-verified.
Install
# device access — group, not TAG+="uaccess": the service is headless
sudo cp jetson/systemd/70-zodiac-streamdeck.rules /etc/udev/rules.d/
sudo usermod -aG plugdev zodiac
sudo udevadm control --reload-rules && sudo udevadm trigger
# isolated venv: StreamDeck and Pillow are NOT zvision dependencies
sudo apt-get install -y python3-venv libhidapi-libusb0
sudo mkdir -p /opt/zodiac-deck && sudo chown zodiac:zodiac /opt/zodiac-deck
python3 -m venv /opt/zodiac-deck/venv
/opt/zodiac-deck/venv/bin/pip install streamdeck pillow
# the zdeck package itself must be where the unit runs it from
sudo mkdir -p /opt/zodiac/jetson
sudo cp -r jetson/zdeck /opt/zodiac/jetson/
sudo cp jetson/systemd/zodiac-deck.service /etc/systemd/system/
sudo systemctl daemon-reload && sudo systemctl enable --now zodiac-deck
cp -r jetson/zdeck step is only for a by-hand setup
zodiac-deck.service runs -m zdeck with
WorkingDirectory=/opt/zodiac/jetson. scripts/install.sh copies
zdeck there along with zvision, and a plain git clone to
/opt/zodiac already has it, so the copy is needed only when you set up the
deck by hand without running install.sh. The deck's venv and its StreamDeck/Pillow
dependencies are still set up by hand.
zdeck's --dmx defaults to ola
The opposite of zvision, whose DMX output defaults to none. That
asymmetry is deliberate — the deck exists to drive the light; the vision runner does not, yet
— and it is what the safety argument above rests on. Pass --dmx fake explicitly
for a dry run.
Open items
| Item | Detail |
|---|---|
| Install the service on the Jetson | Built but not enabled. See the arbitration blocker first. |
| Strain relief on the USB connector | The runner re-enumerates, but a cable that unplugs itself in the dark is still a lost control surface. |
| Heartbeat republish (~1 Hz while owning the light) | publish() is press-driven only, so anything that stomps the universe — notably a systemctl restart zvision, whose ExecStopPost parks universe 0 — kills the light while the panel still says LAMP ON, and it stays wrong until the next key press. |
| Watchdog | No WatchdogSec / sd_notify. A loop wedged inside a blocking vendor USB call looks healthy to systemd forever. Type=notify + WatchdogSec has the nice property that a hang becomes a kill, which runs ExecStopPost, which parks — it fails dark. |
| Startup slew | start() publishes immediately with pan/tilt 128/128, so every service restart physically slews the head to centre unprompted. Harmless on a bench, rude on a vehicle, and it would stomp the tracker's aim once arbitration exists. |
| BLACKOUT and LAMP-off are the same operation | So one of six keys is redundant. Suggestion: make BLACKOUT a latched KILL that holds against the tracker and needs a deliberate release — which is also what the arbitration latch wants. |
ExecStopPost arg drift | Fixed: both units now park with --from-args-env, which reads the service’s own ZDECK_ARGS / ZVISION_ARGS, so the park goes to the universe and URL the service actually used. |
| Night discipline | The keys are backlit LCDs. Brightness way down, dim icons, and ideally follow the same $ZENV lux auto-dim the tablets already use. |
Fleet-wide actions from the deck (cycle nav target, screen blackout, mark-this-spot on the breadcrumb, switch the driver's concept) all require an inbound command channel the cockpit app does not have — it only ever listens. That lands next to nav / GPS / messaging, so it is a separate call, not a natural extension.
Converted fromjetson/DECK.md · ARCHITECTURE.md §6.5 · docs/DEVICES.md §4 · tasks/open.md