summaryrefslogtreecommitdiff
path: root/wasp/apps
diff options
context:
space:
mode:
authorDaniel Thompson <daniel@redfelineninja.org.uk>2020-12-12 21:35:45 (GMT)
committerDaniel Thompson <daniel@redfelineninja.org.uk>2020-12-13 16:07:24 (GMT)
commit784c9bb36d29457ddb3a5ef5af55918e1f4cd93c (patch)
treee44d31b9f8e2402b999555d0eae8ac6ad7b4fa3d /wasp/apps
parent338925b4a8e8d7ce54d0ac7e6c9c7b3bd6110737 (diff)
apps: testapp: Automatically report free memory
Signed-off-by: Daniel Thompson <daniel@redfelineninja.org.uk>
Diffstat (limited to 'wasp/apps')
-rw-r--r--wasp/apps/testapp.py15
1 files changed, 13 insertions, 2 deletions
diff --git a/wasp/apps/testapp.py b/wasp/apps/testapp.py
index 66d3fce..2b2e05b 100644
--- a/wasp/apps/testapp.py
+++ b/wasp/apps/testapp.py
@@ -5,9 +5,11 @@
~~~~~~~~~~~~~
"""
-import machine
import wasp
+
+import gc
import icons
+import machine
from apps.pager import PagerApp
@@ -23,7 +25,7 @@ class TestApp():
ICON = icons.app
def __init__(self):
- self.tests = ('Alarm', 'Button', 'Crash', 'Colours', 'Fill', 'Fill-H', 'Fill-V', 'Line', 'Notifications', 'RLE', 'String', 'Touch', 'Wrap')
+ self.tests = ('Alarm', 'Button', 'Crash', 'Colours', 'Fill', 'Fill-H', 'Fill-V', 'Free Mem', 'Line', 'Notifications', 'RLE', 'String', 'Touch', 'Wrap')
self.test = self.tests[0]
self.scroll = wasp.widgets.ScrollIndicator()
@@ -226,6 +228,15 @@ class TestApp():
for s in self._sliders:
s.draw()
self._update_colours()
+ elif self.test == 'Free Mem':
+ if wasp.watch.free:
+ draw.string("Boot: {}".format(wasp.watch.free), 12, 3*24)
+ draw.string("Init: {}".format(wasp.free), 12, 4*24)
+ draw.string("Now: {}".format(gc.mem_free()), 12, 5*24)
+ gc.collect()
+ draw.string("GC: {}".format(gc.mem_free()), 12, 6*24)
+ else:
+ draw.string("Not supported", 12, 4*24)
elif self.test == 'Notifications':
draw.string('+', 24, 100)
draw.string('-', 210, 100)