summaryrefslogtreecommitdiff
path: root/wasp/demo.py
diff options
context:
space:
mode:
authorDaniel Thompson <daniel@redfelineninja.org.uk>2020-01-23 22:00:42 (GMT)
committerDaniel Thompson <daniel@redfelineninja.org.uk>2020-01-28 18:45:26 (GMT)
commit8f231430b31cbd434ed1906ad480c5ecf20827e6 (patch)
tree6042e2533818021f7e03a0caff2d40e12645366e /wasp/demo.py
parent06b8730af80f4441635b9f16cb0c967d4074e486 (diff)
logo: Gather together the bitmaps into a single variable
The PineTime demo will also now cycle through both the Pine64 and MicroPython logos.
Diffstat (limited to 'wasp/demo.py')
-rw-r--r--wasp/demo.py62
1 files changed, 42 insertions, 20 deletions
diff --git a/wasp/demo.py b/wasp/demo.py
index b8477db..1470ff5 100644
--- a/wasp/demo.py
+++ b/wasp/demo.py
@@ -1,27 +1,49 @@
-# 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 = (
- 0xffff,
- 0xf800, # red
- 0xffff,
- 0xffe0, # yellow
- 0xffff,
- 0x07e0, # green
- 0xffff,
- 0x07ff, # cyan
- 0xffff,
- 0x001f, # blue
- 0xffff,
- 0xf81f, # magenta
- )
+colors = (
+ 0xffff,
+ 0xf800, # red
+ 0xffff,
+ 0xffe0, # yellow
+ 0xffff,
+ 0x07e0, # green
+ 0xffff,
+ 0x07ff, # cyan
+ 0xffff,
+ 0x001f, # blue
+ 0xffff,
+ 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:
for c in colors:
- tft.rleblit(logo.sx, logo.sy, logo.image, fg=c)
- time.sleep(2)
+ if i < 5:
+ 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()