diff --git a/python_payload/application.py b/python_payload/application.py index 2c9d2bb02ca12b99b77e1a5c46126641b51db626..37402d328f2b400e5af833f7311270aa67ab404e 100644 --- a/python_payload/application.py +++ b/python_payload/application.py @@ -121,7 +121,7 @@ class Application(): e.set_enabled(enabled) def on_init(self): - print("nothing") + print("nothing to init") pass def on_foreground(self): @@ -137,7 +137,7 @@ class Application(): pass def main_foreground(self): - print("nothing") + #print("nothing") pass def main_always(self): diff --git a/python_payload/ui.py b/python_payload/ui.py index 3f42e650748b39f860bb3030848dc6d46862f64f..17ee6063512ce3adae4455be1dfed536871f71ce 100644 --- a/python_payload/ui.py +++ b/python_payload/ui.py @@ -4,6 +4,9 @@ import math import time from math import sin,cos,pi +import micropython +import gc + WIDTH = 240 HEIGHT = 240 @@ -76,6 +79,7 @@ class Icon(UIElement): super().__init__() def _draw(self,pos): + print("ui.Icon._draw()") x = int(pos[0]) y = int(pos[1]) @@ -89,6 +93,8 @@ class Icon(UIElement): y-hs/2, hs,hs,hs//2 ).fill() + + print(" arc") self.ctx.move_to(x,y).rgb(self.bg_r,self.bg_g,self.bg_b).arc(x,y,self.size/2,-math.pi,math.pi,True).fill() #self.ctx.move_to(x,y-self.size/2).rgb(self.bg_r,self.bg_g,self.bg_b). #.round_rectangle( @@ -96,8 +102,17 @@ class Icon(UIElement): # y-self.size/2, # self.size,self.size,self.size//2 #).fill() - self.ctx.rgb(1,1,1).move_to(x,y).text(self.label) - + micropython.mem_info() + gc.collect() + print(self.label) + + self.ctx.rgb(1,1,1).move_to(x,y) + micropython.mem_info("data") + print(" moved") + print(" crash here:") + self.ctx.text(self.label) + + print(" text") class IconValue(Icon): def __init__(self, value=0, *args, **kwargs): super().__init__(*args, **kwargs)