Skip to content

In internal functions _auto_write should be touched after input validation #90

Closed
@Docteh

Description

@Docteh

I've got a 7 segment display on my desk at the moment, and I noticed that display.autowrite gets set to False if the _number function is unhappy

from adafruit_ht16k33.segments import Seg7x4
display = Seg7x4(i2c)
>>> display.auto_write=True
>>> display.auto_write
True
>>> display.fill(0)
>>> display.print(1234)
>>> display.print(12345)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "adafruit_ht16k33/segments.py", line 146, in print
  File "adafruit_ht16k33/segments.py", line 220, in _number
ValueError: Input overflow - 12345 is too large for the display!
>>> display.auto_write
False
>>>

Noting this down for later. I see that under certain circumstances the _number function will do a fill but I'm not clear on the logic

https://github.com/adafruit/Adafruit_CircuitPython_HT16K33/blame/97937addac8fb392b8e5074acfaf69dc7efec58f/adafruit_ht16k33/segments.py#L214-L227

Seems like print()ing a number used to print to a cleared display, and now it doesn't.

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