Skip to content

feat: add the e-stop, watchdog, status LED and parsing modules - #1

Merged
CameronBrooks11 merged 2 commits into
mainfrom
feat/v0.1-modules
Oct 23, 2026
Merged

CameronBrooks11 merged 2 commits into
mainfrom
feat/v0.1-modules

Conversation

@CameronBrooks11

@CameronBrooks11 CameronBrooks11 commented Oct 23, 2026 •

Copy link
Copy Markdown
Member

The v0.1 modules from feastorg/.github#4:

  • bsc::EStop and bsc::bootWait(): the e-stop sampling Slice_DCMT and Slice_RLHT share (assert on one active sample, 25 ms release debounce, count). It returns an edge; what a stop does stays in each Slice.
  • bsc::CommandWatchdog: arm, stamp, check, clear and the trip latch.
  • bsc::StatusLed: the driver from refactor(firmware): drive the status LED without FastLED Slice_DCMT#55, with identifiers renamed only.
  • bsc::parseLong() / bsc::parseFloat(): strict whole-token parsing.

The core owns the state interrupt handlers read (asserted(), count(), tripped(), tripCount()) and sets it with interrupts off before returning Pressed or a trip. Each Slice keeps its own actuation and field resets in whatever order it uses now.

Behaviour changes against the Slices' copies:

  • bootWait() restamps the watchdog when the wait ends, so a boot timeout under 1 s no longer trips on the first loop pass (the requirement noted on Slice firmware platform: bread-slice-core and the firmware spec .github#4).
  • check() compares the timeout inside the masked window that sets the latch, so an ISR stamp can't land between the comparison and the latch.
  • On a press or a trip the latch is set before the Slice drives its outputs; DCMT sets it after.

Tests: host tests for all four modules (ctest, 4/4). Each of 18 mutations, one per checked behaviour, turned its target test red. examples/slice_skeleton builds for nanoatmega328new (3608 B flash) and nano_every (4435 B) with no warnings from the library, and fails on megaatmega2560 with the LED header's #error.

Not checked: no Slice uses it yet, and nothing here has run on a board. The LED loop's asm is unchanged from the benched one; I have not compared the compiled output, and this build has not been flashed or scoped.

The e-stop sampling and command watchdog are the logic Slice_DCMT and
Slice_RLHT share by copy, minus each family's safe-state policy: the
core owns the state interrupt handlers read, sets it with interrupts
off, and returns an edge for the Slice to act on. bootWait() restamps
the watchdog when the wait ends, so a boot timeout under 1 s no longer
trips on the first loop pass. The status LED driver is the one benched
in feastorg/Slice_DCMT#55. parseLong() and parseFloat() accept only a
whole decimal token in range.

Each module has host tests. A sweep of 18 mutations, one per checked
behaviour, turned its target test red every time. The example builds
for nanoatmega328new and nano_every with no library warnings.
@CameronBrooks11
CameronBrooks11 merged commit be0dd47 into main Oct 23, 2026
3 checks passed
@CameronBrooks11
CameronBrooks11 deleted the feat/v0.1-modules branch October 27, 2026 03:23
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