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
from presto import Presto
from picovector import PicoVector, Polygon, Transform, ANTIALIAS_BEST
# Setup for the Presto display
presto = Presto(layers = 1, full_res=False, ambient_light=False)
display = presto.display
vector = PicoVector(display)
vector.set_antialiasing(ANTIALIAS_BEST)
WIDTH, HEIGHT = display.get_bounds()
# Couple of colours for use later
BLACK = display.create_pen(0,0,0)
BLUE = display.create_pen(0,0, 202)
RED = display.create_pen(200,0,0)
WHITE = display.create_pen(255, 255, 255)
GREEN = display.create_pen(0,255,0)
YELLOW = display.create_pen(0,255,255)
def draw_arc(x,y,r,q,c):
# x,y = centre, r = radius, q = quadrant, c = circle position
# if centre of flow at x,y, then calculate co-ord for arc centre
# and start and end angles
if q == 1:
xpos = x-r
ypos = y-r
astart = 0
aend = 90
elif q == 2:
xpos = x+r
ypos = y-r
astart = 0
aend = -90
elif q == 3:
xpos = x+r
ypos = y+r
astart = 180
aend = 270
elif q == 4:
xpos = x-r
ypos = y+r
astart = 90
aend = 180
arc_a = Polygon()
arc_a.arc(xpos,ypos,r, astart, aend, 2)
# arc_a.circle(xpos,ypos,r,3)
vector.draw(arc_a)
# Clear the screen and use blue as the background colour
display.set_pen(BLUE)
display.clear()
display.set_pen(WHITE)
xpos=120
ypos=100
radius = 75
sc = 0.7
for i in range(1,100):
print(i)
display.set_pen(BLACK)
display.clear()
display.set_pen(RED)
print("arc 1")
draw_arc(xpos,ypos,radius,1,i)
display.set_pen(BLUE)
print("arc 2")
draw_arc(xpos,ypos,radius,2,int(i/2))
display.set_pen(GREEN)
print("arc 3")
draw_arc(xpos,ypos,radius,3,int(i/5))
display.set_pen(YELLOW)
print("arc 4")
draw_arc(xpos,ypos,radius,4,int((i*5) % 90))
presto.update()
Will cause my Presto lockup on the second run of the code after a couple of iterations through the loop.
If I don't run it under Thonny, it's OK. If I draw a circle instead of the arc, it's OK. I've tried lots of debugging and it has the "feel" of being a memory issue, but I have no direct evidence of that.
I'm using the most recent firmware:
MicroPython feature/presto-wireless, presto v0.0.5 on 2024-12-18; Presto with RP2350
The text was updated successfully, but these errors were encountered:
This has been discussed on the forums
https://forums.pimoroni.com/t/presto-picovector-issue/27032
Basically, running this code using Thonny:
Will cause my Presto lockup on the second run of the code after a couple of iterations through the loop.
If I don't run it under Thonny, it's OK. If I draw a circle instead of the arc, it's OK. I've tried lots of debugging and it has the "feel" of being a memory issue, but I have no direct evidence of that.
I'm using the most recent firmware:
The text was updated successfully, but these errors were encountered: