Commit Graph
16 Commits
Author SHA1 Message Date
jessikitty a77d42a1e4 Add Floyd-Steinberg dithering for badge photos
A thermal head has no grey, so an undithered photo gets thresholded into a
solid black mass — measured at 98% black coverage on a test portrait, against
44% once dithered.

Auto-levels first, because typical webcam captures sit in the middle of the
range and dithering those directly gives flat mush. Serpentine scan order to
avoid diagonal banding across skin tones.
2026-09-07 15:06:57 +10:00
jessikitty 1a94c33304 Document the printing subsystem
Covers the roll/job colour rule that caused the "change it to Monochrome
media" failures, the tri-state health result, and why network status is
unavailable on this hardware.
2026-09-07 14:51:04 +10:00
jessikitty cb7bcff93e Add patch script to wire printer.js to the native QL module
Replaces the brother_ql subprocess call in printBadge with printPng, and
swaps available() for a real reachability check. Uses brace matching rather
than literal body matching so it survives formatting differences, refuses to
run if the anchors are missing, is idempotent, and writes a .bak first.

The badge layout is untouched.
2026-09-07 14:50:34 +10:00
jessikitty 8d2111ff41 Align status decoding with the manual
Decodes the model code (byte 4) to a name, adds the cooling notification
values, and rewords the error-information-2 bit 0 message. That bit is a
media mismatch, which in practice means a monochrome job sent to a black/red
roll — the exact failure seen on the QL-820NWB here.
2026-09-07 14:25:53 +10:00
jessikitty b4001c97c8 Correct the command stream against Brother's raster manual
Checked against "Raster Command Reference, QL-800/810W/820NWB v1.01". Four
things were wrong, all inherited from brother_ql's older-model defaults:

- Invalidate is 400 bytes for this series, not 200.
- The print-quality bit (0x40) is documented as invalid for two-colour
  printing; it was being set regardless.
- The media-length valid bit belongs to die-cut stock only. Brother's driver
  sends 0x86 for continuous tape, and the manual warns that asserting a valid
  flag the loaded media doesn't match returns a "replace media" error.
- ESC i ! (automatic status notification) was missing, and the control codes
  now follow the manual's per-page order.

Also confirms the 62 mm geometry we were already using: 12 left margin pins,
696 print area pins, 12 right.
2026-09-07 14:25:19 +10:00
jessikitty 851e021fc2 Make printer status best effort, not a precondition
A silent printer no longer blocks printing or reports as unhealthy. printPng
returns confirmed:false when no status came back, so callers don't claim a
label came out when all we know is the bytes were delivered.
2026-09-07 14:17:47 +10:00
jessikitty abb752c3ef Treat a silent printer as normal, and flush before closing
The QL-820NWB does not report status over TCP 9100 — brother_ql documents the
same limitation for its network backend. queryStatus therefore became
probeStatus, which reports reachable-with-unknown-state instead of failing.

Also fixes a real bug: the socket was destroyed straight after write, which can
discard data still queued in the kernel send buffer and truncate a ~190 KB job.
Now half-closes with end() and waits for flush, with a grace window for units
that never send FIN.
2026-09-07 14:17:08 +10:00
jessikitty 52eb0147fd Add printPng drop-in to replace the brother_ql subprocess
Takes the PNG renderBadgePng already produces, separates black and red
planes, and sends the job over TCP. Adds a serial queue per printer host so
simultaneous sign-ins cannot collide on the printer's single connection.

Not wired into printer.js yet.
2026-09-07 14:02:01 +10:00
jessikitty 0c1ef93552 Add TCP transport for the QL printer
Connects to port 9100, sends the job and reads back status frames until the
printer reports completion or an error.
2026-09-07 14:01:33 +10:00
jessikitty 26701d0d3b Add QL status frame decoder
Decodes the 32-byte status frames so cover open, roll empty, cutter jam and
wrong roll width are reported from the printer itself rather than inferred
from brother_ql stderr.
2026-09-07 14:01:12 +10:00
jessikitty 1b4b9d662a Add native Brother QL raster command builder
Implements the QL-8xx raster protocol in Node so badge printing no longer
needs the Python brother_ql CLI. Command sequence verified byte-for-byte
against a captured QL-8xx job.
2026-09-07 14:00:47 +10:00
jessikitty 28b52145eb Printer Adjustments 2026-09-07 10:56:01 +10:00
jessikitty 511929d579 Cert Fixes 2026-09-07 10:01:49 +10:00
jessikitty fc2898083c SSL Cert Fixes 2026-09-07 09:43:36 +10:00
jessikitty 5afccaffa8 Update 2026-09-04 14:58 2026-09-04 14:58:40 +10:00
jessikitty 3278890491 Visitor sign in kiosk: multi-site, badge printing, WWCC expiry warnings, admin accounts with 2FA 2026-09-04 14:55:59 +10:00