-
Notifications
You must be signed in to change notification settings - Fork 3
RaftESPOTAUpdateSysMod
Rob Dobson edited this page May 4, 2026
·
2 revisions
Built-in SysMod that performs ESP32 OTA firmware updates. Receives the firmware image as a stream and writes it to the inactive OTA partition using
esp_ota_*APIs, then triggers a restart.
- HTTP-direct firmware push (
espFwUpdate) from a host (e.g. an IDE plugin orraftCLI). - File-stream firmware update started by the framework when registered as the firmware handler with ProtocolExchange.
- Worker task that handles
esp_ota_begin/write/endso the network stack is not blocked. - Per-update statistics: total bytes, write time, throughput, CRC.
| Key | Default | Meaning |
|---|---|---|
OTADirect |
true |
Enable the HTTP-direct path (espFwUpdate). When false, only file-stream updates are accepted. |
| Endpoint | Method | Purpose |
|---|---|---|
espFwUpdate |
POST | Stream firmware image as POST body. Body is consumed in chunks; response is sent on completion. |
To make the framework route file-stream uploads (e.g. a ufStart over BLE/WebSocket/serial with content type firmware) to this SysMod, register it with ProtocolExchange:
auto* pProtoExch = (ProtocolExchange*)getSysManager()->getSysMod("ProtoExchange");
auto* pOTA = (ESPOTAUpdate*)getSysManager()->getSysMod("ESPOTAUpdate");
if (pProtoExch && pOTA)
pProtoExch->setFWUpdateHandler(pOTA);RaftCoreApp does this automatically when both SysMods are present.
After a successful OTA write, the SysMod waits TIME_TO_WAIT_BEFORE_RESTART_MS (1000 ms) so the response can be transmitted, then triggers esp_restart().
- File Download Protocol (OKTO) — the inbound firmware-stream path
- ProtocolExchange — owns file/stream sessions and the FW update hook
Getting Started
- Quick Start
- Architecture at a Glance
- Writing Your First SysMod
- Adding a Comms Channel
- Adding an I2C Device Type
- PlatformIO / Arduino
Scaffolding & Building
- Raft CLI
- SysTypes
- Top-Level SysType
- Build Process
- WebUI Build Pipeline
- File System
- Partitions & Flash
- Local Dev Libraries
- Library Developer Guide
Architecture
Built-in SysMods
- NetworkManager
- BLEManager
- WebServer
- MQTTManager
- SerialConsole
- CommandSerial
- CommandSocket
- CommandFile
- FileManager
- LogManager
- ESPOTAUpdate
- StatePublisher
- Remote Logging
- Data Source Registration
Comms & Protocols
- Stack Overview
- Comms Channels
- ProtocolExchange
- RICREST Protocol
- Real-Time Streams
- Adding REST Endpoints
- Built-in REST Endpoints
- File Download (OKTO)
- OTA Update Flow
Devices & Buses
- DeviceManager
- Device Manager REST API
- Device Factory & Classes
- Device Type Records
- Adding an I2C Device Type
- Device Data Publishing
- Data Logger
- I2C Bus
- I2C Device Scanning
- I2C ID & Polling
- MotorControl Overview
- MotorControl Config
- MotorControl Commands
Helpers
Reference
{ "name": "ESPOTAUpdate", "OTADirect": 1 }