ESP32 Printago print-farm button — fork of spuder/PrintFarmButton with a printer-list scaling fix (scales to hundreds of printers)
  • HTML 42.4%
  • Makefile 20.9%
  • JavaScript 18.5%
  • Shell 18.2%
Find a file
jdh c54cc71992 firmware v1.0.5: flush printer selection to flash immediately (fix lost printer after physical unplug)
v1.0.4 persisted printer_id via make_call().set_value().perform() -> control()
-> pref.save(), but pref.save() only marks the ESPPreferenceObject dirty. The
actual NVS/flash commit is deferred to the global preferences flush cycle
(flash_write_interval, default 60s) or a clean shutdown. A clean software reboot
(OTA/restart) flushes on the way down, so v1.0.4's OTA-reboot test passed; but a
PHYSICAL power-cut inside the flush window loses the pending write and the device
boots with the last-flushed printer ("set Cotton, unplug, comes back Kevin").

Fix: call global_preferences->sync() immediately after every printer_id write
path (select set_action, single-printer auto-select, and clear_printer_selection),
committing the pick to flash right away. Scoped to actual selections, so flash
wear stays bounded vs. lowering flash_write_interval globally. Added INFO-level
log lines so the flush is observable at the device's default DEBUG log level
(NVS commits are otherwise only logged at VERBOSE).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NtXkvrqtQc511tXHEcBhpj
2026-07-07 16:56:17 -04:00
firmware firmware v1.0.5: flush printer selection to flash immediately (fix lost printer after physical unplug) 2026-07-07 16:56:17 -04:00
web Flasher: fetch manifest same-origin (fixes "failed to download manifest") 2026-07-07 14:02:14 -04:00
.gitignore PrintFarmButton-3DH: printer-list scaling fix + Forgejo OTA 2026-07-07 13:54:00 -04:00
build.sh firmware v1.0.2: persist selected printer across reboot 2026-07-07 16:10:39 -04:00
NOTICE PrintFarmButton-3DH: printer-list scaling fix + Forgejo OTA 2026-07-07 13:54:00 -04:00
README.md PrintFarmButton-3DH: printer-list scaling fix + Forgejo OTA 2026-07-07 13:54:00 -04:00
server.mjs Add zero-dependency static server for the flasher (pfb.3dh.io) 2026-07-07 13:58:11 -04:00

PrintFarmButton-3DH

A fork of spuder/PrintFarmButton — an ESP32 button that talks to a Printago print farm — with one fix that makes the printer list scale to hundreds of printers.

The problem this fixes

The stock firmware fetches GET /v1/printers (the full printer objects, ~1290 bytes each) into an 8192-byte buffer. A store with roughly 6+ printers overflows it → the JSON is truncated → the picker shows "No printers found" and you can't select a printer at all.

The fix (two lines, in firmware/esphome/conf.d/cloud_printago.yaml)

  1. ?fields=id,name on the fetch URL — Printago returns only id + name (~50 bytes/printer instead of ~1290). 6 printers: 8218 B → ~304 B.
  2. buffer 819232768 — headroom for ~600 printers.

&limit=500 caps the request. Scales to hundreds of printers on the same hardware, no other changes.

Flash it

Open web/index.html in Chrome or Edge (Web Serial), plug the board in via USB, pick your board, click Connect & Flash. Then join the button's Wi-Fi setup and enter your Printago API Key + Store ID. Credentials are entered on the device — they never touch the flasher page.

Auto-update (OTA)

The firmware checks firmware/output/manifest-<board>.json on this repo hourly and, with "Auto Update" on (default), installs new builds. The source URL lives in firmware/esphome/conf.d/update.yamlif you fork this, change the owner/repo there so your buttons pull your builds, not someone else's.

Build a board

Needs ESPHome 2025.7.0 (the version spuder's custom template_select component compiles against — newer cores break it):

pip install "esphome==2025.7.0"
./build.sh atom-matrix          # or: esp32c3-supermini, esp32c3-zero, esp32s3-*

build.sh compiles and copies the .factory.bin + .ota.bin + refreshed manifest into firmware/output/.

Layout

firmware/esphome/      ESPHome source (the fix is in conf.d/cloud_printago.yaml)
firmware/output/       built .bin + manifest per board (flash + OTA source)
firmware/output-stock/ spuder's original bins (reference; carry the bug)
web/index.html         browser flasher (ESP Web Tools)
build.sh               compile + stage a board's artifacts

Credit & license

Derived from spuder/PrintFarmButton and spuder/OpenSpool. See NOTICE. The upstream carries no license (all rights reserved) — this fork exists to run our own hardware and to offer the scaling fix back upstream. Please credit spuder and coordinate with the upstream before redistributing widely.