@alteriom/painlessmesh 1.9.6 → 1.9.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +37 -0
- package/README.md +41 -174
- package/docs/troubleshooting/common-issues.md +26 -0
- package/docs/troubleshooting/external-device-connection.md +283 -0
- package/examples/bridge/bridge.ino +23 -0
- package/examples/bridge_failover/bridge_failover.ino +24 -0
- package/library.json +1 -1
- package/library.properties +1 -1
- package/package.json +4 -4
- package/src/AlteriomPainlessMesh.h +3 -3
- package/src/arduino/wifi.hpp +850 -547
- package/src/painlessMesh.h +2 -2
- package/src/painlessMeshSTA.cpp +11 -2
- package/src/painlessmesh/mesh.hpp +5 -1
- package/src/painlessmesh/tcp.hpp +5 -1
package/src/painlessMesh.h
CHANGED
|
@@ -5,8 +5,8 @@
|
|
|
5
5
|
* @file painlessMesh.h
|
|
6
6
|
* @brief Main header file for Alteriom painlessMesh library
|
|
7
7
|
*
|
|
8
|
-
* @version 1.
|
|
9
|
-
* @date 2025-
|
|
8
|
+
* @version 1.9.7
|
|
9
|
+
* @date 2025-12-13
|
|
10
10
|
*
|
|
11
11
|
* painlessMesh is a user-friendly library for creating mesh networks with
|
|
12
12
|
* ESP8266 and ESP32 devices. This Alteriom fork includes additional packages
|
package/src/painlessMeshSTA.cpp
CHANGED
|
@@ -233,10 +233,19 @@ void ICACHE_FLASH_ATTR StationScan::connectToAP() {
|
|
|
233
233
|
Log(CONNECTION,
|
|
234
234
|
"connectToAP(): Restarting AP from channel %d to channel %d\n",
|
|
235
235
|
oldChannel, detectedChannel);
|
|
236
|
-
|
|
237
|
-
|
|
236
|
+
|
|
237
|
+
// Disconnect AP and allow WiFi stack to fully reset
|
|
238
|
+
// Using true parameter ensures DHCP server is properly stopped
|
|
239
|
+
WiFi.softAPdisconnect(true);
|
|
240
|
+
delay(200); // Increased delay to ensure complete WiFi stack reset
|
|
241
|
+
|
|
238
242
|
// Call apInit via friend class access (StationScan is friend of wifi::Mesh)
|
|
239
243
|
mesh->apInit(mesh->getNodeId());
|
|
244
|
+
|
|
245
|
+
// Additional stabilization delay after AP restart
|
|
246
|
+
// This ensures DHCP server is fully initialized before clients connect
|
|
247
|
+
delay(100);
|
|
248
|
+
|
|
240
249
|
Log(CONNECTION, "connectToAP(): AP restarted on channel %d\n", detectedChannel);
|
|
241
250
|
}
|
|
242
251
|
// Reset counter only when mesh is found on a new channel
|
|
@@ -3134,7 +3134,11 @@ class Mesh : public ntp::MeshTime, public plugin::PackageHandler<T> {
|
|
|
3134
3134
|
using namespace logger;
|
|
3135
3135
|
Log(CONNECTION, "eraseClosedConnections():\n");
|
|
3136
3136
|
this->subs.remove_if(
|
|
3137
|
-
[](const std::shared_ptr<T> &conn) {
|
|
3137
|
+
[](const std::shared_ptr<T> &conn) {
|
|
3138
|
+
// Null check for safety - should never happen but prevents crashes
|
|
3139
|
+
if (!conn) return true;
|
|
3140
|
+
return !conn->connected();
|
|
3141
|
+
});
|
|
3138
3142
|
}
|
|
3139
3143
|
|
|
3140
3144
|
public: // Windows MSVC: TCP lambdas need access to droppedConnectionCallbacks
|
package/src/painlessmesh/tcp.hpp
CHANGED
|
@@ -142,7 +142,11 @@ void connect(AsyncClient &client, IPAddress ip, uint16_t port, M &mesh,
|
|
|
142
142
|
TCP_CONNECT_MAX_RETRIES + 1);
|
|
143
143
|
delete client;
|
|
144
144
|
#endif
|
|
145
|
-
|
|
145
|
+
// Defer callback execution to avoid crashes in error handler context
|
|
146
|
+
// Execute callbacks after semaphore is released and error handler completes
|
|
147
|
+
mesh.addTask([&mesh]() {
|
|
148
|
+
mesh.droppedConnectionCallbacks.execute(0, true);
|
|
149
|
+
});
|
|
146
150
|
mesh.semaphoreGive();
|
|
147
151
|
}
|
|
148
152
|
});
|