Fix MQTT startup after ESP32 WebConfig provisioning
This commit is contained in:
1 parent
86d74c4a13
commit
d4b7217a4b
18 files changed
+1018
-208
No files matched your search
@@ -1453,6 +1453,9 @@ void MyMesh::begin(FILESYSTEM *fs) {
|
||||
node_info.cr = &_prefs.cr;
|
||||
node_info.repeat_flag = &_prefs.disable_fwd;
|
||||
node_info.repeat_when_nonzero = false;
|
||||
#ifdef WITH_WEBCONFIG
|
||||
node_info.canonical_wifi = true;
|
||||
#endif
|
||||
bridge = new MQTTBridge(node_info, _cli.getObserverPrefs(),
|
||||
getRTCClock(), &self_id);
|
||||
if (bridge) {
|
||||
@@ -1501,8 +1504,8 @@ void MyMesh::begin(FILESYSTEM *fs) {
|
||||
bool start_webui = WebConfigServer::loadEnabled(false);
|
||||
#ifdef WITH_MQTT_BRIDGE
|
||||
start_webui = start_webui || (_prefs.bridge_enabled
|
||||
&& _cli.getObserverPrefs()->wifi_ssid[0] == 0);
|
||||
if (start_webui && _cli.getObserverPrefs()->wifi_ssid[0] == 0) {
|
||||
&& !WebConfigServer::hasConfiguredWiFi(_cli.getObserverPrefs()));
|
||||
if (start_webui && !WebConfigServer::hasConfiguredWiFi(_cli.getObserverPrefs())) {
|
||||
#if defined(WITH_ESPNOW_BRIDGE)
|
||||
if (espnow_bridge.isRunning()) espnow_bridge.end();
|
||||
#endif
|
||||
@@ -1956,7 +1959,7 @@ void MyMesh::getNodeSnapshot(WebConfigServer::NodeSnapshot& s) {
|
||||
void MyMesh::suspendUnconfiguredSetupBridges() {
|
||||
#if defined(MESHCORE_EXPANDED_PARTITION_PROFILE)
|
||||
#ifdef WITH_MQTT_BRIDGE
|
||||
if (_cli.getObserverPrefs()->wifi_ssid[0]) return;
|
||||
if (WebConfigServer::hasConfiguredWiFi(_cli.getObserverPrefs())) return;
|
||||
#else
|
||||
char ssid[33] = {};
|
||||
WebConfigServer::loadStandaloneWiFi(ssid, sizeof(ssid), nullptr, 0);
|
||||
@@ -1993,7 +1996,7 @@ bool MyMesh::startWebConfigImpl(bool force_ap, char* reply, bool automatic_setup
|
||||
#ifdef WITH_MQTT_BRIDGE
|
||||
if ((isMqttBridgeRunning() || isMqttBridgeStopping()) && (force_ap
|
||||
#if defined(MESHCORE_EXPANDED_PARTITION_PROFILE)
|
||||
|| _cli.getObserverPrefs()->wifi_ssid[0] == 0
|
||||
|| !WebConfigServer::hasConfiguredWiFi(_cli.getObserverPrefs())
|
||||
#endif
|
||||
)) {
|
||||
strcpy(reply, isMqttBridgeStopping() ? "Err: MQTT bridge is stopping - retry shortly"
|
||||
@@ -2094,15 +2097,15 @@ bool MyMesh::getWebUIStatus(char* reply) const {
|
||||
}
|
||||
|
||||
bool MyMesh::getWiFiSSID(char* reply) const {
|
||||
return WebConfigServer::formatWiFiSSID(reply, 160);
|
||||
return WebConfigServer::formatWiFiSSID(reply, 160, canonicalWiFiLegacyPrefs());
|
||||
}
|
||||
|
||||
bool MyMesh::getWiFiStatus(char* reply) const {
|
||||
return WebConfigServer::formatWiFiStatus(reply, 160);
|
||||
return WebConfigServer::formatWiFiStatus(reply, 160, nullptr, canonicalWiFiLegacyPrefs());
|
||||
}
|
||||
|
||||
bool MyMesh::getWiFiPowerSave(char* reply) const {
|
||||
return WebConfigServer::formatWiFiPowerSave(reply, 160);
|
||||
return WebConfigServer::formatWiFiPowerSave(reply, 160, canonicalWiFiLegacyPrefs());
|
||||
}
|
||||
|
||||
bool MyMesh::getWiFiCLI(char* reply) const {
|
||||
@@ -2110,7 +2113,7 @@ bool MyMesh::getWiFiCLI(char* reply) const {
|
||||
}
|
||||
|
||||
bool MyMesh::setWiFiSSID(const char* value, char* reply) {
|
||||
if (WebConfigServer::setStandaloneWiFiSSID(value, reply, 160)) {
|
||||
if (WebConfigServer::setStandaloneWiFiSSID(value, reply, 160, canonicalWiFiLegacyPrefs())) {
|
||||
const bool was_running = _webconfig && _webconfig->isRunning();
|
||||
if (was_running) _webconfig->requestStop();
|
||||
if (_webconfig) _webconfig->reloadStandaloneWiFi();
|
||||
@@ -2122,7 +2125,7 @@ bool MyMesh::setWiFiSSID(const char* value, char* reply) {
|
||||
}
|
||||
|
||||
bool MyMesh::setWiFiPassword(const char* value, char* reply) {
|
||||
if (WebConfigServer::setStandaloneWiFiPassword(value, reply, 160)) {
|
||||
if (WebConfigServer::setStandaloneWiFiPassword(value, reply, 160, canonicalWiFiLegacyPrefs())) {
|
||||
const bool was_running = _webconfig && _webconfig->isRunning();
|
||||
if (was_running) _webconfig->requestStop();
|
||||
if (_webconfig) _webconfig->reloadStandaloneWiFi();
|
||||
@@ -2134,7 +2137,7 @@ bool MyMesh::setWiFiPassword(const char* value, char* reply) {
|
||||
}
|
||||
|
||||
bool MyMesh::setWiFiPowerSave(const char* value, char* reply) {
|
||||
if (WebConfigServer::setStandaloneWiFiPowerSave(value, reply, 160)
|
||||
if (WebConfigServer::setStandaloneWiFiPowerSave(value, reply, 160, canonicalWiFiLegacyPrefs())
|
||||
&& _webconfig) {
|
||||
_webconfig->reloadStandaloneWiFi();
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user