diff --git a/label_printer.py b/label_printer.py index ccaf052..9ebe477 100644 --- a/label_printer.py +++ b/label_printer.py @@ -1,9 +1,10 @@ """ 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 -the lamp ID as text. The station prints two per lamp: one for the box, one -for the lamp itself. +Each label carries the lamp ID as a QR code and as text. These are internal +inventory labels: scanning one with the station's barcode scanner types the +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 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 DOTS = (202, 202) # printable area of the 23x23 label MODEL = "QL-820NWB" -URL_BASE = "https://buildfor.life/comparisons/lamps/" TEXT_HEIGHT = 52 # bottom strip for the ID text @@ -38,15 +38,18 @@ def _font(size): 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) + # 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( error_correction=qrcode.constants.ERROR_CORRECT_M, box_size=1, 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) modules = len(qr.get_matrix()) qr_size = DOTS[1] - TEXT_HEIGHT