ESP: first implementation; compiles fine; not tested with MCU

This commit is contained in:
Thomas Karner committed 2026-09-20 18:55:26 +02:00
1 parent 5bdcb51bff
commit 6bda641ce8
36 files changed
+6234

No files matched your search

+22
View File
@@ -0,0 +1,22 @@
// commands.h — the WebUI -> device channel (SPEC C1).
//
// The device is never contacted directly. The WebUI writes a row into
// `device_commands`; the endpoint attaches pending rows to the next
// ingest/heartbeat response; this module executes them and acks.
//
// Deferred execution: some commands must not run inside the HTTP response
// callback (OTA reboots, streaming blocks for a minute). Those are queued and
// run from the main loop, which is also where sleep decisions are made.
#pragma once
#include <Arduino.h>
#include <ArduinoJson.h>
// Pass this to apiIngest/apiHeartbeat. Parses and either executes immediately
// or defers. Cheap commands ack from here; deferred ones ack on completion.
void commandOnReceived(JsonObjectConst cmd);
// Run anything that was deferred. Call once per main-loop tick.
void commandRunDeferred();
bool commandHasPending();