nx_gcode_emit_test.nx
buildroot/runtime/nx_gcode_emit_test.nx
about
nx_gcode_emit_test.nx -- end-to-end compose: hand-built unit
square contour + Qidi X-Max 3 + Generic PLA -> emit full G-code
file structure (preamble + layer + postamble) + verify the output
contains expected G-code keywords.
Closed-form invariants:
(a) Emitter constructs OK; filament_xsect precomputed sane
(positive Q14 value, ~39408 for 1.75mm filament).
(b) Preamble emits successfully; output contains "M104 S215"
(Generic PLA first-layer hotend) and "G28" (home all).
(c) Per-layer emit produces non-zero output length growth.
(d) Output contains "G1 X" (print moves).
(e) Output contains "E" (extruder accumulation).
(f) Postamble adds "M104 S0" (hotend off) and "M84" (motors off).
(g) E_acc_q14 is non-zero after layer emit (filament was fed).
(h) E_acc_q14 ~= perimeter_mm * E_per_mm; for a 1mm square
perimeter = 4mm, E_per_mm ~= 0.0333 mm filament/mm move,
so total E ~= 0.1332 mm ~= 2182 Q14 (±100 tolerance).
(i) Final length is reasonable (200..10000 bytes for this case).
expect_exit: 0
license_tier: ORIGINAL
dependencies 7 imports · 0 importers
imports: nx_syscalls.nxnx_polygon.nxnx_slice_contour.nxnx_machine_graph.nxnx_material_profile.nxnx_gcode_emit.nxnx_gcode_extrude.nx
imported by: nobody (leaf or entry point)
call flow from main pre-order; caps 40 nodes / depth 6 declared; ↻ = already shown
structs
| none |
consts
| 32 | const Q14: i64 = 16384 |
functions
| 35 | func smoke_contains(buf: *u8, len: i64, needle: *u8) -> i64 called by 1: main |
| 54 | func main() -> i64 |