A questionable combination of JavaScript (in syntax), FORTH (in spirit) and MicroPython (in terms of scope and being a wild mix of weird and kinda cool).
$deity
, why?esp32-idf
image size and thus turnaround time can be a bit of an obstacle.this is the web app, JavaScript editor + live updated in-browser rendering of the code, alongside hot code reload sent to a no_std
,no_alloc
microcontroller
extremely fast turnaround, no noticable delay between code change and web app/mcu update
Care has been taken to keep runtime platform, language and language dialect generic. This means:
trenchcoat
on a PC, a microcontroller, or in the browser.for
loops? Maybe in the next release…no_std
embedded apps don't use an allocator, which means a lot of wasted memory for static buffer headroom. Allocator support is implemented but not currently used.Right now the main focus lies on getting pixelblaze support to mature, so that's also what these instructions will focus on.
The general approach is:
console-compiler
to compile bytecode to disk (.tcb
for "TrenChcoat Bytecode" is a suggested file extension) and "somehow" have your firmware access it, e.g. via include_bytes!
. If you want to update via http but your mcu is connected via UART (e.g. the bundled stm32f4-app
), launch http-to-serial.py /dev/YOUR-SERIAL-DEVICE
as a bridge.Executor
, start()
it once and call do_frame()
as many times as you wish to produce LED colors. On no_std
"current time" needs to be advanced manually from some timer source (the example app reuses the frame task's scheduling interval). Executor::exit()
is optional.Feature flags to pick:
- Desktop: ["full"]
- Web app/wasm: ["compiler", "log", "use-std"]
- Embedded: ["defmt"]
or ["defmt", "alloc"]
when you have an allocator
- esp32 with IDF (std
support): ["log", "use-std"]
probe-run
setup.f4-peri
crate; you can also use SPI1+PB5 by using the spi
feature instead of the default spi_alt
. f4-peri
also supports the SK9822/APA102 protocol if you prefer a more stable LED.```shell cd console-compiler
cargo run -- -f pixelblaze -i ../res/rainbow\ melt.js -o "../res/rainbow melt.tcb" cd ../stm32f4-app
cargo rrb app ```
TODO, up next!
TODO, up next!
(a cool bear spawns from an adjacent universe)
cool bear: Browser? As in ... you're running a rudimentary JavaScript virtual machine ... in the browser ...
author, in straightjacket: you got that exactly right. With no performance-boosting offload support whatsoever!
On the bright side, we don't need a separate compilation step as part of our build. Because the compiler also runs in the browser, muahahaha
See main.rs
for more details. Currently the web app is wildly inefficient (but still plenty fast), and also the editor permanently loses cursor position. WIP.
shell
cargo install --git https://github.com/DioxusLabs/cli # their stable version seems broken atm
cd web-app
dioxus serve
$browser http://localhost:8080/
log
/defmt
) logging macros courtesy of dirbaio and whitequark