You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
# SPDX-FileCopyrightText: 2021 ladyada for Adafruit Industries# SPDX-License-Identifier: MIT"""Simpletest example using Adafruit PyPortal. Uses the touchscreen to advance between examples."""importboardimportadafruit_touchscreenfromadafruit_pybadgerimportpybadgerimporttime# pylint: disable=invalid-name# These pins are used as both analog and digital! XL, XR and YU must be analog# and digital capable. YD just need to be digitalts=adafruit_touchscreen.Touchscreen(
board.TOUCH_XL,
board.TOUCH_XR,
board.TOUCH_YD,
board.TOUCH_YU,
calibration=((5200, 59000), (5800, 57000)),
size=(320, 240),
)
pybadger.show_badge(
name_string="Blinka", hello_scale=2, my_name_is_scale=2, name_scale=3
)
time.sleep(2)
cur_example=0prev_touch=NonewhileTrue:
p=ts.touch_pointifpandnotprev_touch:
cur_example+=1ifcur_example>=3:
cur_example=0print(cur_example)
prev_touch=pifcur_example==0:
print("Current example", cur_example)
pybadger.show_business_card(
image_name="Blinka_PyPortal.bmp",
name_string="Blinka",
name_scale=2,
email_string_one="blinka@",
email_string_two="adafruit.com",
)
elifcur_example==1:
print("Current example", cur_example)
pybadger.show_qr_code(data="https://circuitpython.org")
elifcur_example==2:
print("Current example", cur_example)
pybadger.show_badge(
name_string="Blinka", hello_scale=2, my_name_is_scale=2, name_scale=3
)
Behavior
Run from Thonny with a PyPortal.
The test code is the pybadger_pyportal_touchscreen.py example from PyBadger, modified slightly with a sleep() and some extra prints
Also, (this might be a separate issue but I'll include it here for now,) if I touch the screen before the crash and trigger the second example to be shown (the QR code) I get the following error:
Current example 0
1
Current example 1
Traceback (most recent call last):
File "<stdin>", line 50, in <module>
File "/lib/adafruit_pybadger/pybadger_base.py", line 649, in show_qr_code
TypeError: function takes 3 positional arguments but 1 were given
In relation to the second (positional arguments) error, there was something on @FoamyGuy 's stream yesterday while working on library code that was generating a positional argument error that didn't appear to relate to the code referenced https://youtu.be/0AwRphuQPys?t=5123
The example code above is not particularly efficient and is creating new displayio objects with every iteration and churning memory.
Changing the code so that it only updates the screen when required prevents the crashes in the short term.
CircuitPython version
Code/REPL
Behavior
Run from Thonny with a PyPortal.
The test code is the
pybadger_pyportal_touchscreen.py
example from PyBadger, modified slightly with asleep()
and some extraprint
sThe display locksup and triggers a slow device restart. It also locks up Thonny while this is happening.
Description
The example code above works perfectly on
6.3.0
but not on7.0.0-alpha.4
(I've not had a chance to try the previous alphas yet.)According to Thonny, line 46 is
email_string_two="adafruit.com",
fromThe only place I can find which could throw that error is in CircuitPython core in
py/vm.c
circuitpython/py/vm.c
Line 1369 in 22e8a50
Additional information
Also, (this might be a separate issue but I'll include it here for now,) if I touch the screen before the crash and trigger the second example to be shown (the QR code) I get the following error:
But line 649 is a call to a 1-parameter staticmethod defined earlier in the file.
https://github.com/adafruit/Adafruit_CircuitPython_PyBadger/blob/addfdad90fbe201616e72ad632e2c3bf965d46bf/adafruit_pybadger/pybadger_base.py#L649
https://github.com/adafruit/Adafruit_CircuitPython_PyBadger/blob/addfdad90fbe201616e72ad632e2c3bf965d46bf/adafruit_pybadger/pybadger_base.py#L618-L619
The text was updated successfully, but these errors were encountered: