Skip to content

feat(pch): picture token 0xBB/0xB1 arbitration and Radio #2 web UI (phase D) - #34

Merged
BonBear merged 1 commit into
mainfrom
gw-pch-phase-d
Nov 21, 2026
Merged

BonBear merged 1 commit into
mainfrom
gw-pch-phase-d

Conversation

@BonBear

@BonBear BonBear commented Nov 21, 2026

Copy link
Copy Markdown
Owner

Summary

  • Add picture_token.{h,cpp} (pure C++17, ~160 B static RAM, host-testable): FIFO 4-camera wait queue, IDLE/RESERVED/HELD states, 10 s grant / 12 s inactivity / 90 s max-hold leases, 3 s ACK grace, and legacy camera implicit claim / immediate release.
  • Wire 0xBB (token request, immediate cmd=0 downlink answer with DL_FLAG_TOKEN | DL_FLAG_GRANT/HOLD) and 0xB1 (release) across main.cpp, image_receiver.cpp, serial_cli.cpp (pch status), and web_portal.cpp (/api/status token object).
  • Update MD_CAM/firmware/main.c: capture JPEG into SDRAM first, acquire token via 0xBB before 0xB2, hold across 0xF0 resends, release via 0xB1 on poll ACK or ack_left timeout, and fall back to Phase B on 3 unanswered 0xBBs or !DL_FLAG_TOKEN.
  • Update gateway web portal Live Telemetry & Radio card with Radio build(scripts): Bump the python group with 4 updates #2 (Picture Radio (#2), Radio #2 RSSI, PCH Chunks, Picture Token) tiles using safe textContent updates.
  • Add 10 unit tests in test_picture_token.cpp, update test_downlink.cpp, fuzz_image_receiver.cpp, and cc1110_common/test_host/.

Verification

  • Gateway (lolin_s2_mini + lolin_s2_mini_eval): 0 warnings, RAM 31.7%, Flash 82.3%.
  • Camera CC1110 (MD_CAM): 10,593 B, 0 SDCC warnings; Door sensor: 4,346 B, 0 SDCC warnings.
  • Host tests (WSL, ASan+UBSan): 95 gateway + 26 fuzz + 23 CC1110 ctr_log_tests passed; pytest tests: 133 passed; check_secrets.py: 0 findings.
  • Bench-verified on gateway (COM9) + camera (COM11): test_camera_e2e.py 12/12 passed with grants 6 | holds 0 | releases 6 | expiries 0 | legacy 0, 1,865 PCH chunks / 0 main chunks, 0 overflows, 0 late polls.

@BonBear
BonBear merged commit a9b999a into main Nov 21, 2026
22 checks passed
@BonBear
BonBear deleted the gw-pch-phase-d branch November 21, 2026 22:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant