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
Commits on Source (11)
Showing
with 136 additions and 17 deletions
include("vendor/ports/esp32/boards")
include("vendor/lib/micropython-lib/python-stdlib/os-path")
include("vendor/lib/micropython-lib/python-stdlib/stat")
include("vendor/lib/micropython-lib/python-stdlib/gzip")
include("vendor/lib/micropython-lib/micropython/utarfile")
include("vendor/lib/micropython-lib/micropython/bluetooth/aioble")
include("frozen")
......@@ -61,6 +61,8 @@ least once.
Use ``"color": "0xffffff",`` to color your name and pronouns.
Use ``"mode": "1",`` to use a different animation mode rotating your nick based on badge orientation.
When you're done editing, unmount/eject the badge from your computer
(``umount`` on Linux is enough) and press the left shoulder button to exit Disk
Mode. Then, go to Badge |rarr| Nick to see your changes!
......
......@@ -5,4 +5,5 @@
esp-llvm = super.callPackage ./esp-llvm.nix {};
esp-gdb = super.callPackage ./esp-gdb.nix {};
run-clang-tidy = super.callPackage ./run-clang-tidy {};
mpremote = super.python310Packages.callPackage ./mpremote {};
})
{ python3
, fetchPypi
}:
python3.pkgs.buildPythonApplication rec {
pname = "mpremote";
version = "1.20.0";
format = "pyproject";
src = fetchPypi {
inherit pname version;
hash = "sha256-XDQnYqBHkTCd1JvOY8cKB1qnxUixwAdiYrlvnMw5jKI=";
};
doCheck = false;
nativeBuildInputs = with python3.pkgs; [
hatchling
hatch-requirements-txt
hatch-vcs
];
propagatedBuildInputs = with python3.pkgs; [
pyserial
importlib-metadata
];
}
......@@ -35,5 +35,6 @@ in with nixpkgs; rec {
emscripten
ncurses5
esp-gdb
mpremote
];
}
......@@ -5,7 +5,7 @@ These are the sources for the Python part of st3m, which implements the core fun
You're either seeing this in our git repository (in `python_payload`) or on a badge itself (in `/flash/sys`).
On the badge, these files are required for the badge to function, and are extracted on first startup. You can edit these to your heart's conent, but this generally shouldn't be necessary.
On the badge, these files are required for the badge to function, and are extracted on first startup. You can edit these to your heart's content, but this generally shouldn't be necessary.
If you break something, the badge will probably not boot. In this case, start it in recovery mode and remove the `sys` directory fully. This will cause the badge to re-extract the files on next startup.
......
......@@ -26,19 +26,17 @@ class HarmonicApp(Application):
self.color_intensity = 0.0
self.chord_index = 0
self.chord: List[int] = []
self.synths = [blm.new(bl00mbox.patches.tinysynth_fm) for i in range(5)]
self.synths = [blm.new(bl00mbox.patches.tinysynth) for i in range(5)]
self.cp_prev = captouch.read()
for i, synth in enumerate(self.synths):
synth.signals.decay = 500
synth.signals.waveform = -32767
synth.signals.waveform = 0
synth.signals.attack = 50
synth.signals.volume = 0.3 * 32767
synth.signals.sustain = 0.9 * 32767
synth.signals.release = 800
synth.signals.fm_waveform = -32767
synth.signals.output = blm.mixer
# synth.fm = 1.5
self._set_chord(3)
self.prev_captouch = [0] * 10
......
......@@ -10,7 +10,7 @@ from st3m.ui.view import ViewManager
from ctx import Context
octave = 0
synths: List[bl00mbox.patches.tinysynth_fm] = []
synths: List[bl00mbox.patches.tinysynth] = []
scale = [0, 2, 4, 5, 7, 9, 11]
......@@ -79,7 +79,7 @@ def run(input: InputController) -> None:
def init() -> None:
global synths
for i in range(1):
synth = blm.new(bl00mbox.patches.tinysynth_fm)
synth = blm.new(bl00mbox.patches.tinysynth)
synth.signals.output = blm.mixer
synths += [synth]
for synth in synths:
......
......@@ -16,6 +16,7 @@ class Configuration:
self.pronouns: list[str] = []
self.pronouns_size: int = 25
self.color = "0x40ff22"
self.mode = 0
@classmethod
def load(cls, path: str) -> "Configuration":
......@@ -54,6 +55,11 @@ class Configuration:
and len(data["color"]) == 8
):
res.color = data["color"]
if "mode" in data:
if type(data["mode"]) == float:
res.mode = int(data["mode"])
if type(data["mode"]) == int:
res.mode = data["mode"]
return res
def save(self, path: str) -> None:
......@@ -88,6 +94,7 @@ class NickApp(Application):
self._filename = "/flash/nick.json"
self._config = Configuration.load(self._filename)
self._pronouns_serialized = " ".join(self._config.pronouns)
self._angle = 0.0
def draw(self, ctx: Context) -> None:
ctx.text_align = ctx.CENTER
......@@ -100,7 +107,10 @@ class NickApp(Application):
ctx.move_to(0, 0)
ctx.save()
ctx.scale(self._scale_name, 1)
if self._config.mode == 0:
ctx.scale(self._scale_name, 1)
elif self._config.mode == 1:
ctx.rotate(self._angle)
ctx.text(self._config.name)
ctx.restore()
......@@ -108,7 +118,10 @@ class NickApp(Application):
ctx.move_to(0, -60)
ctx.font_size = self._config.pronouns_size
ctx.save()
ctx.scale(1, self._scale_pronouns)
if self._config.mode == 0:
ctx.scale(self._scale_pronouns, 1)
elif self._config.mode == 1:
ctx.rotate(self._angle)
ctx.text(self._pronouns_serialized)
ctx.restore()
......@@ -126,6 +139,13 @@ class NickApp(Application):
self._phase += delta_ms / 1000
self._scale_name = math.sin(self._phase)
self._scale_pronouns = math.cos(self._phase)
iy = ins.imu.acc[0] * delta_ms / 10.0
ix = ins.imu.acc[1] * delta_ms / 10.0
ang = math.atan2(ix, iy)
d_ang = self._angle + (ang + math.pi / 8 * math.sin(self._phase))
self._angle -= d_ang / 20
self._led += delta_ms / 45
if self._led >= 40:
self._led = 0
......
......@@ -105,7 +105,9 @@ class sampler(_Patch):
def __init__(self, chan, filename):
super().__init__(chan)
if filename.startswith("/"):
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")
......
from st3m.goose import Optional
STA_IF: int
class WLAN:
def __init__(self, mode: int) -> None:
pass
def active(self, active: bool) -> bool:
return False
def connect(self, ssid: bytes, key: Optional[bytes] = None) -> None:
pass
def isconnected(self) -> bool:
return False
......@@ -20,13 +20,20 @@ log = Log(__name__)
class ApplicationContext:
"""
Container for future application context.
Container for application context.
Envisioned are: path to the bundle, bundle data,
Further envisioned are: path to bundle data,
path to a data directory, etc...
"""
pass
_bundle_path: str
def __init__(self, bundle_path: str = "") -> None:
self._bundle_path = bundle_path
@property
def bundle_path(self) -> str:
return self._bundle_path
class Application(BaseView):
......@@ -152,7 +159,7 @@ class BundleMetadata:
log.info(f"Loaded {self.name} module: {m}")
klass = getattr(m, class_entry)
log.info(f"Loaded {self.name} class: {klass}")
inst = klass(ApplicationContext())
inst = klass(ApplicationContext(self.path))
log.info(f"Instantiated {self.name} class: {inst}")
return inst # type: ignore
except Exception as e:
......
......@@ -13,7 +13,7 @@ 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.about import About
from st3m import settings, logging, processors
from st3m import settings, logging, processors, wifi
import captouch, audio, leds, gc
import os
......@@ -35,6 +35,9 @@ def _make_reactor() -> Reactor:
settings.onoff_button_swap.subscribe(_onoff_button_swap_update)
_onoff_button_swap_update()
settings.onoff_camp_wifi.subscribe(wifi._onoff_camp_wifi_update)
wifi._onoff_camp_wifi_update()
return reactor
......
......@@ -293,10 +293,12 @@ class SettingsMenu(SimpleMenu):
# Actual tunables / settings.
onoff_camp_wifi = OnOffTunable("Connect Camp WiFi", "system.camp_wifi_enabled", False)
onoff_button_swap = OnOffTunable("Swap Buttons", "system.swap_buttons", False)
onoff_debug = OnOffTunable("Debug Overlay", "system.debug", False)
onoff_debug_touch = OnOffTunable("Touch Overlay", "system.debug_touch", False)
all_settings: List[UnaryTunable] = [
onoff_camp_wifi,
onoff_button_swap,
onoff_debug,
onoff_debug_touch,
......
import network
from st3m import settings
iface = None
def setup_camp_wifi() -> None:
global iface
iface = network.WLAN(network.STA_IF)
iface.active(True)
iface.connect(b"Camp2023-open")
def disable() -> None:
if iface is not None:
iface.active(False)
def is_connected() -> bool:
if iface is not None:
return iface.isconnected()
else:
return False
def _onoff_camp_wifi_update() -> None:
if settings.onoff_camp_wifi.value:
setup_camp_wifi()
else:
disable()
STA_IF = 1
class WLAN:
def __init__(self, mode):
pass
def active(self, active):
return False
def connect(self, ssid, key=None):
pass
def isconnected(self):
return False
#!/usr/bin/env bash
set -e
set -e -u
if [ ! -f sdkconfig.defaults ] || [ ! -f recovery/sdkconfig.defaults ]; then
echo >/dev/stderr "Run this script for the root of the repository (ie. tools/mypy.sh)."
......@@ -28,7 +28,7 @@ _mypy python_payload/main.py
for f in python_payload/apps/*/flow3r.toml; do
app_name="$(basename $(dirname $f))"
echo "Checking ${app_name}..."
_mypy python_payload/apps/${app}
_mypy python_payload/apps/${app_name}
done
if [ $failed ]; then
......