Preserve requested ESP-NOW across manual setup and master restore
This commit is contained in:
1 parent
d0859f925d
commit
c06ddb76ae
9 files changed
+128
-17
No files matched your search
@@ -3946,7 +3946,7 @@ void MyMesh::begin(FILESYSTEM *fs) {
|
||||
#endif
|
||||
if (start_webui) {
|
||||
char wc_reply[160];
|
||||
startWebConfig(false, wc_reply);
|
||||
startWebConfigImpl(false, wc_reply, true);
|
||||
mesh::usbConsolePort().printf("%s\r\n", wc_reply);
|
||||
}
|
||||
#endif
|
||||
@@ -10949,6 +10949,10 @@ void MyMesh::suspendUnconfiguredSetupBridges() {
|
||||
}
|
||||
|
||||
bool MyMesh::startWebConfig(bool force_ap, char* reply) {
|
||||
return startWebConfigImpl(force_ap, reply, false);
|
||||
}
|
||||
|
||||
bool MyMesh::startWebConfigImpl(bool force_ap, char* reply, bool automatic_setup) {
|
||||
if (_cli.getBoard()->isOTAUpdateRunning()) {
|
||||
strcpy(reply, "Err: OTA server is running - 'stop ota' first");
|
||||
return true;
|
||||
@@ -10996,7 +11000,9 @@ bool MyMesh::startWebConfig(bool force_ap, char* reply) {
|
||||
#ifdef WITH_ESPNOW_BRIDGE
|
||||
const bool espnow_was_running = isEspNowBridgeRunning();
|
||||
#endif
|
||||
suspendUnconfiguredSetupBridges();
|
||||
// Only automatic first-boot setup parks the saved default bridges. A manual
|
||||
// WiFi start (including master-radio restoration) must retain explicit ESP-NOW.
|
||||
if (automatic_setup) suspendUnconfiguredSetupBridges();
|
||||
|
||||
#ifdef WITH_MQTT_BRIDGE
|
||||
_webconfig->updateWiFiOwnership(!mqtt_bridge
|
||||
|
||||
@@ -657,6 +657,7 @@ class MyMesh : public mesh::Mesh, public CommonCLICallbacks
|
||||
// Its retry loop must not revive ESP-NOW after the AP window ends.
|
||||
bool _unconfigured_setup_espnow_suspended = false;
|
||||
void suspendUnconfiguredSetupBridges();
|
||||
bool startWebConfigImpl(bool force_ap, char* reply, bool automatic_setup);
|
||||
bool _wc_batch_active = false;
|
||||
bool _wc_restart_pending = false;
|
||||
uint8_t _wc_slot_restart_mask = 0;
|
||||
|
||||
@@ -1511,7 +1511,7 @@ void MyMesh::begin(FILESYSTEM *fs) {
|
||||
#endif
|
||||
if (start_webui) {
|
||||
char wc_reply[160];
|
||||
startWebConfig(false, wc_reply);
|
||||
startWebConfigImpl(false, wc_reply, true);
|
||||
mesh::usbConsolePort().printf("%s\r\n", wc_reply);
|
||||
}
|
||||
#endif
|
||||
@@ -1973,6 +1973,10 @@ void MyMesh::suspendUnconfiguredSetupBridges() {
|
||||
}
|
||||
|
||||
bool MyMesh::startWebConfig(bool force_ap, char* reply) {
|
||||
return startWebConfigImpl(force_ap, reply, false);
|
||||
}
|
||||
|
||||
bool MyMesh::startWebConfigImpl(bool force_ap, char* reply, bool automatic_setup) {
|
||||
if (_cli.getBoard()->isOTAUpdateRunning()) {
|
||||
strcpy(reply, "Err: OTA server is running - 'stop ota' first");
|
||||
return true;
|
||||
@@ -2017,7 +2021,9 @@ bool MyMesh::startWebConfig(bool force_ap, char* reply) {
|
||||
#ifdef WITH_ESPNOW_BRIDGE
|
||||
const bool espnow_was_running = isEspNowBridgeRunning();
|
||||
#endif
|
||||
suspendUnconfiguredSetupBridges();
|
||||
// Only automatic first-boot setup parks the saved default bridges. A manual
|
||||
// WiFi start (including master-radio restoration) must retain explicit ESP-NOW.
|
||||
if (automatic_setup) suspendUnconfiguredSetupBridges();
|
||||
|
||||
#ifdef WITH_MQTT_BRIDGE
|
||||
_webconfig->updateWiFiOwnership(!bridge
|
||||
|
||||
@@ -322,6 +322,7 @@ class MyMesh : public mesh::Mesh, public CommonCLICallbacks,
|
||||
WebConfigServer* _webconfig = nullptr;
|
||||
bool _unconfigured_setup_espnow_suspended = false;
|
||||
void suspendUnconfiguredSetupBridges();
|
||||
bool startWebConfigImpl(bool force_ap, char* reply, bool automatic_setup);
|
||||
bool _wc_batch_active = false;
|
||||
bool _wc_restart_pending = false;
|
||||
uint8_t _wc_slot_restart_mask = 0;
|
||||
|
||||
Reference in new issue
Block a user