Skip to content

adding support for PyPortal and a simpletest example. #33

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

Closed
wants to merge 5 commits into from

Conversation

FoamyGuy
Copy link
Contributor

Someone from discord was trying to use the pybadger library with a pyportal recently and it didn't work because it wasn't meant to be supported by this library.

I was able to add support for PyPortal as well as created and tested a modified simpletest example that works on the PyPortal with touchscreen to advance between examples instead of physical buttons.

The PyPortal has no physical buttons like the rest of the devices this library supports.

@fede2cr
Copy link

fede2cr commented Jun 13, 2020

Tested the branch on my pyportal with circuitpython 5.4 beta, and it works excellent.
I even tried the dimmer from the simple example and it works fine.

Thanks you so much for you help with this.

@FoamyGuy FoamyGuy requested a review from a team June 13, 2020 03:57
# The following is a list of the features available in other PyBadger modules but
# not available for PyPortal. If called while using a PyPortal, they will result in the
# NotImplementedError raised in the property above.
play_file = _unsupported

Choose a reason for hiding this comment

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

Why is play_file unsupported?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It wasn't left unsupported for a specific reason. I started the PyPortal class with a copy of the existing CLUE class and it got brought in as unsupported from there. I just didn't have time to work on adding it after the display stuff was working before I went to bed last night.

I will add some more commits today to add the other functionalities that are possible on this hardware.

Looking back in the CLUE file now it is setting up an AudioPWMOut object but then setting play_file as unsupported. That seems odd to me at first glance, but maybe there is a reason. I'll poke around a bit today.

# not available for PyPortal. If called while using a PyPortal, they will result in the
# NotImplementedError raised in the property above.
play_file = _unsupported
light = _unsupported

Choose a reason for hiding this comment

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

They PyPortal also has a light sensor. Can't it be supported?

Copy link

Choose a reason for hiding this comment

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

Weird. The following line does dim down the screen. I've tested it in a pybadge and the behavior seems the same.

pybadger.auto_dim_display()

Note: The dim code acts weird by itself. If you change the environment of both boards, they don't seem to react to it. It looks like it only changes the backlight once, even if it's on the loops. But seems like something for another bug request.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes I think we can support the light sensor. I will work on adding that today.

I think the auto_dim functionality uses the accelerometer in the PyBadge to check for movement and dim the display when there hasn't been any. The PyPortals do not have one so we won't be able to have it work the same way, but perhaps could be adapted to use touch or something else.

@caternuson caternuson requested a review from a team June 13, 2020 14:30
@FoamyGuy
Copy link
Contributor Author

play_file and light were actually mostly working already they just needed to not get set to _unsupported and tweak the pin for the light sensor.

The latest commits fix those and I also added a new example blinka bmp file that fits the PyPortal screen a bit better.

Thank you jerry and fede2cr for the feedback.

@FoamyGuy
Copy link
Contributor Author

#34 should be taken in favor of this. It contains the PyPortal support and example as well as some refactoring to it that took place while working on #34.

If it's preferred to have them separated let me know and we can re-open this one.

@FoamyGuy FoamyGuy closed this Jun 18, 2020
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.

3 participants