logo: Gather together the bitmaps into a single variable
The PineTime demo will also now cycle through both the Pine64 and MicroPython logos.
This commit is contained in:
parent
06b8730af8
commit
8f231430b3
3 changed files with 49 additions and 26 deletions
32
wasp/demo.py
32
wasp/demo.py
|
@ -1,8 +1,14 @@
|
||||||
# Simple alternating logo demo
|
#
|
||||||
|
# Logo demo for PineTime
|
||||||
|
#
|
||||||
|
# This demo is simply an alternating sweep of the Pine64 and
|
||||||
|
# MicroPython logos. It cycles through a variety of colours
|
||||||
|
# and swaps between the logos every 5 images (so make sure
|
||||||
|
# len(colors) is not a multiple of 5 ;-) ).
|
||||||
|
#
|
||||||
|
|
||||||
import pinetime, logo, time
|
import pinetime, logo, time, gc
|
||||||
|
|
||||||
def run():
|
|
||||||
colors = (
|
colors = (
|
||||||
0xffff,
|
0xffff,
|
||||||
0xf800, # red
|
0xf800, # red
|
||||||
|
@ -18,10 +24,26 @@ def run():
|
||||||
0xf81f, # magenta
|
0xf81f, # magenta
|
||||||
)
|
)
|
||||||
|
|
||||||
|
# Let's keep this where we can find it if someone delivers ^C to the
|
||||||
|
# demo
|
||||||
tft = pinetime.st7789()
|
tft = pinetime.st7789()
|
||||||
|
|
||||||
|
def run():
|
||||||
|
l = logo.pine64
|
||||||
|
i = 0
|
||||||
|
|
||||||
while True:
|
while True:
|
||||||
for c in colors:
|
for c in colors:
|
||||||
tft.rleblit(logo.sx, logo.sy, logo.image, fg=c)
|
if i < 5:
|
||||||
time.sleep(2)
|
i += 1
|
||||||
|
else:
|
||||||
|
i = 0
|
||||||
|
if l == logo.pine64:
|
||||||
|
l = logo.micropython
|
||||||
|
else:
|
||||||
|
l = logo.pine64
|
||||||
|
tft.fill(0)
|
||||||
|
|
||||||
|
tft.rleblit(l, fg=c)
|
||||||
|
time.sleep(2)
|
||||||
|
gc.collect()
|
||||||
|
|
|
@ -83,7 +83,8 @@ class ST7789(object):
|
||||||
for y in range(self.height):
|
for y in range(self.height):
|
||||||
self.write_data(self.linebuffer)
|
self.write_data(self.linebuffer)
|
||||||
|
|
||||||
def rleblit(self, sx, sy, image, fg=0xffff, bg=0):
|
def rleblit(self, image, fg=0xffff, bg=0):
|
||||||
|
(sx, sy, rle) = image
|
||||||
self.set_window()
|
self.set_window()
|
||||||
|
|
||||||
# TODO: rework algorithm to allow us to reuse the line buffer
|
# TODO: rework algorithm to allow us to reuse the line buffer
|
||||||
|
@ -91,7 +92,7 @@ class ST7789(object):
|
||||||
bp = 0
|
bp = 0
|
||||||
color = bg
|
color = bg
|
||||||
|
|
||||||
for rl in image:
|
for rl in rle:
|
||||||
while rl:
|
while rl:
|
||||||
buf[bp] = color >> 8
|
buf[bp] = color >> 8
|
||||||
buf[bp+1] = color & 0xff
|
buf[bp+1] = color & 0xff
|
||||||
|
|
|
@ -1,3 +1,3 @@
|
||||||
sx = 240
|
pine64 = (240, 240, b'x\x01\xee\x03\xec\x05\xea\x07\xe8\t\xe6\x0b\xe4\r\xe2\x0f\xe0\x11\xde\x13\xdc\x15\xda\x17\xd8\x19\xd6\x1b\xd4\x1d\xd2\x1f\xd1 \xcf!\xce#\xcc%\xca\'\xc8)\xc6+\xc4-\xc3-\xc6\'\xcb#\xd0\x1d\xb6\x02\x1d\x19\x1b\x03\x99\x05\x1e\x13\x1c\x05\x99\x08\x1d\x0f\x1c\x08\x98\n\x1e\t\x1d\n\x97\r\x1e\x05\x1c\r\x97\x10:\x10\x96\x126\x12\x95\x151\x15\x95\x17-\x18\x93\x1b(\x1a\x93\x1d$\x1c\x93\x1e!\x1f\x91\x1d%\x1d\x91\x1b*\x1a\x91\x19.\x19\x8f\x17\x19\x01\x19\x17\x8f\x15\x19\x05\x19\x15\x8f\x13\x19\t\x1a\x13\x8d\x12\x19\r\x1a\x11\x8d\x10\x18\x12\x1a\x10\x8c\r\x19\x17\x19\x0e\x8b\x0c\x19\x1b\x19\x0c\x8b\n\x19\x1f\x1a\n\x89\t\x18$\x1a\x08\x89\x07\x18)\x19\x06\x89\x04\x19-\x19\x05\x87\x03\x191\x19\x03\x87\x01\x186\x19\x01\x9e;\xb3?\xafC\xabG\xa6L\xa2Q\x9dU\x98Z\x94^\x90c\x8bg\x87k\x85kn\x01\x18f\x1a\x01V\x03\x19a\x1a\x03V\x05\x19]\x1a\x05V\x07\x19Y\x19\x08V\n\x18T\x1a\nV\x0c\x19O\x1a\x0cV\x0e\x19K\x19\x0fV\x11\x18G\x19\x11V\x13\x18B\x1a\x13V\x16\x18=\x19\x16V\x18\x189\x19\x18V\x1a\x185\x19\x1aV\x1c\x181\x19\x1cV\x1f\x18+\x19\x1fV!\x18\'\x19!V#\x18#\x19#V%\x18\x1f\x18&V(\x17\x1a\x19(V*\x18\x15\x19*V,\x18\x11\x18-V/\x17\r\x18/V1\x17\x08\x191V4\x17\x03\x184V6.6V8*8V:&:V= =V<"<V:&:V7+8V505V3\x19\x01\x1a3V0\x1a\x05\x1b0V.\x19\x0b\x1a.V,\x19\x0f\x1a,V)\x1a\x13\x1b)V\'\x1a\x17\x1b\'V%\x19\x1d\x1a%V#\x19!\x1a#V \x1a%\x1b V\x1e\x1a)\x1b\x1eV\x1c\x1a.\x1a\x1cV\x19\x1b2\x1b\x19V\x17\x1a7\x1b\x17V\x14\x1b<\x1a\x15V\x12\x1b@\x1b\x12V\x10\x1aE\x1b\x10V\x0e\x1aI\x1b\x0eV\x0b\x1bM\x1c\x0bV\t\x1bQ\x1c\tV\x07\x1aW\x1b\x07V\x04\x1b[\x1b\x05V\x02\x1b_\x1c\x02qc\x8ai\x85m\x81q}uyzvyZ\x03\x1cu\x1d\x03=\x04\x1cq\x1d\x04>\x06\x1cm\x1d\x06?\x08\x1ch\x1c\x08@\n\x1cd\x1c\nA\x0c\x1b_\x1c\x0cB\x0e\x1b[\x1c\x0eB\x11\x1bV\x1b\x11C\x12\x1bR\x1b\x12D\x14\x1bM\x1c\x14E\x16\x1aI\x1b\x16F\x18\x1aE\x1b\x18G\x1a\x1a?\x1b\x1aH\x1c\x1a;\x1b\x1cI\x1e\x197\x1a\x1eJ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\x02\x1d\x19\x1b\x03\x99\x05\x1e\x13\x1c\x05\x99\x08\x1d\x0f\x1c\x08\x98\n\x1e\t\x1d\n\x97\r\x1e\x05\x1c\r\x97\x10:\x10\x96\x126\x12\x95\x151\x15\x95\x17-\x18\x93\x1b(\x1a\x93\x1d$\x1c\x93\x1e!\x1f\x91\x1d%\x1d\x91\x1b*\x1a\x91\x19.\x19\x8f\x17\x19\x01\x19\x17\x8f\x15\x19\x05\x19\x15\x8f\x13\x19\t\x1a\x13\x8d\x12\x19\r\x1a\x11\x8d\x10\x18\x12\x1a\x10\x8c\r\x19\x17\x19\x0e\x8b\x0c\x19\x1b\x19\x0c\x8b\n\x19\x1f\x1a\n\x89\t\x18$\x1a\x08\x89\x07\x18)\x19\x06\x89\x04\x19-\x19\x05\x87\x03\x191\x19\x03\x87\x01\x186\x19\x01\x9e;\xb3?\xafC\xabG\xa6L\xa2Q\x9dU\x98Z\x94^\x90c\x8bg\x87k\x85kn\x01\x18f\x1a\x01V\x03\x19a\x1a\x03V\x05\x19]\x1a\x05V\x07\x19Y\x19\x08V\n\x18T\x1a\nV\x0c\x19O\x1a\x0cV\x0e\x19K\x19\x0fV\x11\x18G\x19\x11V\x13\x18B\x1a\x13V\x16\x18=\x19\x16V\x18\x189\x19\x18V\x1a\x185\x19\x1aV\x1c\x181\x19\x1cV\x1f\x18+\x19\x1fV!\x18\'\x19!V#\x18#\x19#V%\x18\x1f\x18&V(\x17\x1a\x19(V*\x18\x15\x19*V,\x18\x11\x18-V/\x17\r\x18/V1\x17\x08\x191V4\x17\x03\x184V6.6V8*8V:&:V= =V<"<V:&:V7+8V505V3\x19\x01\x1a3V0\x1a\x05\x1b0V.\x19\x0b\x1a.V,\x19\x0f\x1a,V)\x1a\x13\x1b)V\'\x1a\x17\x1b\'V%\x19\x1d\x1a%V#\x19!\x1a#V \x1a%\x1b V\x1e\x1a)\x1b\x1eV\x1c\x1a.\x1a\x1cV\x19\x1b2\x1b\x19V\x17\x1a7\x1b\x17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