Labels encode just the lamp ID

Internal inventory labels: the QR carries L#### only, which keeps it
at version 1 (large modules, reliable at 23 mm) and means scanning a
label at the station types the ID and lands directly in the
re-measure flow.
This commit is contained in:
2026-07-09 18:16:13 +07:00
parent 719ddcf04a
commit 3ac7cd243b
+9 -6
View File
@@ -1,9 +1,10 @@
""" """
Lamp ID labels on the Brother QL-820NWB (DK-11221, 23x23 mm die-cut). Lamp ID labels on the Brother QL-820NWB (DK-11221, 23x23 mm die-cut).
Each label carries a QR code linking to the lamp's page on buildfor.life and Each label carries the lamp ID as a QR code and as text. These are internal
the lamp ID as text. The station prints two per lamp: one for the box, one inventory labels: scanning one with the station's barcode scanner types the
for the lamp itself. ID, which drops straight into the re-measure flow. The station prints two
per lamp: one for the box, one for the lamp itself.
Printer address comes from --printer or the HPCS_LABEL_PRINTER environment Printer address comes from --printer or the HPCS_LABEL_PRINTER environment
variable, e.g. tcp://192.168.1.50 (the QL-820NWB listens on port 9100). variable, e.g. tcp://192.168.1.50 (the QL-820NWB listens on port 9100).
@@ -24,7 +25,6 @@ from PIL import Image, ImageDraw, ImageFont
LABEL_ID = "23x23" # DK-11221 LABEL_ID = "23x23" # DK-11221
DOTS = (202, 202) # printable area of the 23x23 label DOTS = (202, 202) # printable area of the 23x23 label
MODEL = "QL-820NWB" MODEL = "QL-820NWB"
URL_BASE = "https://buildfor.life/comparisons/lamps/"
TEXT_HEIGHT = 52 # bottom strip for the ID text TEXT_HEIGHT = 52 # bottom strip for the ID text
@@ -38,15 +38,18 @@ def _font(size):
def render_label(lamp_id: str) -> Image.Image: def render_label(lamp_id: str) -> Image.Image:
"""202x202 1-bit label: QR to the lamp page on top, ID text below.""" """202x202 1-bit label: the bare lamp ID as QR on top, as text below."""
image = Image.new("1", DOTS, 1) image = Image.new("1", DOTS, 1)
# Just the ID (internal use): a 5-character QR stays at version 1, so the
# modules print large and scan reliably at 23 mm. Scanning it at the
# station types the ID and lands in the re-measure flow.
qr = qrcode.QRCode( qr = qrcode.QRCode(
error_correction=qrcode.constants.ERROR_CORRECT_M, error_correction=qrcode.constants.ERROR_CORRECT_M,
box_size=1, box_size=1,
border=2, # quiet zone; tight but fine for close-range scanning border=2, # quiet zone; tight but fine for close-range scanning
) )
qr.add_data(f"{URL_BASE}{lamp_id.lower()}/") qr.add_data(lamp_id.upper())
qr.make(fit=True) qr.make(fit=True)
modules = len(qr.get_matrix()) modules = len(qr.get_matrix())
qr_size = DOTS[1] - TEXT_HEIGHT qr_size = DOTS[1] - TEXT_HEIGHT