code wiki / (root) / nx_monitor_html.nx

nx_monitor_html.nx

buildroot/runtime/nx_monitor_html.nx

14722 B261 linesdepth 3pulls 3 transitivereach 1 importersview sourcekind library
docsdependenciesstructsconstsfunctions

about

nx_monitor_html.nx -- sovereign substrate-emitted browser monitor. Emits a single static HTML+vanilla-JS page that runs in the operator's existing browser (Firefox/Chrome) and connects DIRECTLY to the Qidi's Moonraker WebSocket + camera service. No nginx, no Mainsail, no Fluidd, no Vue/React/Tailwind, no npm dependency -- every byte the browser receives is substrate-emitted text. Per NISHI_3D_PRINT_BULLETPROOF_PREFLIGHT_ROADMAP ยง2: the operator's browser IS the rendering layer until nx_browser ships native; the SUBSTRATE-side (this primitive, telemetry parsing logic, etc.) is 100% sovereign Nishi. What the emitted page does: 1. WebSocket: ws://<host>:<port>/websocket -> Moonraker subscribe to print_stats + extruder + heater_bed + gcode_move + virtual_sdcard 2. MJPEG: <img src="http://<host>:<cam_port>/?action=stream"> 3. 6 telemetry tiles: state, progress, hotend, bed, Z, ETA 4. 4 buttons: pause / resume / cancel (confirm) / EMERGENCY STOP (M112 via /printer/emergency_stop) 5. Half-print detection: JS polls every 5s, alerts if Z hasn't advanced in 2 min while printing Composes nx_moonraker_client's buffer write helpers (no duplication per [[feedback-symbol-collision-prevention-pre-write-check]]). Reuses existing operator-facing browser (third-party until nx_browser ships) for RENDERING; refuses every other third-party dependency per "no 3rd party bullshit" directive. license_tier: ORIGINAL

dependencies 2 imports · 1 importers

nx_syscalls.nx nx_moonraker_client.nx nx_monitor_html.nx nx_monitor_html_test.nx

imports: nx_syscalls.nxnx_moonraker_client.nx

imported by: nx_monitor_html_test.nx

structs

54struct NxMonitorConfig

consts

36const NX_MAGIC_7125: i64 = 7125
37const NX_MAGIC_8080: i64 = 8080
41const NX_MONITOR_OK: i64 = 0
42const NX_MONITOR_ERR_OVERFLOW: i64 = 1
43const NX_MONITOR_ERR_NULL_INPUT: i64 = 2
63const NX_MONITOR_CONFIG_BYTES: i64 = 48

functions

45func nx_monitor_verdict_name(v: i64) -> *u8
67func nx_monitor_html_emit(cfg: *NxMonitorConfig,