I was working on a project with a MagTag and I wanted to display a QR code MECARD as part of a nametag. When I attempted to including anything more than name, email address and a short note the code would fail. I tracked it down to this bit of code in PortalBase
# generate the QR code
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")
I changed it to for qrtype in range(1, 6): and it worked just like I wanted so I'm all good. Along the way I got to learn how to turn a .py file into an .mpy file so I consider all of this time well spent.
So I'm wondering how the particular range was selected? Maybe a memory limitation on certain boards?
I think I grabbed the range from the original PyPortal library. I'm not sure as to the why part, but if you'd like to submit a Pull Request, that would be a welcome addition.
Howdy,
This is really more of a question than an issue.
I was working on a project with a MagTag and I wanted to display a QR code MECARD as part of a nametag. When I attempted to including anything more than name, email address and a short note the code would fail. I tracked it down to this bit of code in PortalBase
I changed it to
for qrtype in range(1, 6):
and it worked just like I wanted so I'm all good. Along the way I got to learn how to turn a .py file into an .mpy file so I consider all of this time well spent.So I'm wondering how the particular range was selected? Maybe a memory limitation on certain boards?
Thanks!
colin j.