Skip to content

fix: register the four firmware error codes the table was missing - #21

Merged
X-F-R merged 1 commit into
mainfrom
fix/protocol-sync-firmware-1-10-0
Oct 10, 2026
Merged

X-F-R merged 1 commit into
mainfrom
fix/protocol-sync-firmware-1-10-0

Conversation

@X-F-R

@X-F-R X-F-R commented Oct 10, 2026

Copy link
Copy Markdown
Contributor

Summary

Parsing the firmware headers turned up four error codes this SDK cannot name, and one
entry that describes behaviour the firmware changed on 2026-09-24. The two protocol-sync
suites read a real litearm-stm32 checkout and skip silently without one, so none of
this was visible until a checkout was placed next to the repo.

Same firmware tree as #19; this is the error-table half rather than the cartesian half.

Changes

  • errors.py — register four codes the firmware emits:
    • (0x21, 0x02) speed percent out of range (usb_cmd.c:637)
    • (0x31, 0x01) preset payload too short (usb_cmd.c:908)
    • (0x39, 0x02) q contains NaN/Inf (usb_cmd.c:1034)
    • (0x02, 0x06) a move_p late terminal reply (kin_runner.c:173)
  • errors.py — (0x31, 0x02) read "preset invalid or payload too short". The
    firmware split those apart on 2026-09-24, so the "or" makes a caller read a length
    error as a preset error.
  • tests/test_error_codes.py — the symbolic-site manifest counted usb_cmd.c only,
    while the parser walks the whole firmware tree, so the kin_runner.c site had never
    been seen. Manifest 14 -> 15.
  • tests/test_error_codes.py — an assertion claimed MOVE_P has no drop_hold gate. That
    covers the dispatch path only: the reply path (kin_runner_flush_move ->
    ctrl_accept_move_j) does have the gate and does return 0x06, so a caller could
    misread a drop-hold latch. Replaced by a positive assertion.
  • tests/test_protocol_sync.py — test_bench_model_axis_matches_sdk_constant used
    #if\s+LITEARM_BENCH_1J(.*?)#else with re.S, which hits the literal #if and
    #else inside the file's own comment, so it reported "bench branch not found" for the
    wrong reason. It now matches the #define line. The firmware removed bench mode on
    2026-09-28 and left an #error guard, so the test asserts the guard is present and
    that the constant is still carried for 1J firmware.
  • _protocol.py — mark BENCH_MODEL_AXIS LEGACY with the removal rationale.

Testing

$ python3 -m pytest -q
657 passed, 2 skipped                    # the 2 skips are the LITEARM_LIVE tests

$ LITEARM_LIVE=1 python3 -m pytest -q
659 passed

Before this branch, same firmware checkout, from main:

$ LITEARM_LIVE=1 python3 -m pytest -q --tb=no
3 failed, 655 passed

The three failures are exactly the ones this fixes:
test_every_firmware_literal_err_code_is_registered,
test_symbolic_site_manifest_matches_firmware,
test_bench_model_axis_matches_sdk_constant.

The 2 skips are expected offline: the protocol-sync suites call pytest.skip when no
firmware checkout is present, by design.

Issues

Refs #19

Parsing the firmware headers turned up four codes the SDK cannot name and
one entry that describes behaviour the firmware has already changed:

  (0x21, 0x02)  speed percent out of range          usb_cmd.c:637
  (0x31, 0x01)  preset payload too short            usb_cmd.c:908
  (0x39, 0x02)  q contains NaN/Inf                  usb_cmd.c:1034
  (0x02, 0x06)  a move_p late terminal reply        kin_runner.c:173

(0x31, 0x02) said "preset invalid **or** payload too short". The firmware
split those apart on 2026-09-24, so the "or" now makes a caller read a
length error as a preset error.

(0x02, 0x06) also contradicted an assertion here that MOVE_P has no
drop_hold gate. That claim only covers the dispatch path; the reply path
(kin_runner_flush_move -> ctrl_accept_move_j) does have the gate and does
return 0x06, so a caller could misread a drop-hold latch. The negative
assertion is replaced by a positive one.

The symbolic-site manifest counted usb_cmd.c only while the parser walks
the whole firmware tree, so the kin_runner.c site was never seen at all.
Manifest 14 -> 15.

Found by running the two protocol-sync suites against a real litearm-stm32
checkout; they skip silently without one.
@X-F-R
X-F-R merged commit 505f766 into main Oct 10, 2026
2 checks passed
@X-F-R
X-F-R deleted the fix/protocol-sync-firmware-1-10-0 branch October 10, 2026 09:57
@github-actions

Copy link
Copy Markdown

🎉 This PR is included in version 1.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 10, 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.

2 participants