feat: Add ESP32 WiFi Unified OTA update support

This commit is contained in:
Sergio Conde
2026-01-28 15:43:41 +01:00
parent cdf893e618
commit 1eb13c9953
3 changed files with 184 additions and 3 deletions

View File

@@ -654,7 +654,7 @@ class Node:
return self._sendAdmin(p, onResponse=onResponse)
def rebootOTA(self, secs: int = 10):
"""Tell the node to reboot into factory firmware."""
"""Tell the node to reboot into factory firmware (firmware < 2.7.18)."""
self.ensureSessionKey()
p = admin_pb2.AdminMessage()
p.reboot_ota_seconds = secs
@@ -667,6 +667,22 @@ class Node:
onResponse = self.onAckNak
return self._sendAdmin(p, onResponse=onResponse)
def startOTA(
self,
mode: admin_pb2.OTAMode.ValueType,
hash: bytes,
):
"""Tell the node to start OTA mode (firmware >= 2.7.18)."""
if self != self.iface.localNode:
raise Exception("startOTA only possible in local node")
self.ensureSessionKey()
p = admin_pb2.AdminMessage()
p.ota_request.reboot_ota_mode=mode
p.ota_request.ota_hash=hash
return self._sendAdmin(p)
def enterDFUMode(self):
"""Tell the node to enter DFU mode (NRF52)."""
self.ensureSessionKey()