Repository navigation
Conversation
Preserve harpua555's original PR #40 signed-difference contract on the periodic Status.PrintInfo broadcast. Reserve private zero-initialized ELF BSS instead of overwriting stock PRNG state, and execute original-versus-new ARM regression tests.
The slicer spoof made every SDCP FirmwareVersion read "1.4.49", which is also what Home Assistant's elegoo_printer integration inspects: it only registers the OpenCentauri-only sensors (total/current extrusion, the ones Spoolman reads) when Printer._is_open_centauri finds an OC/O marker in that string. With a bare stock version HA treats the printer as stock and never creates those entities, so restoring the PrintInfo fields alone still leaves Spoolman with nothing. Report "1.4.49 OC" instead: the leading version keeps ElegooSlicer recognising the firmware, the marker keeps HA on the OpenCentauri entity set. The cave grows from 8 to 11 bytes and still ends ahead of the wait_for_chamber_temp trampoline at 0x004517f0. The patch now validates all four regions before writing any byte, and refuses a non-zero cave instead of warning about it. Still needs an on-device slicer check: nothing in CI proves ElegooSlicer accepts the longer version string.
main is always ahead of the last release tag, so git-describe on a release build reports the previous version plus a commit count instead of the version being shipped. Add OC_VERSION to the firmware edition config and let firmware_version() use it. The vX.Y.Z-integrate branch check stays ahead of it, so dev builds keep reporting their own sha. Set it to 0.5.1 for this release.
PR build artifact
Firmware patches includedOpenCentauri Firmware Build
Build metadata
Patches applied (TY Sims!)
Please provide feedback as comments in this PR or in the |
patch_planner injects the edition variables into the environment of the patch scripts it launches, but create_manifest.py and the patch summary run as separate processes from build.sh, so they never saw OC_VERSION. The first CI build on this branch shipped a manifest reading 0.5.0-8a7d9f1-oc while the binary itself got 0.5.1-oc. firmware_version() now falls back to the active oc-patches/patch_config edition file when the variable is not in the environment, so every consumer of the version agrees. Covered by a test that calls it with no environment at all.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
v0.5.0 stopped emitting
TotalExtrusion/CurrentExtrusionin the periodicStatus.PrintInfobroadcast, so Spooler v2 and Home Assistant/Spoolman stopped seeing filament usage (#114).The 1.4.46 patch hooked the function that builds the periodic broadcast. The 1.4.49 port hooked a different site (file
0x36f9ec, the Agora hook), so the keys never reach the status JSON. In the released v0.5.0update.swuthe wrong hook is patched and the real broadcast site (file0x35d310) is untouched; the key strings themselves were already correct at0x4519a0/0x4519b0.A second problem sits behind the first: v0.5.0 spoofs the SDCP
FirmwareVersionto a bare1.4.49for ElegooSlicer, and Home Assistant'selegoo_printerintegration only creates the OpenCentauri-only extrusion sensors when that string carries anOC/Omarker (Printer._is_open_centauri→printer.open_centauri→PRINTER_STATUS_FDM_OPEN_CENTAURI). With the spoof in place HA never registers the entities at all, so fixing the hook alone still leaves Spoolman empty.Approach
Four commits:
07d34bere-hooks the real broadcast site, moves the scratch doubles out of stock PRNG state into reserved private BSS, and grows the RW segment allocation (.bss,p_memsz, and the four exported end symbols) instead of borrowing cells the stock binary still uses. It preserves harpua555's signed-difference contract from PR Feature/report filament usage #40 and validates every guarded region before writing a byte.3d64646addsTOOLS/check_filament_usage.py, a bounded read-only SDCP observer adapted from lp55's PR feat: stage OpenCentauri v0.5.0 integration for firmware 1.4.49 #106 procedure, plus the 1.4.49 docs rewrite.5c67124reports1.4.49 OCfrom the slicer spoof cave instead of1.4.49: the leading version keeps ElegooSlicer recognising the firmware, the marker keeps HA on the OpenCentauri entity set. The cave grows 8 → 11 bytes and still ends ahead of thewait_for_chamber_temptrampoline at0x004517f0. The spoof patch now validates all four regions up front and refuses a non-zero cave instead of warning.8a7d9f1addsOC_VERSION='0.5.1'tofirmware-editions/patchedand honours it inTOOLS/firmware_version.py, so release builds report0.5.1-ocinstead of<last tag>-<commit count>-oc. ThevX.Y.Z-integratebeta path still takes precedence.Tests
16 tests, all passing(needsunicorn, plusarm-linux-gnueabihf-{as,ld,objcopy}andbspatchfor the firmware tests):tests/test_report_filament_usage.pyexecutes the original 1.1.40 trampoline and the new port under Unicorn with a mocked native JSON-number helper and asserts they emit the same(TotalLayer, TotalExtrusion, CurrentExtrusion)sequence for five PrintStats values, that no preserved register, SP, or callee-saved VFP register is clobbered, that stock PRNG cells are byte-identical afterwards, that only the declared regions change, and that every guard failure is non-mutating. The assertion was verified to fail against the pre-fix patch (sabotage run).tests/test_spoof_slicer_firmware_version.pycovers the three repointed sites, the untouched real version string, the cave contents, region confinement, non-mutating guard failures, and both halves of the client contract: the reported string still starts with1.4.49and still matches HA's OC-marker test.tests/test_firmware_version.pycovers the declared-version override, beta precedence, rejection of malformed values, and that the edition config declares0.5.1.python3 oc-patches/patch_planner.py 1.4.49 --dry-runlists the full 22-step chain with no cave overlap.Risk
V1.4.49 OC. Nothing in CI proves the slicer still accepts the longer version string. Issue patch overruns 8-byte version slot, breaking ElegooSlicer CANVAS sync / SDCP request attribute #102's thread has users depending onV1.4.49for filament sync, so this needs one flash and a sync attempt on a CC1 before release. If it misbehaves, revert5c67124alone: the hook fix is independent of it, and HA would then need a matching change on the integration side instead.0x522f04would notice; the patch map records it.OC_VERSIONhas to be bumped with each release, otherwise builds keep reporting0.5.1-oc. The edition config documents this.Not in scope
Credit: harpua555 (PR #40, original patch and signed-difference contract), lp55 (PR #106, test procedure), tomgit-coder for the report in #114.