adafruit / Adafruit_CircuitPython_HT16K33

Adafruit CircuitPython driver for the HT16K33, a LED matrix driver IC.
MIT License
41 stars 29 forks source link

Add ability to use custom characters for 7-segment display #96

Closed tekktrik closed 2 years ago

tekktrik commented 2 years ago

Spawned from Issue #79, which while addressed by PR #80 only extends to the "L" and "O" characters. This PR adds the ability to set any number of custom characters for printing/marquee on the 7-segment displays. Includes an example file.

Currently away from hardware to test, will be able to test in a few days.

ladyada commented 2 years ago

approved but i think from busio import I2C should not be behind a try except!

tekktrik commented 2 years ago

Thanks @ladyada! Is it used somewhere besides typing that I overlooked?

ladyada commented 2 years ago

pretty sure its used to connect to the device :)

FoamyGuy commented 2 years ago

busio is used for communication but it gets imported at the user code level or typically via board.I2C() inside of code.py. In this library code busio.I2C used only for typing so it's import is not needed when executing on a microcontroller which will be ignoring all of the typing.

I think it's okay to have it in the try/except in this case since it's only used for typing inside the library.

I am testing out the code / example in this PR on RP2040 Feather with a 4x7 Segment FeatherWing. It does successfully get past imports and initialization. But I'm not seeing any letters appear on the 7 segment displays. The only characters that seem to appear are the three dots at the end of "scrolling..." Those dots are turning on and appear to be scrolling properly but without any letters in front of them.

I'm digging in a bit to see if I can figure out why and a fix.

tekktrik commented 2 years ago

Thanks for testing @FoamyGuy. Does it not recognize they're existence entirely, or is it scrolling as if something is supposed to be there?

FoamyGuy commented 2 years ago

Thanks for testing @FoamyGuy. Does it not recognize they're existence entirely, or is it scrolling as if something is supposed to be there?

I think it is scrolling as if something is there but not showing the actual characters. The "..." appear with a large space between them. I think the space is right size for "Scrolling" but haven't specifically counted.

tekktrik commented 2 years ago

I think I'm missing some command(s), looking into it now

tekktrik commented 2 years ago

I thiiiiiiiink I might have found it @FoamyGuy, I think the index wasn't being assigned correctly in time for this new code. If you don't get a chance I'll try it in the coming days.

tekktrik commented 2 years ago

Oh, tagging Issue #94 as well.

FoamyGuy commented 2 years ago

@tekktrik nice, thank you. It does scroll more now. but it seems the new characters do not show. Only hex + numbers + 'L" and "O" I think, I haven't tried all letters but this guess based on how "Scrolling.." appears.

https://user-images.githubusercontent.com/2406189/148624145-89315050-d858-470a-83ba-edea853edeae.mp4

tekktrik commented 2 years ago

Weird, so none of the custom ones... Guess I'll dig more!

tekktrik commented 2 years ago

@FoamyGuy I added a commit to fix only the example file but the code works for me, can you retest or provide some more info so I can confirm it works or reproduce what you're seeing? Running on Adafruit CircuitPython 7.1.1 on 2022-01-14; Adafruit Pybadge with samd51j19 (odd pick, but I needed an SAMD51 and it was on the table haha)

FoamyGuy commented 2 years ago

I'm not sure what the issue was before. But it does seem to be working better now. I can see all of the new custom characters correctly now.

One issue that I'm still seeing though is on the period characters it also seems to be lighting the middle horizontal segment to the right of the dot. So it looks like it's writing ".-.-.-" instead of "..."

Here is a still image showing those: image

This image shows "g..." from the marquee of "scrolling..." in the example code.

Aside from these extra dashes everything seems to look good for me now.

Testing was done with Feather RP2040 7.2.0-alpha1.

tekktrik commented 2 years ago

Interesting... I don't think I saw that but I can double check. I'm busy today so it might not be for a couple days, thanks for checking!

tekktrik commented 2 years ago

Thanks for reviewing! Does that fix the issue? I don't have my test setup right now :/