Getting started
Custom firmware for the M5Stack M5PaperS3 (ESP32-S3, 4.7” e-ink, touch), plus a desktop simulator built from the same source. Apps: e-book reader, Home Assistant remote, WhatsApp and mail inbox (read through an encrypted phone companion), agenda, weather, Teletekst, Hacker News, daily games, chess, settings. Built for long battery life and calm, quick e-ink rendering.
Where things stand: STATUS. What is planned: ROADMAP. Why it is built this way: DECISIONS.
Quick start (macOS)
Section titled “Quick start (macOS)”brew install sdl2-compat uvuv tool install --python 3.12 platformiomake shot # builds the simulator, writes out/shot.pngmake run # simulator windowmake flash # build and flash a connected PaperS3Commands
Section titled “Commands”make sim # build the simulatormake shot # headless render to out/shot.pngmake run # simulator windowmake fw # build firmwaremake flash # flash the device on /dev/cu.usbmodem*make ota # firmware over Wi-Fi (Settings > Developer > Wireless development on; HOST=address) # signed with ~/.config/paperos/ota-signing.key (make ota-key creates it; never commit it)make monitor # device serial logmake device-shot # frame dump from the device over USB to out/device.png (tools/device.py: tap, swipe, log)make view # live view of the device in a browser: click = tap, hold = long press, drag = swipe # ARGS=--sim for the simulator, ARGS=--lan for a phone, ARGS=--wifi without USBmake cam-shot # webcam still of the panel to out/cam.png (tools/cam.py; CAMERA=name)make cam-video # webcam video to out/cam.mp4 (SECONDS=5)make cam-compare # device-shot + cam-shot + ghosting number per region, out/cam-diff.pngmake cam-target # calibration screen on the device + stillmake test # host unit tests (tests/unit, doctest)make ui-test # headless UI scripts (tests/ui/*.script) against golden screenshotsmake ui-accept # accept new screenshots as goldens (look at them first)make gallery # out/gallery.html: every UI test screenshotmake check # sim + test + ui-test + fw: must pass before a change is donetools/latency.py measures tap-to-driver latency on the device, tools/memory.py internal heap and PSRAM per app.
Configuration
Section titled “Configuration”Secrets live on the SD card in /sd/paperos_config (HA_URL, HA_TOKEN, WIFI_SSID, WIFI_PASSWORD, …; the
simulator reads sim-data/sd/paperos_config). The Home app’s dashboard is /sd/paperos/home.json; without one the
firmware shows an example house (docs/apps/home.md). Neither is in the repository.
Build rules
Section titled “Build rules”- The ESP-IDF core is built from source (
custom_sdkconfigin platformio.ini, D25): a change there rebuilds it (~5 min). PlatformIO’s own Python needsplatformio==6.2.0(not6.2.0.post1). After changingcustom_sdkconfigorboard_build.f_*, deletesdkconfig.papers3first. Flash and PSRAM run at 120 MHz (soak test>set psram-test N). - M5GFX is patched at build time (
tools/patch_m5gfx.py, D24). After changing a patch:rm -rf .pio/libdeps/papers3/M5GFX, build, flash,tools/device.py set epd-selftest on, check the log says “identical”. - Firmware size (D31): no C++ exceptions, no iostreams. The device build has
-fno-exceptions; a standard-library throw is an abort. Never include<sstream>,<iostream>,<fstream>,<regex>or<locale>in code the firmware links (100-160 KB each). - Shared code stays platform-free.
src/core,src/ui,src/apps,src/halnever includeArduino.h,M5Unified.h,SDL.hor ESP-IDF headers. Onlysrc/platform/*may. - Nothing draws to the panel except the DisplayManager. Widgets draw into the canvas and call
invalidate(hint)(docs/DISPLAY.md). - No animation, no scrolling, no blocking on the UI thread (
ctx.async/ctx.http). - Colours are
pos::Color(uint32_t), onlygray(0..15). - Every UI change is checked with a screenshot. Panel effects (ghosting, flash, gray levels) are checked with the
webcam (
tools/cam.py,docs/DISPLAY.md“Camera on the panel”). src/gen/is generated bytools/gen-assets.sh. Do not edit by hand.- Names in code, files and docs are English; text on the panel may be Dutch.
Documentation
Section titled “Documentation”The docs are Markdown in docs/ and are also published as a site with navigation, search and diagrams:
https://mattijsf.github.io/m5paper-os/. Good places to start: ARCHITECTURE for how the code
fits together, DISPLAY for how the panel is driven, APPS for writing an app, and one
spec per app in docs/apps/. The Android companion app is described in android/README.md,
its Home Assistant package is ha/paperos_inbox.yaml.
To run the site locally: cd site && npm install && npm run dev (npm run build builds it into site/dist). The pages
are generated from the Markdown, so edit docs/, not site/; a new doc goes into site/pages.mjs too.