Skip to content

fix: report the enabled bit in the fake firmware's status frames - #8

Merged
thetooler merged 1 commit into
mainfrom
fix/fake-enabled-flag
Oct 7, 2026
Merged

thetooler merged 1 commit into
mainfrom
fix/fake-enabled-flag

Conversation

@thetooler

Copy link
Copy Markdown
Contributor

Summary

The fake firmware answered CMD_ENABLE by setting its internal flag, but every status frame it built carried flags = 0, so RobotState::enabled() was always false offline. A component that waits for that bit before its first command frame cannot be tested against a double that never sets it: the wait looks like a firmware bug, and the real behaviour it guards (the firmware is not energized yet while it writes CMODE for every axis) stays invisible until hardware is attached.

Changes

  • src/testing.cpp: status_flags(bool) returns 1 << FLAG_ENABLED_BIT when the fake is enabled and 0 otherwise, and all eight make_status() call sites use it. The frames the fake builds now match the firmware's layout for bit9 as well as for the fields they already matched.

Testing

cmake -S . -B build -DLITEARM_CPP_BUILD_TESTS=ON -DCMAKE_BUILD_TYPE=Release
cmake --build build -j
ctest --test-dir build --output-on-failure
# 100% tests passed, 0 tests failed out of 27

The suite includes the golden parity harness, which compares the frames this SDK produces against the real Python SDK byte for byte, so the change is checked against the reference implementation rather than against itself.

Issues

No issue is linked. Found while bringing the direct-USB ros2_control component up on hardware: the missing bit is why its "wait until the arm reports itself enabled" step could not be reproduced offline.

The test double answered CMD_ENABLE by setting its internal flag, but every
status frame it built carried flags = 0, so RobotState::enabled() was always
false offline. A component that waits for that bit before its first command
frame cannot be tested against a double that never sets it -- the wait looks
like a firmware bug, and the real behaviour it guards (the firmware is not
energized yet while it writes CMODE for every axis) stays invisible until
hardware is attached.

status_flags(enabled) now feeds all eight make_status() call sites, so bit9
matches the firmware like the other fields already did.
@thetooler
thetooler merged commit 135b655 into main Oct 7, 2026
1 check passed
@thetooler
thetooler deleted the fix/fake-enabled-flag branch October 7, 2026 02:55
@github-actions

github-actions Bot commented Oct 7, 2026

Copy link
Copy Markdown

🎉 This PR is included in version 0.1.1 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

@github-actions github-actions Bot added the released Shipped in a release label Oct 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

released Shipped in a release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant