Skip to content
Snippets Groups Projects
Commit d3ac662c authored by moon2's avatar moon2 :speech_balloon:
Browse files

captouch demo: fixed OS integration issues

note to self don't just test with mpremote run :3
parent 202895e3
No related branches found
No related tags found
No related merge requests found
...@@ -39,11 +39,14 @@ class CapTouchDemo(Application): ...@@ -39,11 +39,14 @@ class CapTouchDemo(Application):
self.last_calib = None self.last_calib = None
self.state = 0 self.state = 0
self.timer = 0 self.timer = 0
self.button = 0 self.button = None
def think(self, ins: InputState, delta_ms: int) -> None: def think(self, ins: InputState, delta_ms: int) -> None:
super().think(ins, delta_ms) super().think(ins, delta_ms)
if self.button is not None:
press_event = (self.button != ins.buttons.app) and ins.buttons.app press_event = (self.button != ins.buttons.app) and ins.buttons.app
else:
press_event = False
self.button = int(ins.buttons.app) self.button = int(ins.buttons.app)
if press_event: if press_event:
print(self.button) print(self.button)
...@@ -116,6 +119,10 @@ class CapTouchDemo(Application): ...@@ -116,6 +119,10 @@ class CapTouchDemo(Application):
ctx.rgb(1.0, 0.5, 0.2) ctx.rgb(1.0, 0.5, 0.2)
ctx.text("calibrating...") ctx.text("calibrating...")
def on_enter(self, vm: Optional[ViewManager]) -> None:
super().on_enter(vm)
self.button = None
# For running with `mpremote run`: # For running with `mpremote run`:
if __name__ == "__main__": if __name__ == "__main__":
......
...@@ -3,7 +3,7 @@ name = "captouch demo" ...@@ -3,7 +3,7 @@ name = "captouch demo"
category = "Apps" category = "Apps"
[entry] [entry]
class = "App" class = "CapTouchDemo"
[metadata] [metadata]
author = "Flow3r Badge Authors" author = "Flow3r Badge Authors"
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment