Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • flow3r/flow3r-firmware
  • Vespasian/flow3r-firmware
  • alxndr42/flow3r-firmware
  • pl/flow3r-firmware
  • Kari/flow3r-firmware
  • raimue/flow3r-firmware
  • grandchild/flow3r-firmware
  • mu5tach3/flow3r-firmware
  • Nervengift/flow3r-firmware
  • arachnist/flow3r-firmware
  • TheNewCivilian/flow3r-firmware
  • alibi/flow3r-firmware
  • manuel_v/flow3r-firmware
  • xeniter/flow3r-firmware
  • maxbachmann/flow3r-firmware
  • yGifoom/flow3r-firmware
  • istobic/flow3r-firmware
  • EiNSTeiN_/flow3r-firmware
  • gnudalf/flow3r-firmware
  • 999eagle/flow3r-firmware
  • toerb/flow3r-firmware
  • pandark/flow3r-firmware
  • teal/flow3r-firmware
  • x42/flow3r-firmware
  • alufers/flow3r-firmware
  • dos/flow3r-firmware
  • yrlf/flow3r-firmware
  • LuKaRo/flow3r-firmware
  • ThomasElRubio/flow3r-firmware
  • ai/flow3r-firmware
  • T_X/flow3r-firmware
  • highTower/flow3r-firmware
  • beanieboi/flow3r-firmware
  • Woazboat/flow3r-firmware
  • gooniesbro/flow3r-firmware
  • marvino/flow3r-firmware
  • kressnerd/flow3r-firmware
  • quazgar/flow3r-firmware
  • aoid/flow3r-firmware
  • jkj/flow3r-firmware
  • naomi/flow3r-firmware
41 results
Show changes
Showing
with 1034 additions and 28 deletions
import random
from st3m.input import InputController, InputState
from st3m.ui.view import BaseView
from ctx import Context
class Flow3rView(BaseView):
input: InputController
def __init__(self) -> None:
self.vm = None
self.input = InputController()
self.flowers = []
for i in range(8):
self.flowers.append(
Flower(
((random.getrandbits(16) - 32767) / 32767.0) * 200,
((random.getrandbits(16)) / 65535.0) * 240 - 120,
((random.getrandbits(16)) / 65535.0) * 400 + 25,
)
)
def think(self, ins: InputState, delta_ms: int) -> None:
super().think(ins, delta_ms)
for c in self.flowers:
c.y += (10 * delta_ms / 1000.0) * 200 / c.z
if c.y > 300:
c.y = -300
c.rot += float(delta_ms) * c.rot_speed
self.flowers = sorted(self.flowers, key=lambda c: -c.z)
def draw(self, ctx: Context) -> None:
ctx.save()
ctx.rectangle(-120, -120, 240, 240)
ctx.rgb(0.1, 0.4, 0.3)
ctx.fill()
for f in self.flowers:
f.draw(ctx)
ctx.restore()
class Flower:
def __init__(self, x: float, y: float, z: float) -> None:
self.x = x
self.y = y
self.z = z
self.rot = 0.0
self.rot_speed = (((random.getrandbits(16) - 32767) / 32767.0) - 0.5) / 800
def draw(self, ctx: Context) -> None:
ctx.save()
ctx.translate(-78 + self.x, -70 + self.y)
ctx.translate(50, 40)
ctx.rotate(self.rot)
ctx.translate(-50, -40)
ctx.scale(100 / self.z, 100.0 / self.z)
ctx.move_to(76.221727, 3.9788409).curve_to(
94.027758, 31.627675, 91.038918, 37.561293, 94.653428, 48.340473
).rel_curve_to(
25.783102, -3.90214, 30.783332, -1.52811, 47.230192, 4.252451
).rel_curve_to(
-11.30184, 19.609496, -21.35729, 20.701768, -35.31018, 32.087063
).rel_curve_to(
5.56219, 12.080061, 12.91196, 25.953973, 9.98735, 45.917643
).rel_curve_to(
-19.768963, -4.59388, -22.879866, -10.12216, -40.896842, -23.93099
).rel_curve_to(
-11.463256, 10.23025, -17.377386, 18.2378, -41.515124, 25.03533
).rel_curve_to(
0.05756, -29.49286, 4.71903, -31.931936, 10.342734, -46.700913
).curve_to(
33.174997, 77.048676, 19.482194, 71.413009, 8.8631648, 52.420793
).curve_to(
27.471602, 45.126773, 38.877997, 45.9184, 56.349456, 48.518302
).curve_to(
59.03275, 31.351935, 64.893201, 16.103886, 76.221727, 3.9788409
).close_path().rgba(
1.0, 0.6, 0.4, 0.4
).fill()
ctx.restore()
return
ctx.move_to(116.89842, 17.221179).rel_curve_to(
6.77406, 15.003357, 9.99904, 35.088466, 0.27033, 47.639569
).curve_to(
108.38621, 76.191194, 87.783414, 86.487988, 75.460015, 75.348373
).curve_to(
64.051094, 64.686361, 61.318767, 54.582827, 67.499384, 36.894251
).curve_to(
79.03955, 16.606134, 103.60918, 15.612261, 116.89842, 17.221179
).close_path().rgb(
0.5, 0.3, 0.4
).fill()
ctx.move_to(75.608612, 4.2453713).curve_to(
85.516707, 17.987709, 93.630911, 33.119248, 94.486497, 49.201225
).curve_to(
95.068862, 60.147617, 85.880014, 75.820834, 74.919761, 75.632395
).curve_to(
63.886159, 75.442695, 57.545631, 61.257211, 57.434286, 50.22254
).curve_to(
57.257291, 32.681814, 65.992688, 16.610811, 75.608612, 4.2453713
).close_path().rgb(
0.2, 0.5, 0.8
).fill()
ctx.restore()
from st3m.input import InputController, InputState
from st3m.ui import colours
from st3m.ui.view import BaseView, ViewManager
from ctx import Context
from .background import Flow3rView
from .download import DownloadView
class ConfirmationView(BaseView):
background: Flow3rView
input: InputController
url: str
name: str
author: str
def __init__(self, url: str, name: str, author: str) -> None:
self.input = InputController()
self.vm = None
self.background = Flow3rView()
self.url = url
self.name = name
self.author = author
def on_enter(self, vm: ViewManager | None) -> None:
super().on_enter(vm)
if self.vm is None:
raise RuntimeError("vm is None")
def draw(self, ctx: Context) -> None:
ctx.move_to(0, 0)
self.background.draw(ctx)
ctx.save()
ctx.rgb(*colours.WHITE)
ctx.rectangle(
-120.0,
-80.0,
240.0,
160.0,
).fill()
ctx.rgb(*colours.BLACK)
ctx.font = "Camp Font 3"
ctx.text_align = ctx.CENTER
ctx.text_baseline = ctx.MIDDLE
ctx.font_size = 16
ctx.move_to(0, -60)
ctx.text("Install")
ctx.font_size = 24
ctx.move_to(0, -30)
ctx.text(self.name)
ctx.font_size = 16
ctx.move_to(0, 0)
ctx.text("by")
ctx.font_size = 24
ctx.move_to(0, 30)
ctx.text(self.author)
ctx.font_size = 16
ctx.move_to(0, 60)
ctx.text("(Right shoulder to abort)")
ctx.restore()
def think(self, ins: InputState, delta_ms: int) -> None:
self.input.think(ins, delta_ms)
self.background.think(ins, delta_ms)
if self.vm is None:
raise RuntimeError("vm is None")
if self.input.buttons.app.middle.pressed:
self.vm.replace(
DownloadView(
url=self.url,
)
)
from st3m.input import InputController, InputState
from st3m.goose import Optional
from st3m.ui import colours
import urequests
import gzip
from utarfile import TarFile, DIRTYPE
import io
import os
from st3m.ui.view import BaseView
from ctx import Context
class DownloadView(BaseView):
response: Optional[urequests.Response]
"""
View state
1 = Init
2 = Fetching
3 = Extracting
4 = Extracting
5 = Done
"""
state: int
input: InputController
def __init__(self, url: str) -> None:
super().__init__()
self._state = 1
self._try = 1
self._url = url
self.input = InputController()
def draw(self, ctx: Context) -> None:
ctx.rgb(0, 0, 0).rectangle(-120, -120, 240, 240).fill()
ctx.save()
ctx.move_to(0, 0)
if self._state == 1 or self._state == 2:
# Fetching
ctx.rgb(*colours.WHITE)
ctx.font = "Camp Font 3"
ctx.font_size = 24
ctx.text_align = ctx.CENTER
ctx.text_baseline = ctx.MIDDLE
ctx.text("Downloading...")
self._state = 2
elif self._state == 3 or self._state == 4:
# Extracting
ctx.rgb(*colours.WHITE)
ctx.font = "Camp Font 3"
ctx.font_size = 24
ctx.text_align = ctx.CENTER
ctx.text_baseline = ctx.MIDDLE
ctx.text("Extracting...")
self._state = 4
elif self._state == 5:
# Done
ctx.move_to(0, -30)
ctx.rgb(*colours.WHITE)
ctx.font = "Camp Font 3"
ctx.font_size = 24
ctx.text_align = ctx.CENTER
ctx.text_baseline = ctx.MIDDLE
ctx.text("All done!")
ctx.move_to(0, 0)
ctx.text("The app will be")
ctx.move_to(0, 30)
ctx.text("available after reboot")
ctx.restore()
def think(self, ins: InputState, delta_ms: int) -> None:
# super().think(ins, delta_ms) # Let BaseView do its thing
self.input.think(ins, delta_ms)
if self._state == 2:
try:
print("Getting it")
self.response = urequests.get(self._url)
if self.response is not None and self.response.content is not None:
print("Got something")
self._state = 3
return
print("no content...")
except:
print("Exception")
print("Next try")
self._try += 1
elif self._state == 4:
if self.response is None:
raise RuntimeError("response is None")
tar = gzip.decompress(self.response.content)
self.response = None
t = TarFile(fileobj=io.BytesIO(tar))
for i in t:
print(i.name)
if i.type == DIRTYPE:
print("dirtype")
dirname = "/flash/sys/apps/" + i.name
if not os.path.exists(dirname):
print("making", dirname)
os.mkdir(dirname)
else:
print("dir", dirname, "exists")
else:
filename = "/flash/sys/apps/" + i.name
print("writing to", filename)
f = t.extractfile(i)
with open(filename, "wb") as of:
of.write(f.read())
self._state = 5
if self.input.buttons.app.middle.pressed:
if self.vm is None:
raise RuntimeError("vm is None")
self.vm.pop()
[app]
name = "Get Apps"
menu = "Hidden"
[entry]
class = "Gr33nhouseApp"
[metadata]
author = "Flow3r Badge Authors"
license = "LGPL-3.0-only"
url = "https://git.flow3r.garden/flow3r/flow3r-firmware"
from st3m.goose import Optional, Enum
from st3m.input import InputController, InputState
from st3m.ui import colours
from st3m.ui.view import BaseView, ViewManager
from ctx import Context
from .confirmation import ConfirmationView
from .background import Flow3rView
import math
import urequests
import time
import gc
PETAL_COLORS = [
(0, 0, 1),
(0, 1, 1),
(1, 1, 0),
(0, 1, 0),
(1, 0, 1),
]
PETAL_MAP = [0, 2, 4, 6, 8]
ONE_FIFTH = math.pi * 2 / 5
ONE_TENTH = math.pi * 2 / 10
class ViewState(Enum):
ENTER_SEED = 1
LOADING = 2
SEED_NOT_FOUND = 3
class ManualInputView(BaseView):
current_petal: Optional[int]
wait_timer: Optional[int]
def __init__(self) -> None:
self.input = InputController()
self.vm = None
self.background = Flow3rView()
self.flow3r_seed = ""
self.current_petal = None
self.wait_timer = None
self.state = ViewState.ENTER_SEED
def on_enter(self, vm: ViewManager | None) -> None:
super().on_enter(vm)
self.flow3r_seed = ""
self.state = ViewState.ENTER_SEED
if self.vm is None:
raise RuntimeError("vm is None")
def draw(self, ctx: Context) -> None:
self.background.draw(ctx)
if self.state == ViewState.ENTER_SEED:
ctx.save()
for i in range(5):
ctx.rgb(*PETAL_COLORS[i])
ctx.move_to(0, 0)
ctx.arc(0, 0, 140, -ONE_TENTH - math.pi / 2, ONE_TENTH - math.pi / 2, 0)
ctx.arc(0, 0, 80, ONE_TENTH - math.pi / 2, -ONE_TENTH - math.pi / 2, 1)
ctx.fill()
ctx.rgb(0, 0, 0)
ctx.arc(0, -100, 18, 0, math.pi * 2, 9).fill()
ctx.rgb(1, 1, 1)
ctx.move_to(0, -100)
ctx.font = "Camp Font 1"
ctx.font_size = 32
ctx.text_align = ctx.CENTER
ctx.text_baseline = ctx.MIDDLE
ctx.text(str(i))
ctx.rotate(ONE_FIFTH)
# ctx.rgb(0, 0, 0)
# ctx.arc(0, 0, 80, 0, math.pi * 2, 0).fill()
ctx.restore()
ctx.rgb(1, 1, 1)
ctx.move_to(0, 0)
ctx.font = "Camp Font 1"
ctx.font_size = 24
ctx.text_align = ctx.CENTER
ctx.text_baseline = ctx.MIDDLE
ctx.text(self.flow3r_seed)
elif self.state == ViewState.LOADING:
ctx.rgb(1, 1, 1)
ctx.font = "Camp Font 3"
ctx.font_size = 24
ctx.text_align = ctx.CENTER
ctx.text_baseline = ctx.MIDDLE
ctx.move_to(0, -12)
ctx.text(f"Loading")
ctx.move_to(0, 12)
ctx.font = "Camp Font 1"
ctx.text(self.flow3r_seed)
elif self.state == ViewState.SEED_NOT_FOUND:
ctx.rgb(1, 0, 0)
ctx.font_size = 24
ctx.text_align = ctx.CENTER
ctx.text_baseline = ctx.MIDDLE
ctx.move_to(0, -12)
ctx.font = "Camp Font 1"
ctx.text(self.flow3r_seed)
ctx.move_to(0, 12)
ctx.font = "Camp Font 3"
ctx.text(f"not found!")
def think(self, ins: InputState, delta_ms: int) -> None:
self.input.think(ins, delta_ms)
self.background.think(ins, delta_ms)
if self.state == ViewState.ENTER_SEED:
if self.current_petal is not None:
if not ins.captouch.petals[self.current_petal].pressed:
self.current_petal = None
if self.current_petal is None:
for i, petal in enumerate(PETAL_MAP):
if ins.captouch.petals[petal].pressed:
self.flow3r_seed += str(i)
self.current_petal = petal
if len(self.flow3r_seed) == 8:
self.state = ViewState.LOADING
elif self.state == ViewState.LOADING:
if self.wait_timer is None:
self.wait_timer = time.ticks_ms()
if (time.ticks_ms() - self.wait_timer) < 100:
return
self.wait_timer = None
print(f"Loading app info for seed {self.flow3r_seed}...")
res = urequests.get(
f"https://flow3r.garden/api/apps/{self.flow3r_seed}.json"
)
if res.status_code != 200:
# We are hitting RAM limits in this place. Free up
# everything we can to keep the following code from
# hitting allocation errors.
del res
gc.collect()
print(f"No app found for seed {self.flow3r_seed}!")
self.state = ViewState.SEED_NOT_FOUND
else:
if self.vm is None:
raise RuntimeError("vm is None")
app = res.json()
self.vm.push(
ConfirmationView(
url=app["tarDownloadUrl"],
name=app["name"],
author=app["author"],
)
)
elif self.state == ViewState.SEED_NOT_FOUND:
if self.wait_timer is None:
self.wait_timer = time.ticks_ms()
if (time.ticks_ms() - self.wait_timer) > 2000:
print("Please enter a new seed!")
self.flow3r_seed = ""
self.state = ViewState.ENTER_SEED
self.wait_timer = None
from st3m.input import InputController, InputState
from st3m.ui import colours
from st3m.ui.view import BaseView, ViewManager
from ctx import Context
from .background import Flow3rView
class RecordView(BaseView):
input: InputController
def __init__(self) -> None:
self.input = InputController()
self.vm = None
self.background = Flow3rView()
def on_enter(self, vm: ViewManager | None) -> None:
super().on_enter(vm)
if self.vm is None:
raise RuntimeError("vm is None")
def draw(self, ctx: Context) -> None:
ctx.move_to(0, 0)
ctx.save()
ctx.rgb(*colours.BLACK)
ctx.rectangle(
-120.0,
-120.0,
240.0,
240.0,
).fill()
ctx.rgb(*colours.WHITE)
ctx.font = "Camp Font 3"
ctx.font_size = 24
ctx.text_align = ctx.CENTER
ctx.text_baseline = ctx.MIDDLE
ctx.text("Coming soon")
ctx.restore()
def think(self, ins: InputState, delta_ms: int) -> None:
self.input.think(ins, delta_ms)
......@@ -70,6 +70,7 @@ class Configuration:
"pronouns": self.pronouns,
"pronouns_size": self.pronouns_size,
"color": self.color,
"mode": self.mode,
}
jsondata = json.dumps(d)
with open(path, "w") as f:
......
import bl00mbox
import captouch
import leds
import audio
from st3m.application import Application, ApplicationContext
from st3m.input import InputState
from st3m.goose import Tuple, Iterator, Optional, Callable, List, Any, TYPE_CHECKING
from ctx import Context
from st3m.ui.view import View, ViewManager
class TinySampler(Application):
def __init__(self, app_ctx: ApplicationContext) -> None:
super().__init__(app_ctx)
self.blm = bl00mbox.Channel("tiny sampler")
self.samplers: List[bl00mbox.patches._Patch | Any] = [None] * 5
self.line_in = self.blm.new(bl00mbox.plugins.line_in)
self.blm.volume = (
30000 # TODO: increase onboard mic line in gain and remove this
)
self.line_in.signals.gain = 30000
for i in range(5):
self.samplers[i] = self.blm.new(bl00mbox.patches.sampler, 5000)
self.samplers[i].signals.output = self.blm.mixer
self.samplers[i].signals.rec_in = self.line_in.signals.right
self.is_recording = [False] * 5
audio.input_set_source(audio.INPUT_SOURCE_ONBOARD_MIC)
self.ct_prev = captouch.read()
def _highlight_petal(self, num: int, r: int, g: int, b: int) -> None:
for i in range(7):
leds.set_rgb((4 * num - i + 3) % 40, r, g, b)
def draw(self, ctx: Context) -> None:
dist = 90
ctx.rgb(0, 0, 0).rectangle(-120, -120, 240, 240).fill()
ctx.font = ctx.get_font_name(0)
ctx.text_align = ctx.MIDDLE
ctx.font_size = 24
for i in range(5):
ctx.rgb(0.8, 0.8, 0.8)
ctx.move_to(0, -dist)
ctx.text("play" + str(i))
ctx.move_to(0, 0)
ctx.rotate(6.28 / 10)
ctx.move_to(0, -dist)
if self.is_recording[i]:
ctx.rgb(1, 0, 0)
ctx.text("rec" + str(i))
ctx.move_to(0, 0)
ctx.rotate(6.28 / 10)
def think(self, ins: InputState, delta_ms: int) -> None:
super().think(ins, delta_ms)
leds.set_all_rgb(0, 0, 0)
for i in range(5):
if self.is_recording[i]:
self._highlight_petal(i * 2, 255, 0, 0)
else:
self._highlight_petal(i * 2, 0, 255, 0)
leds.update()
ct = captouch.read()
for i in range(5):
if ct.petals[i * 2].pressed and not self.ct_prev.petals[i * 2].pressed:
if not self.is_recording[i]:
self.samplers[i].signals.trigger.start()
for i in range(5):
if (
ct.petals[(i * 2) + 1].pressed
and not self.ct_prev.petals[(i * 2) + 1].pressed
):
if not self.is_recording[i]:
self.samplers[i].signals.rec_trigger.start()
self.is_recording[i] = True
if (
not ct.petals[(i * 2) + 1].pressed
and self.ct_prev.petals[(i * 2) + 1].pressed
):
if self.is_recording[i]:
self.samplers[i].signals.rec_trigger.stop()
self.is_recording[i] = False
self.ct_prev = ct
[app]
name = "tiny sampler"
menu = "Music"
[entry]
class = "TinySampler"
[metadata]
author = "Flow3r Badge Authors"
license = "LGPL-3.0-only"
url = "https://git.flow3r.garden/flow3r/flow3r-firmware"
......@@ -103,39 +103,53 @@ class sampler(_Patch):
requires a wave file. default path: /sys/samples/
"""
def __init__(self, chan, filename):
def __init__(self, chan, init_var):
# init can be filename to load into ram
super().__init__(chan)
if filename.startswith("/flash/") or filename.startswith("/sd/"):
f = wave.open(filename, "r")
elif filename.startswith("/"):
f = wave.open("/flash/" + filename, "r")
else:
f = wave.open("/flash/sys/samples/" + filename, "r")
if type(init_var) == str:
filename = init_var
if filename.startswith("/flash/") or filename.startswith("/sd/"):
f = wave.open(filename, "r")
elif filename.startswith("/"):
f = wave.open("/flash/" + filename, "r")
else:
f = wave.open("/flash/sys/samples/" + filename, "r")
self.len_frames = f.getnframes()
self.plugins.sampler = chan.new(bl00mbox.plugins._sampler_ram, self.len_frames)
self.len_frames = f.getnframes()
self.plugins.sampler = chan.new(
bl00mbox.plugins._sampler_ram, self.len_frames
)
assert f.getsampwidth() == 2
assert f.getnchannels() in (1, 2)
assert f.getcomptype() == "NONE"
assert f.getsampwidth() == 2
assert f.getnchannels() in (1, 2)
assert f.getcomptype() == "NONE"
if f.getnchannels() == 1:
# fast path for mono
table = self.plugins.sampler.table_bytearray
for i in range(0, self.len_frames * 2, 100):
table[i : i + 100] = f.readframes(50)
if f.getnchannels() == 1:
# fast path for mono
table = self.plugins.sampler.table_bytearray
for i in range(0, self.len_frames * 2, 100):
table[i : i + 100] = f.readframes(50)
else:
# somewhat fast path for stereo
table = self.plugins.sampler.table_int16_array
for i in range(self.len_frames):
frame = f.readframes(1)
value = int.from_bytes(frame[0:2], "little")
table[i] = value
f.close()
self._filename = filename
else:
# somewhat fast path for stereo
table = self.plugins.sampler.table_int16_array
for i in range(self.len_frames):
frame = f.readframes(1)
value = int.from_bytes(frame[0:2], "little")
table[i] = value
f.close()
self._filename = filename
self.len_frames = int(48 * init_var)
self.plugins.sampler = chan.new(
bl00mbox.plugins._sampler_ram, self.len_frames
)
self._filename = ""
self.signals.trigger = self.plugins.sampler.signals.trigger
self.signals.output = self.plugins.sampler.signals.output
self.signals.rec_in = self.plugins.sampler.signals.rec_in
self.signals.rec_trigger = self.plugins.sampler.signals.rec_trigger
@property
def filename(self):
......
......@@ -18,3 +18,14 @@ def set_mute(v: bool) -> None:
def get_mute() -> bool:
pass
def input_set_source(source: int) -> None:
pass
def input_get_source() -> int:
pass
INPUT_SOURCE_NONE: int
INPUT_SOURCE_LINE_IN: int
INPUT_SOURCE_HEADSET_MIC: int
INPUT_SOURCE_ONBOARD_MIC: int
......@@ -48,6 +48,7 @@ class Channel:
mixer: "ChannelMixer"
foreground: bool
free: bool
volume: int
def __init__(self, name: str): ...
def clear(self) -> None: ...
......
def mem_free() -> int:
pass
def collect() -> None:
pass
The "typeshed" project is licensed under the terms of the Apache license, as
reproduced below.
= = = = =
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "{}"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright {yyyy} {name of copyright owner}
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
= = = = =
Parts of typeshed are licensed under different licenses (like the MIT
license), reproduced below.
= = = = =
The MIT License
Copyright (c) 2015 Jukka Lehtosalo and contributors
Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and associated documentation files (the "Software"),
to deal in the Software without restriction, including without limitation
the rights to use, copy, modify, merge, publish, distribute, sublicense,
and/or sell copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.
= = = = =
from _typeshed import Incomplete, SupportsRead, SupportsWrite
from collections.abc import Callable
from typing import Any
__version__: str
def encode(
obj: Any,
ensure_ascii: bool = ...,
double_precision: int = ...,
encode_html_chars: bool = ...,
escape_forward_slashes: bool = ...,
sort_keys: bool = ...,
indent: int = ...,
allow_nan: bool = ...,
reject_bytes: bool = ...,
default: Callable[[Incomplete], Incomplete] | None = None,
separators: tuple[str, str] | None = None,
) -> str: ...
def dumps(
obj: Any,
ensure_ascii: bool = ...,
double_precision: int = ...,
encode_html_chars: bool = ...,
escape_forward_slashes: bool = ...,
sort_keys: bool = ...,
indent: int = ...,
allow_nan: bool = ...,
reject_bytes: bool = ...,
default: Callable[[Incomplete], Incomplete] | None = None,
separators: tuple[str, str] | None = None,
) -> str: ...
def dump(
obj: Any,
fp: SupportsWrite[str],
*,
ensure_ascii: bool = ...,
double_precision: int = ...,
encode_html_chars: bool = ...,
escape_forward_slashes: bool = ...,
sort_keys: bool = ...,
indent: int = ...,
allow_nan: bool = ...,
reject_bytes: bool = ...,
default: Callable[[Incomplete], Incomplete] | None = None,
separators: tuple[str, str] | None = None,
) -> None: ...
def decode(s: str | bytes | bytearray, precise_float: bool = ...) -> Any: ...
def loads(s: str | bytes | bytearray, precise_float: bool = ...) -> Any: ...
def load(
fp: SupportsRead[str | bytes | bytearray], precise_float: bool = ...
) -> Any: ...
class JSONDecodeError(ValueError): ...
from typing import Any
class Response:
text: str
content: bytes
status_code: int
def close(self) -> None: ...
def json(self) -> Any: ...
def request(
method: str, url: str, data: Any, json: Any, headers: dict[str, str]
) -> Response: ...
def head(url: str, **kw: Any) -> Response: ...
def get(url: str, **kw: Any) -> Response: ...
def post(url: str, **kw: Any) -> Response: ...
def put(url: str, **kw: Any) -> Response: ...
def patch(url: str, **kw: Any) -> Response: ...
def delete(url: str, **kw: Any) -> Response: ...
from typing import Any
DIRTYPE = "dir"
REGTYPE = "file"
class TarInfo:
name: str
size: int
type: str
def __str__(self) -> str: ...
class TarFile:
def __init__(self, name: Any = None, fileobj: Any = None): ...
def next(self) -> TarInfo: ...
def __iter__(self) -> TarFile: ...
def __next__(self) -> TarInfo: ...
def extractfile(self, tarinfo: TarInfo) -> Any: ...
......@@ -108,6 +108,8 @@ class BundleMetadata:
try:
t = toml.load(f)
except toml.TomlDecodeError as e:
raise BundleMetadataCorrupt(str(e))
except Exception as e:
raise BundleMetadataCorrupt(str(e))
......@@ -121,7 +123,7 @@ class BundleMetadata:
if "menu" not in app or type(app["menu"]) != str:
raise BundleMetadataBroken("missing app.menu key")
self.menu = app["menu"]
if self.menu not in ["Apps", "Music", "Badge"]:
if self.menu not in ["Apps", "Music", "Badge", "Hidden"]:
raise BundleMetadataBroken("app.menu must be either Apps, Music or Badge")
self._t = t
......
......@@ -11,7 +11,7 @@ from st3m.ui.menu import (
from st3m.ui.elements import overlays
from st3m.ui.view import View, ViewManager, ViewTransitionBlend
from st3m.ui.elements.menus import SimpleMenu, SunMenu
from st3m.application import discover_bundles, BundleMetadata
from st3m.application import discover_bundles, BundleMetadata, MenuItemAppLaunch
from st3m.about import About
from st3m import settings, logging, processors, wifi
......@@ -135,6 +135,7 @@ def run_main() -> None:
[
MenuItemBack(),
MenuItemForeground("Settings", menu_settings),
MenuItemAppLaunch(BundleMetadata("/flash/sys/apps/gr33nhouse")),
MenuItemAction("Disk Mode (Flash)", machine.disk_mode_flash),
MenuItemAction("Disk Mode (SD)", machine.disk_mode_sd),
MenuItemLaunchPersistentView("About", About),
......
......@@ -41,3 +41,5 @@ CONFIG_LWIP_IPV6_MEMP_NUM_ND6_QUEUE=20
CONFIG_LWIP_IPV6_ND6_NUM_NEIGHBORS=10
CONFIG_LWIP_MULTICAST_PING=y
CONFIG_LWIP_BROADCAST_PING=y
# CONFIG_ESP_WIFI_IRAM_OPT is not set
# CONFIG_ESP_WIFI_RX_IRAM_OPT is not set