code wiki / _hdl_build / nx_jam_check.nx

nx_jam_check.nx

buildroot/runtime/_hdl_build/nx_jam_check.nx

9552 B208 linesdepth 2pulls 2 transitivereach 2 importersview sourcekind librarytopic jam
docsdependenciesstructsconstsfunctions

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

nx_syscalls.nx nx_jam_check.nx nx_jam_check_test.nx nx_jam_probe.nx

imports: nx_syscalls.nx

imported by: nx_jam_check_test.nxnx_jam_probe.nx

structs

none

consts

19const JC_MAGIC_6000: i64 = 6000
20const JC_MAGIC_8000: i64 = 8000
21const JC_MAGIC_10000: i64 = 10000
22const JC_MAGIC_11500: i64 = 11500
23const JC_MAGIC_13000: i64 = 13000
24const JC_MAGIC_60000: i64 = 60000
27const JC_OK: i64 = 0
28const JC_TOO_COLD: i64 = 1 // demand > capacity at set temp, but a hotter table entry covers it
29const JC_TOO_FAST: i64 = 2 // demand > capacity even at the table's max temp -> must slow down
30const JC_NO_TEMP: i64 = 3 // extruding move before any M104/M109 -> cold extrusion = certain jam
34const JC_XSEC_MILLI: i64 = 2405
38const JC_NTAB: i64 = 5

functions

39func jc_tab_temp(i: i64) -> i64
46func jc_tab_cap(i: i64) -> i64
55func jc_capacity_milli(temp_c: i64) -> i64
71func jc_temp_for_flow(flow_milli: i64) -> i64
81func jc_isqrt(x: i64) -> i64
called by 2: jc_scanmain
99func jc_parse_milli(src: *u8, pos: *i64, n: i64) -> i64
called by 3: jc_scanmainmain
130func jc_scan(g: *u8, n: i64, out: *i64) -> i64