summaryrefslogtreecommitdiff
path: root/wasp/apps/testapp.py
diff options
context:
space:
mode:
authorDaniel Thompson <daniel@redfelineninja.org.uk>2020-04-11 19:14:30 (GMT)
committerDaniel Thompson <daniel@redfelineninja.org.uk>2020-04-11 19:15:02 (GMT)
commitf68eb610c5d77bb71d3952e0dc9ca70a472ebfae (patch)
treeca0b7a1174dc7e7013ce5e67fc18231d1d6ea0c3 /wasp/apps/testapp.py
parent8cf9369efa9083cccee36e7596d52e12ace362d3 (diff)
wasp: On-device crash reporting
If an application crashes let's report it on the device so it can be distinguished from a hang (if nothing else it should mean we get better bug reports).
Diffstat (limited to 'wasp/apps/testapp.py')
-rw-r--r--wasp/apps/testapp.py22
1 files changed, 21 insertions, 1 deletions
diff --git a/wasp/apps/testapp.py b/wasp/apps/testapp.py
index 789454f..0df4ee7 100644
--- a/wasp/apps/testapp.py
+++ b/wasp/apps/testapp.py
@@ -12,7 +12,7 @@ class TestApp():
ICON = icons.app
def __init__(self):
- self.tests = ('Touch', 'String', 'Button', 'Crash', 'RLE')
+ self.tests = ('Touch', 'String', 'Wrap', 'Button', 'Crash', 'RLE')
self.test = self.tests[0]
self.scroll = wasp.widgets.ScrollIndicator()
@@ -56,6 +56,8 @@ class TestApp():
event[1], event[2]), 0, 108, width=240)
elif self.test == 'String':
self.benchmark_string()
+ elif self.test == 'Wrap':
+ self.benchmark_wrap()
elif self.test == 'RLE':
self.benchmark_rle()
@@ -88,6 +90,24 @@ class TestApp():
del t
draw.string('{}s'.format(elapsed / 1000000), 12, 24+192)
+ def benchmark_wrap(self):
+ draw = wasp.watch.drawable
+ draw.fill(0, 0, 30, 240, 240-30)
+ self.scroll.draw()
+ t = machine.Timer(id=1, period=8000000)
+ t.start()
+ draw = wasp.watch.drawable
+ s = 'This\nis a very long string that will need to be wrappedinmultipledifferentways!'
+ chunks = draw.wrap(s, 240)
+
+ for i in range(len(chunks)-1):
+ sub = s[chunks[i]:chunks[i+1]].rstrip()
+ draw.string(sub, 0, 48+24*i)
+ elapsed = t.time()
+ t.stop()
+ del t
+ draw.string('{}s'.format(elapsed / 1000000), 12, 24+192)
+
def draw(self):
"""Redraw the display from scratch."""
wasp.watch.display.mute(True)