Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 11 additions & 4 deletions adafruit_magtag/graphics.py
Original file line number Diff line number Diff line change
Expand Up @@ -155,10 +155,17 @@ def qrcode(
import adafruit_miniqr # pylint: disable=import-outside-toplevel

# generate the QR code
qrcode = adafruit_miniqr.QRCode()
qrcode.add_data(qr_data)
qrcode.make()

for qrtype in range(1, 5):
try:
qrcode = adafruit_miniqr.QRCode(qr_type=qrtype)
qrcode.add_data(qr_data)
qrcode.make()
break
except RuntimeError:
pass
# print("Trying with larger code")
else:
raise RuntimeError("Could not make QR code")
# monochrome (2 color) palette
palette = displayio.Palette(2)
palette[0] = 0xFFFFFF
Expand Down