adafruit / Adafruit_CircuitPython_seesaw

seesaw helper IC driver for circuitPython
MIT License
60 stars 35 forks source link

Error message prints wrong number system #128

Open scirelli opened 7 months ago

scirelli commented 7 months ago

Lines 161-164 In the raised error the message adds a 0x to the self.chip_id which is in decimal. In my case the error message read

RuntimeError: Seesaw hardware ID returned 0x67 is not correct! Please check your wiring.

The 67 decimal, which is 0x43 in hex.

caternuson commented 7 months ago

Looks like this happened when changing to F string format done in this PR: https://github.com/adafruit/Adafruit_CircuitPython_seesaw/pull/118/files

The previous format syntax included {:x} to format the result as hex. A similar format specifier is missing in the current library's f-string syntax.

It's a simple fix though:

>>> foo = 67
>>> f"0x{foo}"
'0x67'
>>> f"0x{foo:x}"
'0x43'
>>> 
scirelli commented 7 months ago

I can create a PR to fix it