Enable host OTA over BLE and harden ESP-NOW slave distribution.
Allow the same staged firmware upload path on BLE as UART, fix distribute stack/event-group crashes, and recover sticky slave OTA sessions instead of failing with err=4. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
+12
-4
@@ -5,7 +5,7 @@ import (
|
||||
"os"
|
||||
)
|
||||
|
||||
func runOTA(sp *serialPort, args []string) error {
|
||||
func runOTA(t otaTransport, args []string) error {
|
||||
if len(args) < 1 {
|
||||
return fmt.Errorf("usage: ota <firmware.bin>")
|
||||
}
|
||||
@@ -14,9 +14,17 @@ func runOTA(sp *serialPort, args []string) error {
|
||||
return err
|
||||
}
|
||||
|
||||
sp.mu.Lock()
|
||||
defer sp.mu.Unlock()
|
||||
return runOTAOnPortUnlocked(sp, data, func(p OTAProgress) {
|
||||
switch x := t.(type) {
|
||||
case *serialPort:
|
||||
x.mu.Lock()
|
||||
defer x.mu.Unlock()
|
||||
case *bleLink:
|
||||
if err := x.ensureOTAMTU(); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
return runOTAUnlocked(t, data, func(p OTAProgress) {
|
||||
switch p.Phase {
|
||||
case "preparing", "ready":
|
||||
fmt.Println(p.Message)
|
||||
|
||||
Reference in New Issue
Block a user