Skip to content

Increasing the size range for QR codes #48

Closed
@whimshot

Description

@whimshot

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

        # 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?

Thanks!

colin j.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions