fix Mk4 QR codes v1 and v2; idx hint visibility fixed

This commit is contained in:
scgbckbone 2024-04-29 20:52:46 +02:00 committed by doc-hex
parent 3886fa0019
commit f42518148a
3 changed files with 10 additions and 7 deletions

View File

@ -38,6 +38,7 @@ This lists the changes in the most recent firmware, for each hardware platform.
- Bugfix: Constant `AFC_BECH32M` incorrectly set `AFC_WRAPPED` and `AFC_BECH32`.
- Bugfix: Fix inability to activate Duress Wallet as temporary seed when master seed is 12 words.
- Bugfix: Yikes when using BIP39 passphrase with temporary seed without master seed set.
- Bugfix: v1 and v2 QRs too small and not readable (fixed)
- Tweak: Force default HW settings (USB,NFC,VDisk OFF) after clone/backup is restored.
- Tweak: Cleanup in NFC code: repeated messages, "Unable to find data expectd in NDEF", removed.
- Tweak: Function button change from (6) to (0) to view change addresses in `Address Explorer`

View File

@ -328,12 +328,14 @@ class Display:
self.clear()
w = qr_data.width()
if w == 29:
# version 3 => we can double-up the pixels
XO,YO = 4, 3 # offsets
if w <= 29:
# version 1,2,3 => we can double-up the pixels
dbl = True
bw = 62
lm, tm = 2, 1 # left, top margin
lm = 5 if idx_hint else 2 # do not overlap with idx
h = w * 2
bw = h + 4 # 2 white pixels from each side
tm = (self.HEIGHT - bw) // 2
XO, YO = lm + 2, tm + 2 # two white pixel around QR
else:
# v4+ => just one pixel per module, might not be easy to read
# - vert center, left justify; text on space to right

View File

@ -531,7 +531,7 @@ def qr_quality_check():
def cap_screen_qr(cap_image):
def doit(no_history=False):
# NOTE: version=4 QR is pixel doubled to be 66x66 with 2 missing lines at bottom
# LATER: not doing that anymore; v=3 doubled, all higher 1:1 pixels (tiny)
# LATER: not doing that anymore; v={1,2,3} doubled, all higher 1:1 pixels (tiny)
global QR_HISTORY
try:
@ -552,7 +552,7 @@ def cap_screen_qr(cap_image):
if orig_img.width == 128:
# Mk3/4 - pull out just the QR, blow it up 16x
x, w = 0, 64
x, w = 2, 64
img = orig_img.crop( (x, 0, x+w, w) )
img = ImageOps.expand(img, 16, 0) # add border
img = img.resize( (256, 256))