Skip to content
Snippets Groups Projects
Commit 21db1238 authored by rahix's avatar rahix Committed by q3k
Browse files

py: Add the mpremote compat line to all apps

Add a main-guarded `st3m.run.run_view()` call to all apps in the
preload.  This allows them to be run via `mpremote run`.
parent 5bbdae56
No related branches found
No related tags found
No related merge requests found
......@@ -59,5 +59,6 @@ class Clouds(Application):
c.draw(ctx)
# uncomment to make runnable via mpremote
# st3m.run.run_view(Clouds(ApplicationContext()))
# For running with `mpremote run`:
if __name__ == "__main__":
st3m.run.run_view(Clouds(ApplicationContext()))
......@@ -80,3 +80,10 @@ class CapTouchDemo(Application):
# log.info("Performing captouch autocalibration")
# captouch.calibration_request()
# self.last_calib = 50
# For running with `mpremote run`:
if __name__ == "__main__":
import st3m.run
st3m.run.run_view(CapTouchDemo(ApplicationContext()))
......@@ -79,3 +79,10 @@ class HarmonicApp(Application):
k = int(i / 2)
self.synths[k].signals.trigger.stop()
self.cp_prev = cts
# For running with `mpremote run`:
if __name__ == "__main__":
import st3m.run
st3m.run.run_view(HarmonicApp(ApplicationContext()))
......@@ -37,3 +37,10 @@ class IMUDemo(Application):
else:
self.v_x = 0
self.v_y = 0
# For running with `mpremote run`:
if __name__ == "__main__":
import st3m.run
st3m.run.run_view(IMUDemo(ApplicationContext()))
......@@ -112,3 +112,10 @@ class MelodicApp(Application):
def think(self, ins: InputState, delta_ms: int) -> None:
super().think(ins, delta_ms)
run(self.input)
# For running with `mpremote run`:
if __name__ == "__main__":
import st3m.run
st3m.run.run_view(MelodicApp(ApplicationContext()))
......@@ -70,3 +70,10 @@ class ScrollDemo(Application):
def think(self, ins: InputState, delta_ms: int) -> None:
super().think(ins, delta_ms)
self.scroll.update(self.input.captouch.petals[self.PETAL_NO].gesture, delta_ms)
# For running with `mpremote run`:
if __name__ == "__main__":
import st3m.run
st3m.run.run_view(ScrollDemo(ApplicationContext()))
......@@ -140,3 +140,10 @@ class Worm:
self.direction = -math.atan2(dy, dx)
self.mutate()
self._lastdist = dist
# For running with `mpremote run`:
if __name__ == "__main__":
import st3m.run
st3m.run.run_view(AppWorms(ApplicationContext()))
......@@ -194,6 +194,8 @@ class LEDPainter(Application):
self.b = 255
# if __name__ == '__main__':
# # Continue to make runnable via mpremote run.
# st3m.run.run_view(LEDPainter(ApplicationContext()))
# For running with `mpremote run`:
if __name__ == "__main__":
import st3m.run
st3m.run.run_view(LEDPainter(ApplicationContext()))
......@@ -4,7 +4,6 @@ from st3m.goose import Dict, Any
from st3m.input import InputState
from ctx import Context
import leds
import st3m.run
import json
import math
......@@ -89,5 +88,8 @@ class NickApp(Application):
self._led = 0
# For running with `mpremote run`:
if __name__ == "__main__":
import st3m.run
st3m.run.run_view(NickApp(ApplicationContext()))
......@@ -240,3 +240,10 @@ class ShoegazeApp(Application):
if self.blm is not None:
self.blm.free = True # yeeting the channel in the backend
self.blm = None
# For running with `mpremote run`:
if __name__ == "__main__":
import st3m.run
st3m.run.run_view(ShoegazeApp(ApplicationContext()))
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment