@@ -63,6 +63,7 @@ def __init__(self) -> None:
63
63
super ().__init__ ()
64
64
65
65
async def on_ready (self ):
66
+ M5 .Lcd .clear ()
66
67
execfile ("main.py" )
67
68
sys .exit (0 )
68
69
@@ -212,6 +213,7 @@ async def on_exit(self):
212
213
213
214
async def _keycode_enter_event_handler (self , fw ):
214
215
print ("_keycode_enter_event_handler" )
216
+ M5 .Lcd .clear ()
215
217
execfile ("apps/" + self ._files [self ._file_pos ])
216
218
sys .exit (0 )
217
219
@@ -607,7 +609,7 @@ async def run(self):
607
609
M5 .BtnB .setCallback (type = M5 .BtnB .CB_TYPE .WAS_CLICKED , cb = self ._BtnB_wasClicked_event )
608
610
M5 .BtnB .setCallback (type = M5 .BtnB .CB_TYPE .WAS_HOLD , cb = self ._BtnB_wasHold_event )
609
611
asyncio .create_task (self .load (self ._launcher ))
610
- asyncio .create_task (self .gc_task ())
612
+ # asyncio.create_task(self.gc_task())
611
613
while True :
612
614
M5 .update ()
613
615
await asyncio .sleep_ms (100 )
@@ -620,20 +622,14 @@ async def gc_task(self):
620
622
await asyncio .sleep_ms (5000 )
621
623
622
624
def _BtnA_wasClicked_event (self , state ):
623
- asyncio .create_task (self ._BtnA_wasClicked_task (state ))
624
-
625
- async def _BtnA_wasClicked_task (self , state ):
626
- print ("_BtnA_wasClicked_task" )
625
+ print ("_BtnA_wasClicked_event" )
627
626
app = self ._apps [- 1 ]
628
- await app ._keycode_enter_event_handler (self )
627
+ asyncio . create_task ( app ._keycode_enter_event_handler (self ) )
629
628
630
629
def _BtnB_wasClicked_event (self , state ):
631
- asyncio .create_task (self ._BtnB_wasClicked_task (state ))
632
-
633
- async def _BtnB_wasClicked_task (self , state ):
634
- print ("BtnB_wasClicked_task" )
630
+ print ("_BtnB_wasClicked_event" )
635
631
app = self ._apps [- 1 ]
636
- await app ._keycode_dpad_down_event_handler (self )
632
+ asyncio . create_task ( app ._keycode_dpad_down_event_handler (self ) )
637
633
638
634
def _BtnB_wasHold_event (self , state ):
639
635
asyncio .create_task (self ._BtnB_wasHold_task (state ))
@@ -666,7 +662,4 @@ def startup(self, ssid: str, pswd: str, timeout: int = 60) -> None:
666
662
667
663
fw = Framework ()
668
664
fw .install_launcher (launcher )
669
-
670
- loop = asyncio .get_event_loop ()
671
- loop .run_until_complete (fw .run ())
672
- loop .close ()
665
+ asyncio .run (fw .run ())
0 commit comments