Skip to content

Commit 2107566

Browse files
authored
Merge pull request #1623 from lesamouraipourpre/rgbmatrix
RGBMatrix: Update for CP7
2 parents 0a4665b + 62f2f2d commit 2107566

File tree

3 files changed

+9
-11
lines changed

3 files changed

+9
-11
lines changed

CircuitPython_RGBMatrix/fruit.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ def step(self):
5353
if time.monotonic_ns() > self.stop_time:
5454
self.state = BRAKING
5555
elif self.state == BRAKING:
56-
# More quickly lose speed when baking, down to speed 7
56+
# More quickly lose speed when braking, down to speed 7
5757
self.vel = max(self.vel * 85 // 100, 7)
5858

5959
# Advance the wheel according to the velocity, and wrap it around
@@ -72,7 +72,6 @@ def step(self):
7272
if self.state == BRAKING and self.vel == 7 and yyy < 4:
7373
self.pos = off * 24 * 16
7474
self.vel = 0
75-
yy = 0
7675
self.state = STOPPED
7776

7877
# Move the displayed tiles to the correct height and make sure the
@@ -87,11 +86,11 @@ def step(self):
8786
def kick(self, i):
8887
self.state = RUNNING
8988
self.vel = random.randint(256, 320)
90-
self.stop_time = time.monotonic_ns() + 3000000000 + i * 350000000
89+
self.stop_time = time.monotonic_ns() + 3_000_000_000 + i * 350_000_000
9190

9291
# Our fruit machine has 3 wheels, let's create them with a correct horizontal
9392
# (x) offset and arbitrary vertical (y) offset.
94-
g = displayio.Group(max_size=3)
93+
g = displayio.Group()
9594
wheels = []
9695
for idx in range(3):
9796
wheel = Wheel()
@@ -119,7 +118,7 @@ def all_stopped():
119118

120119
# Here's the main loop
121120
while True:
122-
# Refresh the dislpay (doing this manually ensures the wheels move
121+
# Refresh the display (doing this manually ensures the wheels move
123122
# together, not at different times)
124123
display.refresh(minimum_frames_per_second=0)
125124
if all_stopped():

CircuitPython_RGBMatrix/life.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,10 +85,10 @@ def conway(output):
8585
palette = displayio.Palette(2)
8686
tg1 = displayio.TileGrid(b1, pixel_shader=palette)
8787
tg2 = displayio.TileGrid(b2, pixel_shader=palette)
88-
g1 = displayio.Group(max_size=3, scale=SCALE)
88+
g1 = displayio.Group(scale=SCALE)
8989
g1.append(tg1)
9090
display.show(g1)
91-
g2 = displayio.Group(max_size=3, scale=SCALE)
91+
g2 = displayio.Group(scale=SCALE)
9292
g2.append(tg2)
9393

9494
# First time, show the Conway tribute

CircuitPython_RGBMatrix/scroller.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,14 +30,14 @@ def tilegrid(palette):
3030
bitmap=terminalio.FONT.bitmap, pixel_shader=palette,
3131
width=1, height=1, tile_width=6, tile_height=14, default_tile=32)
3232

33-
g = displayio.Group(max_size=2)
33+
g = displayio.Group()
3434

3535
# We only use the built in font which we treat as being 7x14 pixels
3636
linelen = (64//7)+2
3737

3838
# prepare the main groups
39-
l1 = displayio.Group(max_size=linelen)
40-
l2 = displayio.Group(max_size=linelen)
39+
l1 = displayio.Group()
40+
l2 = displayio.Group()
4141
g.append(l1)
4242
g.append(l2)
4343
display.show(g)
@@ -101,7 +101,6 @@ def scroll(t, b):
101101
l1.x = -j
102102
l2.x = -j
103103
display.refresh(minimum_frames_per_second=0)
104-
#display.refresh(minimum_frames_per_second=0)
105104

106105
# Repeatedly scroll all the pairs of lines
107106
while True:

0 commit comments

Comments
 (0)