microfuse: a multiplexed channel to micropython devices

Discussion about programs, libraries and tools that work with MicroPython. Mostly these are provided by a third party.
Target audience: All users and developers of MicroPython.
Post Reply
smurf
Posts: 7
Joined: Wed Feb 27, 2019 11:25 am

microfuse: a multiplexed channel to micropython devices

Post by smurf » Tue Jun 01, 2021 5:53 pm

Hi,

I'd like to share a package that uses a single TCP connection to a ESP32 (tested) / whatever else runs networked MicroPython (untested) device, which carries
  • keepalive and watchdog
  • FUSE and file access commands (FUSE works, the rest is TODO but very simple to add)
  • MQTT messages
  • REPL
  • well … whatever else you want, it's extensible
all on a single connection. Major advantages:
  • it runs completely in the background so you still have the REPL
  • if the link is dead, then it's really dead, no more partial breakdowns
  • if you need SSL or authentication (TODO) you only need one SSL connection
  • the protocol is simple, many languages have msgpack libraries
  • there's a code example: forward a debounced button to MQTT
Disadvantages, for now:
  • it uses the standard msgpack code, which is not at all memory efficient (but I'll fix that soon)
  • support for reconnecting things after a network outage is somewhat incomplete (but works for most usecases IMHO)
There's also a really nice scheduler (disclaimer: I wrote it) that also runs in the background.

It's possible to run this code across a UART line: just add checksumming and retransmission. If somebody knows of a light-weight library that does this, extending microfuse to support it should be easy.

Code at https://github.com/M-o-a-T/microfuse

Post Reply