Merge observer OTA channel switching into keymindCascade

This commit is contained in:
mikecarper committed 2026-10-04 00:26:46 -07:00
commit 63f4642252
32 files changed
+3090 -1708

No files matched your search

+2 -1
View File
@@ -39,6 +39,7 @@
#ifdef WITH_WEBCONFIG
#include <WiFi.h>
#endif
#include <helpers/OtaChannel.h>
#if MESH_ENABLE_TELEMETRY_HISTORY && defined(STM32_PLATFORM)
#include <sys/types.h>
extern "C" caddr_t _sbrk(int increment);
@@ -12794,7 +12795,7 @@ void __attribute__((noinline)) MyMesh::servicePostMeshLoop() {
mesh::usbConsolePort().printf("OTA: aborted, MQTT stop did not complete cleanly - resuming bridge\r\n");
otaAlert("OTA aborted: MQTT stop unclean, bridge resumed");
setBridgeState(true);
} else if (!_cli.getBoard()->otaFromManifest(getFirmwareVer(), false, ota_reply)) {
} else if (!_cli.getBoard()->otaFromManifest(ota_resolve_base(_ota_update_channel), getFirmwareVer(), false, ota_reply)) {
mesh::usbConsolePort().printf("OTA: aborted, resuming bridge - %s\r\n", ota_reply);
char ota_alert_msg[160];
snprintf(ota_alert_msg, sizeof(ota_alert_msg), "OTA aborted: %s", ota_reply);
+2
View File
@@ -569,6 +569,7 @@ class MyMesh : public mesh::Mesh, public CommonCLICallbacks
unsigned long scheduled_radio_save_retry_at;
uint8_t scheduled_radio_retry_failures;
ScheduledRadioSetting scheduled_radio_settings[MAX_SCHEDULED_RADIO_SETTINGS];
uint8_t _ota_update_channel = 0; // Snapshot: later ota branch commands cannot retarget a queued update
int matching_peer_indexes[MAX_CLIENTS];
#if defined(WITH_MQTT_BRIDGE)
MQTTBridge* mqtt_bridge;
@@ -1549,6 +1550,7 @@ public:
bool beginDeferredOtaUpdate() override {
_ota_update_at = millis() + 2500;
if (_ota_update_at == 0) _ota_update_at = 1; // 0 means "none"
_ota_update_channel = _prefs.ota_channel;
#if defined(WITH_MQTT_BRIDGE)
// Broadcast START now, while the loop still runs (the 2.5 s reply window):
// the deferred flash blocks the loop and, on success, reboots -- so a start
+2 -1
View File
@@ -22,6 +22,7 @@
#ifdef WITH_WEBCONFIG
#include <WiFi.h>
#endif
#include <helpers/OtaChannel.h>
static uint32_t nextRadioApplyRetryDelay(uint8_t& failure_count) {
uint8_t shift = failure_count < 5 ? failure_count : 5;
@@ -2773,7 +2774,7 @@ void MyMesh::loop() {
}
char ota_reply[160];
if (may_flash && !_cli.getBoard()->otaFromManifest(getFirmwareVer(), false, ota_reply)) {
if (may_flash && !_cli.getBoard()->otaFromManifest(ota_resolve_base(_ota_update_channel), getFirmwareVer(), false, ota_reply)) {
mesh::usbConsolePort().printf("OTA: aborted - %s\r\n", ota_reply);
may_flash = false;
}
+2
View File
@@ -235,6 +235,7 @@ class MyMesh : public mesh::Mesh, public CommonCLICallbacks,
TransportKey default_scope;
unsigned long set_radio_at, revert_radio_at;
unsigned long _ota_update_at = 0; // deferred `ota update` fire time (0 = none scheduled)
uint8_t _ota_update_channel = 0; // channel `ota update` checked; a later `ota branch` cannot retarget it
float pending_freq;
float pending_bw;
uint8_t pending_sf;
@@ -831,6 +832,7 @@ public:
bool beginDeferredOtaUpdate() override {
_ota_update_at = millis() + 2500;
if (_ota_update_at == 0) _ota_update_at = 1; // 0 means "none"
_ota_update_channel = _prefs.ota_channel;
return true;
}