Repository navigation
4.5.0: parse what the firmware accepts - #11
Conversation
Stored WCB commands on c2-body showed as unrecognized raw steps although the firmware runs them: - A stray, doubled or trailing '^' became an empty raw step. The WCB skips empty segments (parseCommandsNoChecksum: `if (!singleCmd.isEmpty())`), so parseWCBValue now drops them. - New param flag `omittable`: the firmware accepts the command with the param left off and uses its own default. match() accepts it absent (param = ''), encode() leaves it and every later param off when it is ''. The composer offers a "Board default" choice. The validator keeps omittable params at the end of the template and rejects omittable + required. - New param flag `leadingZeros`: the firmware reads the number with atoi/toInt, so '03' is '3'. The zeros sit outside the capture group, so a rebuild writes the canonical code. Only on enums with numeric codes. Data: - flthy-hps: colour omittable on 002/003/004/005/007 and speed on 003 (processCommands: defaultColor / shortColor / DIMPULSESPEED when absent), so A007 decodes as Short Circuit in the board colour. RC and wag servo commands accept |n (HPHalt, v1.81 main.cpp:1420, :947-960). - psi-pro Run Effect: leadingZeros (atoi, PSIPro main.cpp:2369). - ia-magic-panel Run Mode: leadingZeros (inputString.toInt()). The 4.2.0 freeze test allowlists the four servo ids whose duration support only widens; the 4.3.0 A007 tests now expect Short Circuit, which is what the firmware runs (the 4.3.0 rule: decode by what the firmware runs). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_018RWJkx8uxyZY9qy9upAPvE
Review: 4.5.0 — parse what the firmware acceptsChecks (all pass)
Safety classes: no HIGH-severity issues
Board rules
Engine (src/droidnet-command-library.js)
Advisory only; no changes made. |
…ds byte-identically The 4T03 example rebuilt as 4T3, which DroidNet's vendored-catalog test rejects: an example seeds the composer and shows the wire form, so it must be what the composer writes. The leading-zero parse stays covered by test/parse-leniency.test.js. The library now enforces the same rule. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_018RWJkx8uxyZY9qy9upAPvE
Review (advisory)Checks
Board rules
Safety (no mislabeling found)
Engine (
Nit
Nothing blocking. |
Stored WCB commands on c2-body showed rows of "Unrecognized token" in DroidNet's command builder although the firmware runs them. This release teaches the parser what the firmware accepts.
Engine
^became an empty raw step. The WCB skips empty segments (parseCommandsNoChecksum), soparseWCBValuedrops them.omittableparam flag — the firmware accepts the command with the param left off and uses its own default.match()accepts it absent (param ='');encode()leaves it and every later param off when it is''. The composer offers a Board default choice. The validator keeps omittable params at the template's end and rejects omittable + required.leadingZerosparam flag — the firmware reads the number withatoi/toInt, so03is3. A rebuild writes the canonical code (firmware-equivalent). Enums with numeric codes only.Data
processCommandsusesdefaultColor/shortColor/DIMPULSESPEED).A007now decodes as Short Circuit in the board colour. RC and wag servo commands accept|n(HPHalt, v1.81main.cpp:1420,:947-960).leadingZeros(atoi, PSIPromain.cpp:2369), so4T03parses.leadingZeros(inputString.toInt()), soT00parses.Tests
test/parse-leniency.test.js(40 tests), including the c2-bodyalarm,cantinaandangrysoundvalues.A007tests now expect Short Circuit, per the 4.3.0 rule "decode by what the firmware runs". Whether the droid's holoprojectors runA007as short circuit is still bench test 11.npm run validateclean;npm test465/465. Across c2-body's 54 stored commands, raw steps drop from 29 (in 23 commands) to 12; the rest are DroidNet@Ftokens,*MO,;H,STOPEMOTE,GRACEFUL(WCB WIFI branch only) andT35|180(the Magic Panel ignores|n).🤖 Generated with Claude Code
https://claude.ai/code/session_018RWJkx8uxyZY9qy9upAPvE