docs(07-02): complete animation command renderer plan
- SUMMARY.md: 26 tests passing, all 7 animations implemented - STATE.md: advanced to plan 2, 92% progress, decisions logged - ROADMAP.md: phase 7 progress updated
This commit is contained in:
@@ -143,7 +143,7 @@ Plans:
|
|||||||
|
|
||||||
Plans:
|
Plans:
|
||||||
- [ ] 07-01: Firmware scaffold — MicroPython UDP socket listener, packet type discriminator, device config (LED count, strip type)
|
- [ ] 07-01: Firmware scaffold — MicroPython UDP socket listener, packet type discriminator, device config (LED count, strip type)
|
||||||
- [ ] 07-02: Animation command renderer — parse animation+params packets, run animations on LED strip
|
- [x] 07-02: Animation command renderer — parse animation+params packets, run animations on LED strip
|
||||||
- [ ] 07-03: Frame mode renderer — parse DRGB/DRGBW frames, handle multi-packet reassembly, output to physical strip
|
- [ ] 07-03: Frame mode renderer — parse DRGB/DRGBW frames, handle multi-packet reassembly, output to physical strip
|
||||||
|
|
||||||
## Progress
|
## Progress
|
||||||
@@ -159,4 +159,4 @@ Phases execute in numeric order: 1 → 2 → 3 → 4 → 5 → 6 → 7
|
|||||||
| 4. Timeline Editor | 4/4 | Complete | 2026-04-06 |
|
| 4. Timeline Editor | 4/4 | Complete | 2026-04-06 |
|
||||||
| 5. Live Show Execution | 4/4 | Complete | 2026-04-07 |
|
| 5. Live Show Execution | 4/4 | Complete | 2026-04-07 |
|
||||||
| 6. AI Sync | 3/3 | Complete | 2026-04-07 |
|
| 6. AI Sync | 3/3 | Complete | 2026-04-07 |
|
||||||
| 7. Microcontroller Firmware | 0/3 | Not started | - |
|
| 7. Microcontroller Firmware | 1/3 | In Progress| |
|
||||||
|
|||||||
@@ -2,15 +2,15 @@
|
|||||||
gsd_state_version: 1.0
|
gsd_state_version: 1.0
|
||||||
milestone: v1.0
|
milestone: v1.0
|
||||||
milestone_name: milestone
|
milestone_name: milestone
|
||||||
status: verifying
|
status: executing
|
||||||
stopped_at: Completed 06-ai-sync/06-03-PLAN.md
|
stopped_at: Completed 07-microcontroller-firmware/07-02-PLAN.md
|
||||||
last_updated: "2026-04-07T11:53:10.483Z"
|
last_updated: "2026-04-07T15:42:39.463Z"
|
||||||
last_activity: 2026-04-07
|
last_activity: 2026-04-07
|
||||||
progress:
|
progress:
|
||||||
total_phases: 7
|
total_phases: 7
|
||||||
completed_phases: 6
|
completed_phases: 6
|
||||||
total_plans: 21
|
total_plans: 24
|
||||||
completed_plans: 21
|
completed_plans: 22
|
||||||
percent: 0
|
percent: 0
|
||||||
---
|
---
|
||||||
|
|
||||||
@@ -21,13 +21,13 @@ progress:
|
|||||||
See: .planning/PROJECT.md (updated 2026-04-05)
|
See: .planning/PROJECT.md (updated 2026-04-05)
|
||||||
|
|
||||||
**Core value:** Load a song, build a synchronized light show, play it back live — with precise control over every effect on every device.
|
**Core value:** Load a song, build a synchronized light show, play it back live — with precise control over every effect on every device.
|
||||||
**Current focus:** Phase 06 — ai-sync
|
**Current focus:** Phase 07 — microcontroller-firmware
|
||||||
|
|
||||||
## Current Position
|
## Current Position
|
||||||
|
|
||||||
Phase: 7
|
Phase: 07 (microcontroller-firmware) — EXECUTING
|
||||||
Plan: Not started
|
Plan: 2 of 3
|
||||||
Status: Phase complete — ready for verification
|
Status: Ready to execute
|
||||||
Last activity: 2026-04-07
|
Last activity: 2026-04-07
|
||||||
|
|
||||||
Progress: [░░░░░░░░░░] 0%
|
Progress: [░░░░░░░░░░] 0%
|
||||||
@@ -73,6 +73,7 @@ Progress: [░░░░░░░░░░] 0%
|
|||||||
| Phase 06-ai-sync P01 | 8 | 3 tasks | 6 files |
|
| Phase 06-ai-sync P01 | 8 | 3 tasks | 6 files |
|
||||||
| Phase 06-ai-sync P02 | 8 | 2 tasks | 7 files |
|
| Phase 06-ai-sync P02 | 8 | 2 tasks | 7 files |
|
||||||
| Phase 06-ai-sync P03 | 8 | 2 tasks | 5 files |
|
| Phase 06-ai-sync P03 | 8 | 2 tasks | 5 files |
|
||||||
|
| Phase 07 P02 | 155 | 3 tasks | 3 files |
|
||||||
|
|
||||||
## Accumulated Context
|
## Accumulated Context
|
||||||
|
|
||||||
@@ -132,6 +133,9 @@ Recent decisions affecting current work:
|
|||||||
- [Phase 06-ai-sync]: Heuristic always available as baseline; LLM opt-in via use_llm flag (D-04)
|
- [Phase 06-ai-sync]: Heuristic always available as baseline; LLM opt-in via use_llm flag (D-04)
|
||||||
- [Phase 06-ai-sync]: LLM generates from scratch, not post-processing heuristic output (D-06)
|
- [Phase 06-ai-sync]: LLM generates from scratch, not post-processing heuristic output (D-06)
|
||||||
- [Phase 06-ai-sync]: anthropic imported lazily inside llm_generate to avoid startup crash without API key
|
- [Phase 06-ai-sync]: anthropic imported lazily inside llm_generate to avoid startup crash without API key
|
||||||
|
- [Phase 07]: Inline _hsv_to_rgb replaces colorsys (not available in MicroPython)
|
||||||
|
- [Phase 07]: bytearray for FireAnimation heat buffer avoids GC pressure on device
|
||||||
|
- [Phase 07]: density field maps to size for chase, cooling for fire, ignored for others
|
||||||
|
|
||||||
### Pending Todos
|
### Pending Todos
|
||||||
|
|
||||||
@@ -145,8 +149,8 @@ None yet.
|
|||||||
|
|
||||||
## Session Continuity
|
## Session Continuity
|
||||||
|
|
||||||
Last session: 2026-04-07T11:48:26.607Z
|
Last session: 2026-04-07T15:42:39.455Z
|
||||||
Stopped at: Completed 06-ai-sync/06-03-PLAN.md
|
Stopped at: Completed 07-microcontroller-firmware/07-02-PLAN.md
|
||||||
Resume file: None
|
Resume file: None
|
||||||
|
|
||||||
Next action: `/gsd:plan-phase 1`
|
Next action: `/gsd:plan-phase 1`
|
||||||
|
|||||||
@@ -0,0 +1,86 @@
|
|||||||
|
---
|
||||||
|
phase: "07"
|
||||||
|
plan: "02"
|
||||||
|
subsystem: firmware
|
||||||
|
tags: [micropython, animations, led, firmware]
|
||||||
|
dependency_graph:
|
||||||
|
requires: [07-01]
|
||||||
|
provides: [animation-rendering-engine]
|
||||||
|
affects: [firmware/main.py, firmware/animations.py]
|
||||||
|
tech_stack:
|
||||||
|
added: []
|
||||||
|
patterns: [MicroPython-compatible Python, bytearray GC optimization, HSV inline conversion]
|
||||||
|
key_files:
|
||||||
|
created:
|
||||||
|
- firmware/animations.py
|
||||||
|
- tests/test_firmware_animations.py
|
||||||
|
modified:
|
||||||
|
- firmware/main.py
|
||||||
|
decisions:
|
||||||
|
- "Inline _hsv_to_rgb replaces colorsys (not available in MicroPython)"
|
||||||
|
- "bytearray for FireAnimation heat buffer avoids GC pressure on device"
|
||||||
|
- "create_animation() factory centralizes cmd dict to instance mapping"
|
||||||
|
- "density field maps to size for chase, cooling for fire, ignored for others"
|
||||||
|
metrics:
|
||||||
|
duration: "155 seconds"
|
||||||
|
completed: "2026-04-07"
|
||||||
|
tasks: 3
|
||||||
|
files: 3
|
||||||
|
---
|
||||||
|
|
||||||
|
# Phase 07 Plan 02: Animation Command Renderer Summary
|
||||||
|
|
||||||
|
All 7 LightSync animations ported to MicroPython-compatible firmware with a complete test suite — 26 tests passing with full server-to-firmware round-trip verification.
|
||||||
|
|
||||||
|
## Tasks Completed
|
||||||
|
|
||||||
|
| # | Task | Commit | Files |
|
||||||
|
|---|------|--------|-------|
|
||||||
|
| 1 | Create firmware/animations.py | 053e1ab | firmware/animations.py |
|
||||||
|
| 2 | Update firmware/main.py with render wiring | 8e521e5 | firmware/main.py |
|
||||||
|
| 3 | Create test suite + re-apply main.py | 49f0b0f | tests/test_firmware_animations.py, firmware/main.py |
|
||||||
|
|
||||||
|
## What Was Built
|
||||||
|
|
||||||
|
`firmware/animations.py` contains all 7 animation classes ported from `lightsync/animations/*.py` with these MicroPython adaptations:
|
||||||
|
- `_hsv_to_rgb()` inline function replaces `colorsys.hsv_to_rgb` (not in MicroPython)
|
||||||
|
- `bytearray` for `FireAnimation._heat` buffer (avoids GC pressure on device)
|
||||||
|
- No type hints, no `abc` ABC, no `lightsync` imports
|
||||||
|
- `create_animation(cmd)` factory maps parsed command dicts to animation instances
|
||||||
|
|
||||||
|
`firmware/main.py` updated to:
|
||||||
|
- Import `create_animation` from `animations`
|
||||||
|
- Add `current_anim_instance` global
|
||||||
|
- Create animation instance on `anim_cmd` packet receipt
|
||||||
|
- Render animation using `ticks_diff()` timing in the render loop
|
||||||
|
|
||||||
|
`tests/test_firmware_animations.py` provides 26 host-side tests covering:
|
||||||
|
- `_hsv_to_rgb` primary colors and edge cases
|
||||||
|
- All 7 animation classes: length, value ranges, behavior
|
||||||
|
- `create_animation()` factory for all types + unknown fallback
|
||||||
|
- Full round-trip: `encode_animation_cmd` -> `parse_animation_cmd` -> `create_animation` -> `render`
|
||||||
|
|
||||||
|
## Verification
|
||||||
|
|
||||||
|
- `uv run pytest tests/test_firmware_animations.py -v` — 26 passed in 0.05s
|
||||||
|
- `_hsv_to_rgb` correct: red=(255,0,0), green=(0,255,0), blue=(0,0,255)
|
||||||
|
- `FireAnimation` uses `bytearray` confirmed by `test_uses_bytearray`
|
||||||
|
- Round-trip test passes for all 7 animation types
|
||||||
|
- No `colorsys`, `abc`, or `lightsync` imports in any `firmware/` file
|
||||||
|
|
||||||
|
## Deviations from Plan
|
||||||
|
|
||||||
|
### Auto-fixed Issues
|
||||||
|
|
||||||
|
**1. [Rule 3 - Blocking] Re-applied main.py changes after 07-01 parallel agent overwrite**
|
||||||
|
- **Found during:** Task 3 (after test file creation)
|
||||||
|
- **Issue:** Agent 07-01 (running in parallel) committed `firmware/main.py` with the scaffold version, reverting the animation wiring committed in Task 2
|
||||||
|
- **Fix:** Re-applied all animation changes to main.py via Edit tool after detecting the revert in system notification
|
||||||
|
- **Files modified:** firmware/main.py
|
||||||
|
- **Commit:** 49f0b0f (included with test file commit)
|
||||||
|
|
||||||
|
## Known Stubs
|
||||||
|
|
||||||
|
None — plan goal fully achieved. All 7 animations render correctly, tests pass.
|
||||||
|
|
||||||
|
## Self-Check: PASSED
|
||||||
Reference in New Issue
Block a user