From 62f2f2d9a0cd3f41d6e57dc12a1f52eb734ec489 Mon Sep 17 00:00:00 2001 From: James Carr Date: Wed, 21 Jul 2021 23:06:02 +0100 Subject: [PATCH] Remove usage of max_size from displayio.Group --- CircuitPython_RGBMatrix/fruit.py | 9 ++++----- CircuitPython_RGBMatrix/life.py | 4 ++-- CircuitPython_RGBMatrix/scroller.py | 7 +++---- 3 files changed, 9 insertions(+), 11 deletions(-) diff --git a/CircuitPython_RGBMatrix/fruit.py b/CircuitPython_RGBMatrix/fruit.py index 712bf2152..697f4a1be 100644 --- a/CircuitPython_RGBMatrix/fruit.py +++ b/CircuitPython_RGBMatrix/fruit.py @@ -53,7 +53,7 @@ def step(self): if time.monotonic_ns() > self.stop_time: self.state = BRAKING elif self.state == BRAKING: - # More quickly lose speed when baking, down to speed 7 + # More quickly lose speed when braking, down to speed 7 self.vel = max(self.vel * 85 // 100, 7) # Advance the wheel according to the velocity, and wrap it around @@ -72,7 +72,6 @@ def step(self): if self.state == BRAKING and self.vel == 7 and yyy < 4: self.pos = off * 24 * 16 self.vel = 0 - yy = 0 self.state = STOPPED # Move the displayed tiles to the correct height and make sure the @@ -87,11 +86,11 @@ def step(self): def kick(self, i): self.state = RUNNING self.vel = random.randint(256, 320) - self.stop_time = time.monotonic_ns() + 3000000000 + i * 350000000 + self.stop_time = time.monotonic_ns() + 3_000_000_000 + i * 350_000_000 # Our fruit machine has 3 wheels, let's create them with a correct horizontal # (x) offset and arbitrary vertical (y) offset. -g = displayio.Group(max_size=3) +g = displayio.Group() wheels = [] for idx in range(3): wheel = Wheel() @@ -119,7 +118,7 @@ def all_stopped(): # Here's the main loop while True: - # Refresh the dislpay (doing this manually ensures the wheels move + # Refresh the display (doing this manually ensures the wheels move # together, not at different times) display.refresh(minimum_frames_per_second=0) if all_stopped(): diff --git a/CircuitPython_RGBMatrix/life.py b/CircuitPython_RGBMatrix/life.py index f91f8d210..8e2552704 100644 --- a/CircuitPython_RGBMatrix/life.py +++ b/CircuitPython_RGBMatrix/life.py @@ -85,10 +85,10 @@ def conway(output): palette = displayio.Palette(2) tg1 = displayio.TileGrid(b1, pixel_shader=palette) tg2 = displayio.TileGrid(b2, pixel_shader=palette) -g1 = displayio.Group(max_size=3, scale=SCALE) +g1 = displayio.Group(scale=SCALE) g1.append(tg1) display.show(g1) -g2 = displayio.Group(max_size=3, scale=SCALE) +g2 = displayio.Group(scale=SCALE) g2.append(tg2) # First time, show the Conway tribute diff --git a/CircuitPython_RGBMatrix/scroller.py b/CircuitPython_RGBMatrix/scroller.py index 4fdabb4a0..9ecb233d1 100644 --- a/CircuitPython_RGBMatrix/scroller.py +++ b/CircuitPython_RGBMatrix/scroller.py @@ -30,14 +30,14 @@ def tilegrid(palette): bitmap=terminalio.FONT.bitmap, pixel_shader=palette, width=1, height=1, tile_width=6, tile_height=14, default_tile=32) -g = displayio.Group(max_size=2) +g = displayio.Group() # We only use the built in font which we treat as being 7x14 pixels linelen = (64//7)+2 # prepare the main groups -l1 = displayio.Group(max_size=linelen) -l2 = displayio.Group(max_size=linelen) +l1 = displayio.Group() +l2 = displayio.Group() g.append(l1) g.append(l2) display.show(g) @@ -101,7 +101,6 @@ def scroll(t, b): l1.x = -j l2.x = -j display.refresh(minimum_frames_per_second=0) - #display.refresh(minimum_frames_per_second=0) # Repeatedly scroll all the pairs of lines while True: