code wiki / _hdl_build / nx_jam_check.nx
nx_jam_check.nx
buildroot/runtime/_hdl_build/nx_jam_check.nx
about
nx_jam_check.nx -- JAM-PHYSICS PRE-FLIGHT GATE (operator: the QIDI X-Max 3 "constantly jams";
identify WHERE the hardware is failing to prevent it, "aka too cold or what"). The #1 jam physics:
a move DEMANDS volumetric flow (mm^3/s) = extruded filament volume / move time; the hotend can only
MELT a temperature-dependent maximum. Demand > capacity -> under-extrusion -> heatbreak back-pressure
-> JAM. QIDIStudio/slicers don't gate on this; we do, per G-code line, with the exact cause and fix.
Scans G-code text: tracks M104/M109 S<temp> + G1 F/X/Y/E; for each extruding move computes
flow in MILLI-mm^3/s (integer fixed-point, 1.75mm filament cross-section = 2.405 mm^2) and
compares against a DATA-DRIVEN capacity table (Rule 11: profile data, not magic numbers).
Verdicts name the line, the demanded flow, the capacity, and the FIX (temp to set OR that
it's beyond the hotend = slow down). Also counts retraction churn (heat-creep advisory).
HONEST BOUNDARY: the PLA capacity table is PROVISIONAL (community-class values); the team's
A7 calibration print measures OUR X-Max 3's real curve and replaces the table -- the GATE
LOGIC + parser + math are exact and KAT-tested here regardless of the table values.
LAWS: struct-free, integer-only, no floats; composes with nx_klipper_gcode_validator (syntax)
as the physics gate beside it. license_tier: ORIGINAL
dependencies 1 imports · 2 importers
imports: nx_syscalls.nx
imported by: nx_jam_check_test.nxnx_jam_probe.nx
structs
| none |
consts
| 19 | const JC_MAGIC_6000: i64 = 6000 |
| 20 | const JC_MAGIC_8000: i64 = 8000 |
| 21 | const JC_MAGIC_10000: i64 = 10000 |
| 22 | const JC_MAGIC_11500: i64 = 11500 |
| 23 | const JC_MAGIC_13000: i64 = 13000 |
| 24 | const JC_MAGIC_60000: i64 = 60000 |
| 27 | const JC_OK: i64 = 0 |
| 28 | const JC_TOO_COLD: i64 = 1 // demand > capacity at set temp, but a hotter table entry covers it |
| 29 | const JC_TOO_FAST: i64 = 2 // demand > capacity even at the table's max temp -> must slow down |
| 30 | const JC_NO_TEMP: i64 = 3 // extruding move before any M104/M109 -> cold extrusion = certain jam |
| 34 | const JC_XSEC_MILLI: i64 = 2405 |
| 38 | const JC_NTAB: i64 = 5 |
functions
| 39 | func jc_tab_temp(i: i64) -> i64 |
| 46 | func jc_tab_cap(i: i64) -> i64 |
| 55 | func jc_capacity_milli(temp_c: i64) -> i64 |
| 71 | func jc_temp_for_flow(flow_milli: i64) -> i64 |
| 81 | func jc_isqrt(x: i64) -> i64 |
| 99 | func jc_parse_milli(src: *u8, pos: *i64, n: i64) -> i64 |
| 130 | func jc_scan(g: *u8, n: i64, out: *i64) -> i64 called by 2: mainmain calls 6: sys_mmapjc_parse_millijc_isqrtjc_tab_tempjc_capacity_millijc_temp_for_flow |