Skip to content
Snippets Groups Projects
Commit d6dc694d authored by iggy's avatar iggy
Browse files

debugging ctx crash

parent 6a811c0d
Branches
No related tags found
No related merge requests found
...@@ -121,7 +121,7 @@ class Application(): ...@@ -121,7 +121,7 @@ class Application():
e.set_enabled(enabled) e.set_enabled(enabled)
def on_init(self): def on_init(self):
print("nothing") print("nothing to init")
pass pass
def on_foreground(self): def on_foreground(self):
...@@ -137,7 +137,7 @@ class Application(): ...@@ -137,7 +137,7 @@ class Application():
pass pass
def main_foreground(self): def main_foreground(self):
print("nothing") #print("nothing")
pass pass
def main_always(self): def main_always(self):
......
...@@ -4,6 +4,9 @@ import math ...@@ -4,6 +4,9 @@ import math
import time import time
from math import sin,cos,pi from math import sin,cos,pi
import micropython
import gc
WIDTH = 240 WIDTH = 240
HEIGHT = 240 HEIGHT = 240
...@@ -76,6 +79,7 @@ class Icon(UIElement): ...@@ -76,6 +79,7 @@ class Icon(UIElement):
super().__init__() super().__init__()
def _draw(self,pos): def _draw(self,pos):
print("ui.Icon._draw()")
x = int(pos[0]) x = int(pos[0])
y = int(pos[1]) y = int(pos[1])
...@@ -89,6 +93,8 @@ class Icon(UIElement): ...@@ -89,6 +93,8 @@ class Icon(UIElement):
y-hs/2, y-hs/2,
hs,hs,hs//2 hs,hs,hs//2
).fill() ).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).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). #self.ctx.move_to(x,y-self.size/2).rgb(self.bg_r,self.bg_g,self.bg_b).
#.round_rectangle( #.round_rectangle(
...@@ -96,8 +102,17 @@ class Icon(UIElement): ...@@ -96,8 +102,17 @@ class Icon(UIElement):
# y-self.size/2, # y-self.size/2,
# self.size,self.size,self.size//2 # self.size,self.size,self.size//2
#).fill() #).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): class IconValue(Icon):
def __init__(self, value=0, *args, **kwargs): def __init__(self, value=0, *args, **kwargs):
super().__init__(*args, **kwargs) super().__init__(*args, **kwargs)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment