Skip to content

Add the event queue and the device monitor - #20

Merged
AnakinRaW merged 3 commits into
mainfrom
claude/core-events-monitor-19ac57
Nov 17, 2026
Merged

AnakinRaW merged 3 commits into
mainfrom
claude/core-events-monitor-19ac57

Conversation

@AnakinRaW

Copy link
Copy Markdown
Owner

Summary

  • Event queue (firmware/lib/event-queue): every driver gets a lock-free queue. Its interrupt writes to the queue and the main loop reads from it. read() merges all queues, oldest event first. attach() returns false for a refused queue and points its out parameter at a queue that drops every event.
  • Device monitor (firmware/lib/device-monitor): checks each watched driver on the driver tick every 100 ms. It publishes DEVICE_FAILED and DEVICE_RECOVERED for every part whose state changed. Its queue lies in RAM2, and model/firmware/figures.py counts it against that pool.
  • Gists: the input-handling gist and the device monitor's part of the error-handling gist are deleted, since the libraries now hold that code. The driver gists use the libraries' names: DEVICE_FAILED, DEVICE_RECOVERED, the UPPER_CASE device list and attach() with its out parameter.
  • Docs: driver-design.md, error-handling.md, input-handling.md and testing.md follow the libraries.

Tests

  • Computer tests for both libraries: test_event-queue and test_device-monitor.
  • New Teensy test event-queue.from-interrupts: two interrupts at different priorities publish into the queue. In the run it read 499999 and 384615 events.
  • Teensy quick run: 13 passed, 0 failed, 4 skipped, 35.0 s. The 4 skipped are the servo tests, which need a wire from pin 0 to pin 1 that was not fitted.

🤖 Generated with Claude Code

AnakinRaW and others added 3 commits November 17, 2026 00:27
The event queue gives every driver a lock-free queue that its interrupt
writes and the main loop reads, and read() merges all queues oldest
first. attach() returns false for a refused queue and points its out
parameter at a queue that drops every event.

The device monitor checks each watched driver on the driver tick every
100 ms and publishes DEVICE_FAILED and DEVICE_RECOVERED for every part
whose state changed. Its queue lies in RAM2, which the firmware model
counts against the pool.

Computer tests cover both libraries, and the Teensy test image gains
event-queue.from-interrupts, which publishes from two interrupts of
different priorities.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The input-handling gist and the device monitor's part of the
error-handling gist are gone, since the event queue and the device
monitor stand as libraries. The driver gists take the libraries'
names: DEVICE_FAILED, DEVICE_RECOVERED, the UPPER_CASE Device list and
attach() with its out parameter.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@AnakinRaW
AnakinRaW merged commit f50fc24 into main Nov 17, 2026
6 checks passed
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