Skip to main content

Module core

Module core 

Source
Expand description

core — pure, I/O-free protocol logic. This is the main test surface: every item here is unit-testable without a network or a real printer.

Submodules are added one TDD slice at a time.

Modules§

capability
Firmware capability / quirk registry.
command
MQTT command envelopes — the JSON published to device/{serial}/request.
firmware
Printer firmware versions.
hms
HMS (Health Management System) error decoding.
model
Printer models and their canonical device codes.
park
Pure, online “parked frame per layer” detector — the I/O-free core of the smooth timelapse, ported from the validated Python live_mine_smooth.py so bambu serve can drive it in-process (one ffmpeg as the only external tool; no python3 runtime).
project
Pure inspection of a sliced .gcode.3mf (a ZIP), and verification of caller-asserted expectations (--expect-md5 / --expect-plate).
report
Printer report state and the pushall→delta merge engine.
safety
Static safety checks for raw G-code before it is sent.
session
Verify-by-reread orchestration, I/O-free.
stage
Print-stage decoding (stg_cur).
start
Building the print-start command from resolved parameters — the one place the CLI and the serve agree on how a .3mf/.gcode becomes a project_file / gcode_file. Pure (no I/O): the caller resolves the on-printer path, parses the AMS map, and (optionally) inspects the plate; this just renders the command, folding in the plate-gcode md5 when an inspection is available so the printer can verify the file it is about to print.
status
A typed view over the merged report state.
timelapse
Pure per-layer timelapse capture state machine, shared by the CLI (bambu timelapse capture) and the server’s serve-internal runner.
verify
Effect-verification predicates — “did the command actually take effect?”
version
Parsed info.get_version response — the printer’s module/firmware inventory.