Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 11 commits into from
Feb 5, 2022
Merged

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

merged 11 commits into from
Feb 5, 2022

Conversation

tekktrik
Copy link
Member

@tekktrik tekktrik commented Jan 7, 2022

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.

@tannewt tannewt requested a review from a team January 7, 2022 18:41
@ladyada
Copy link
Member

ladyada commented Jan 7, 2022

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

@tekktrik
Copy link
Member Author

tekktrik commented Jan 7, 2022

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

@ladyada
Copy link
Member

ladyada commented Jan 7, 2022

pretty sure its used to connect to the device :)

@FoamyGuy
Copy link
Contributor

FoamyGuy commented Jan 7, 2022

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
Copy link
Member Author

tekktrik commented Jan 7, 2022

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

@@ -343,6 +350,9 @@ def _put(self, char: str, index: int = 0):
# pylint: disable=too-many-return-statements
if not 0 <= index <= 3:
return
if self._chardict and char in self._chardict:
self._set_buffer(index, self._chardict[char])
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I dug for a bit and found that it is making it to here and calling _set_buffer() with values that seem okay to me, but nothing seems to happen on the segment display. Possibly it's an auto_write issue?

I'm putting it down for now but will circle back eventually to look more if you don't end up getting a solution once you've got your hardware for testing.

@FoamyGuy
Copy link
Contributor

FoamyGuy commented Jan 7, 2022

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
Copy link
Member Author

tekktrik commented Jan 7, 2022

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

@tekktrik
Copy link
Member Author

tekktrik commented Jan 7, 2022

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
Copy link
Member Author

tekktrik commented Jan 7, 2022

Oh, tagging Issue #94 as well.

@FoamyGuy
Copy link
Contributor

FoamyGuy commented Jan 8, 2022

@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.

htk1633_scrolling.mp4

@tekktrik
Copy link
Member Author

tekktrik commented Jan 8, 2022

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

@tekktrik
Copy link
Member Author

tekktrik commented Jan 20, 2022

@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
Copy link
Contributor

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
Copy link
Member Author

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
Copy link
Member Author

tekktrik commented Feb 5, 2022

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

Copy link
Contributor

@FoamyGuy FoamyGuy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎉 The example script is working for me now. Thanks @Neradoc and @tekktrik for working on this!
tested on Feather RP2040 7.2.0-alpha.1

@FoamyGuy FoamyGuy merged commit f961ffc into adafruit:main Feb 5, 2022
adafruit-adabot added a commit to adafruit/Adafruit_CircuitPython_Bundle that referenced this pull request Feb 6, 2022
Updating https://github.com/adafruit/Adafruit_CircuitPython_HT16K33 to 4.3.0 from 4.2.1:
  > Merge pull request adafruit/Adafruit_CircuitPython_HT16K33#96 from tekktrik/feature/custom-characters
  > Merge pull request adafruit/Adafruit_CircuitPython_HT16K33#97 from tekktrik/doc/consolidate-readme
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants