Skip to content

Automatic sizing does not attempt sizes 6-9 #27

Closed
@jamesbowman

Description

@jamesbowman

With an explicit qr_type of 9, it's possible to make a large pattern

>>> import adafruit_miniqr
>>> _q = adafruit_miniqr.QRCode(qr_type = 9)
>>> _q.add_data(b"x" * 230)
>>> _q.make()
>>> _q.matrix.width
53

But attempting to do the same with automatic sizing gives an error:

>>> import adafruit_miniqr
>>> _q = adafruit_miniqr.QRCode()
>>> _q.add_data(b"x" * 230)
>>> _q.make()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/jamesb/Adafruit_CircuitPython_miniQR/adafruit_miniqr.py", line 113, in make
    self.module_count = self.type * 4 + 17
                        ~~~~~~~~~~^~~
TypeError: unsupported operand type(s) for *: 'NoneType' and 'int'

From inspection, it looks like the code only attempts sizes 1-5.

Metadata

Metadata

Assignees

No one assigned

    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