fix(urovo): encode before geometry — the print-setup burst silences the UHF module
Every print-encode today failed its read-back with 'before: null' while a standalone /read-tag a second earlier read the chip every time, at the same media position. Bisected to the pre-read sequence itself: after the SIZE/GAP/TEAR/DIRECTION/CLS burst, UHF READ and QUERY return no bytes at all until a power-cycle. SET RIBBON OFF + FORMFEED provably do not do this. UHF WRITE commits immediately and needs no geometry, and printing works after geometry (print-test proved it), so read/write/verify now happen first on the untouched module and the print setup follows. Nothing feeds between, so the label at the antenna is the one printed. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
parent
c1801c8c34
commit
f87804de0a
@ -67,20 +67,17 @@ def do_print(body, encode):
|
|||||||
return {'ok': False, 'error': str(e)}
|
return {'ok': False, 'error': str(e)}
|
||||||
|
|
||||||
with LOCK, Urovo() as p:
|
with LOCK, Urovo() as p:
|
||||||
# 1) direct thermal. Wait out transient busy states before feeding to clear,
|
# ENCODE BEFORE GEOMETRY. Order matters on this firmware, and it cost most of a day:
|
||||||
# so we don't waste a label on a momentary post-print code.
|
# the SIZE/GAP/TEAR/DIRECTION/CLS burst that sets up a print silences the UHF module
|
||||||
p.ribbon_off()
|
# -- every UHF READ/QUERY afterwards returns no bytes at all until a power-cycle --
|
||||||
time.sleep(0.4)
|
# so an encode placed after it always failed its own read-back with "before: null",
|
||||||
if p.wait_ready(3.0) != 0x00:
|
# which looks exactly like a chip that never reached the antenna. It had. The module
|
||||||
st = p.recover()
|
# was fine right up until the geometry went out (a standalone /read-tag a second
|
||||||
if st != 0x00:
|
# earlier read the chip every time; SET RIBBON OFF + FORMFEED provably do not kill
|
||||||
return {'ok': False, 'error': 'printer not ready',
|
# it). UHF WRITE commits immediately and needs no geometry, and printing works fine
|
||||||
'status': st, 'statusText': status_text(st)}
|
# AFTER geometry, so: read, write, verify on the untouched module first; only then
|
||||||
|
# set up the print. Nothing feeds in between, so the label at the antenna is the one
|
||||||
# 2) geometry, then the artwork
|
# that prints.
|
||||||
geometry(p, prof)
|
|
||||||
p.cls()
|
|
||||||
|
|
||||||
before = verified = None
|
before = verified = None
|
||||||
if encode:
|
if encode:
|
||||||
# Deliberately NO `SET RFID` here. It was tried as an "arm the radio first" step and
|
# Deliberately NO `SET RFID` here. It was tried as an "arm the radio first" step and
|
||||||
@ -100,6 +97,18 @@ def do_print(body, encode):
|
|||||||
return {'ok': False, 'error': 'RFID encode failed verification',
|
return {'ok': False, 'error': 'RFID encode failed verification',
|
||||||
'epc': epc, 'epcBefore': before, 'readBack': p.read_uhf(),
|
'epc': epc, 'epcBefore': before, 'readBack': p.read_uhf(),
|
||||||
'note': 'nothing printed -- no label wasted'}
|
'note': 'nothing printed -- no label wasted'}
|
||||||
|
# 1) direct thermal. Wait out transient busy states before feeding to clear,
|
||||||
|
# so we don't waste a label on a momentary post-print code.
|
||||||
|
p.ribbon_off()
|
||||||
|
time.sleep(0.4)
|
||||||
|
if p.wait_ready(3.0) != 0x00:
|
||||||
|
st = p.recover()
|
||||||
|
if st != 0x00:
|
||||||
|
return {'ok': False, 'error': 'printer not ready',
|
||||||
|
'status': st, 'statusText': status_text(st)}
|
||||||
|
# 2) geometry, then the artwork -- AFTER the encode, see above
|
||||||
|
geometry(p, prof)
|
||||||
|
p.cls()
|
||||||
p.write(label.to_tspl(label.render(body, prof)))
|
p.write(label.to_tspl(label.render(body, prof)))
|
||||||
|
|
||||||
# 4) re-assert ribbon-off immediately before firing
|
# 4) re-assert ribbon-off immediately before firing
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user