@alteriom/painlessmesh 1.7.8 → 1.8.0

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.
Files changed (59) hide show
  1. package/CHANGELOG.md +139 -3
  2. package/README.md +114 -4
  3. package/RELEASE_GUIDE.md +57 -8
  4. package/docs/BRIDGE_FAILOVER.md +512 -0
  5. package/docs/BRIDGE_HEALTH_MONITORING.md +293 -0
  6. package/docs/CREATE_MISSING_RELEASES.md +321 -0
  7. package/docs/README.md +2 -1
  8. package/docs/RELEASE_AGENT_SUMMARY.md +386 -0
  9. package/docs/releases/RELEASE_SUMMARY_v1.7.8.md +523 -0
  10. package/docs/releases/RELEASE_SUMMARY_v1.7.9.md +542 -0
  11. package/docs/troubleshooting/ESP32_C6_COMPATIBILITY.md +157 -0
  12. package/docs/troubleshooting/common-issues.md +28 -0
  13. package/examples/alteriom/alteriom_sensor_package.hpp +233 -1
  14. package/examples/alteriom/platformio.ini +1 -1
  15. package/examples/alteriomImproved/platformio.ini +1 -1
  16. package/examples/alteriomMetricsHealth/metrics_health_node.ino +18 -7
  17. package/examples/alteriomMetricsHealth/platformio.ini +1 -1
  18. package/examples/alteriomPhase1/platformio.ini +1 -1
  19. package/examples/alteriomPhase2/platformio.ini +1 -1
  20. package/examples/alteriomSensorNode/alteriom_sensor_package.hpp +1014 -11
  21. package/examples/alteriomSensorNode/platformio.ini +1 -1
  22. package/examples/basic/basic.ino +6 -2
  23. package/examples/basic/platformio.ini +1 -1
  24. package/examples/bridge/alteriom_sensor_package.hpp +1170 -0
  25. package/examples/bridge/bridge.ino +44 -23
  26. package/examples/bridge/bridge_health_monitoring_example.ino +188 -0
  27. package/examples/bridge/enhanced_mqtt_bridge.hpp +1 -1
  28. package/examples/bridge/mqtt_command_bridge.hpp +2 -2
  29. package/examples/bridge/platformio.ini +2 -1
  30. package/examples/bridgeAwareSensorNode/alteriom_sensor_package.hpp +1227 -0
  31. package/examples/bridgeAwareSensorNode/bridgeAwareSensorNode.ino +343 -0
  32. package/examples/bridgeAwareSensorNode/platformio.ini +26 -0
  33. package/examples/bridge_failover/README.md +358 -0
  34. package/examples/bridge_failover/bridge_failover.ino +180 -0
  35. package/examples/bridge_failover/platformio.ini +27 -0
  36. package/examples/diagnosticsExample/diagnosticsExample.ino +171 -0
  37. package/examples/diagnosticsExample/platformio.ini +26 -0
  38. package/examples/echoNode/platformio.ini +1 -1
  39. package/examples/logClient/platformio.ini +1 -1
  40. package/examples/logServer/platformio.ini +1 -1
  41. package/examples/mqttStatusBridge/platformio.ini +1 -1
  42. package/examples/namedMesh/platformio.ini +1 -1
  43. package/examples/ntpTimeSyncBridge/alteriom_sensor_package.hpp +1383 -0
  44. package/examples/ntpTimeSyncBridge/ntpTimeSyncBridge.ino +81 -0
  45. package/examples/ntpTimeSyncNode/alteriom_sensor_package.hpp +1383 -0
  46. package/examples/ntpTimeSyncNode/ntpTimeSyncNode.ino +109 -0
  47. package/examples/otaReceiver/platformio.ini +1 -1
  48. package/examples/rtcIntegration/README.md +235 -0
  49. package/examples/rtcIntegration/rtcIntegration.ino +196 -0
  50. package/examples/startHere/platformio.ini +1 -1
  51. package/examples/webServer/platformio.ini +1 -1
  52. package/library.json +93 -53
  53. package/library.properties +1 -1
  54. package/package.json +2 -2
  55. package/src/arduino/wifi.hpp +581 -0
  56. package/src/painlessMeshSTA.cpp +68 -0
  57. package/src/painlessMeshSTA.h +3 -0
  58. package/src/painlessmesh/mesh.hpp +1127 -4
  59. package/src/painlessmesh/rtc.hpp +203 -0
@@ -40,6 +40,22 @@ void ICACHE_FLASH_ATTR StationScan::init(painlessmesh::wifi::Mesh *pMesh,
40
40
  void ICACHE_FLASH_ATTR StationScan::stationScan() {
41
41
  using namespace painlessmesh::logger;
42
42
  Log(CONNECTION, "stationScan(): %s\n", ssid.c_str());
43
+
44
+ // If channel is 0, auto-detect the mesh channel first
45
+ if (channel == 0 && mesh->_meshChannel == 0) {
46
+ Log(STARTUP, "stationScan(): Auto-detecting mesh channel...\n");
47
+ uint8_t detectedChannel = scanForMeshChannel(ssid, hidden);
48
+ if (detectedChannel > 0) {
49
+ mesh->_meshChannel = detectedChannel;
50
+ channel = detectedChannel;
51
+ Log(STARTUP, "stationScan(): Mesh channel auto-detected: %d\n", detectedChannel);
52
+ } else {
53
+ // Mesh not found, fall back to channel 1
54
+ mesh->_meshChannel = 1;
55
+ channel = 1;
56
+ Log(CONNECTION, "stationScan(): Mesh not found, falling back to channel 1\n");
57
+ }
58
+ }
43
59
 
44
60
  #ifdef ESP32
45
61
  WiFi.scanNetworks(true, hidden, false, 300U, channel);
@@ -145,6 +161,11 @@ void ICACHE_FLASH_ATTR StationScan::requestIP(WiFi_AP_Record_t &ap) {
145
161
  using namespace painlessmesh::logger;
146
162
  Log(CONNECTION, "connectToAP(): Best AP is %u<---\n",
147
163
  painlessmesh::tcp::encodeNodeId(ap.bssid));
164
+ Log(CONNECTION, "requestIP(): Connecting to %s (channel: %d, BSSID: %02X:%02X:%02X:%02X:%02X:%02X)\n",
165
+ ap.ssid.c_str(),
166
+ mesh->_meshChannel,
167
+ ap.bssid[0], ap.bssid[1], ap.bssid[2],
168
+ ap.bssid[3], ap.bssid[4], ap.bssid[5]);
148
169
  WiFi.begin(ap.ssid.c_str(), password.c_str(), mesh->_meshChannel, ap.bssid);
149
170
  return;
150
171
  }
@@ -233,4 +254,51 @@ void ICACHE_FLASH_ATTR StationScan::connectToAP() {
233
254
  }
234
255
  }
235
256
  }
257
+
258
+ // Helper function to scan all channels for a specific mesh SSID
259
+ // Returns the channel number if found, or 0 if not found
260
+ uint8_t ICACHE_FLASH_ATTR StationScan::scanForMeshChannel(TSTRING meshSSID, bool meshHidden) {
261
+ using namespace painlessmesh::logger;
262
+ Log(CONNECTION, "scanForMeshChannel(): Scanning all channels for mesh '%s'...\n", meshSSID.c_str());
263
+
264
+ // Scan all channels (0 means scan all)
265
+ #ifdef ESP32
266
+ int16_t numNetworks = WiFi.scanNetworks(false, meshHidden, false, 300U, 0);
267
+ #elif defined(ESP8266)
268
+ int16_t numNetworks = WiFi.scanNetworks(false, meshHidden, 0);
269
+ #endif
270
+
271
+ if (numNetworks == WIFI_SCAN_FAILED) {
272
+ Log(ERROR, "scanForMeshChannel(): WiFi scan failed\n");
273
+ return 0;
274
+ }
275
+
276
+ Log(CONNECTION, "scanForMeshChannel(): Found %d networks\n", numNetworks);
277
+
278
+ // Search for the mesh SSID in scan results
279
+ for (int16_t i = 0; i < numNetworks; ++i) {
280
+ TSTRING foundSSID = WiFi.SSID(i);
281
+ uint8_t foundChannel = WiFi.channel(i);
282
+ int32_t rssi = WiFi.RSSI(i);
283
+
284
+ // Check if this is our mesh network
285
+ if (foundSSID == meshSSID || (foundSSID == "" && meshHidden)) {
286
+ // Validate channel is in valid range (1-13 for 2.4GHz)
287
+ if (foundChannel >= 1 && foundChannel <= 13) {
288
+ Log(CONNECTION, "scanForMeshChannel(): Found mesh on channel %d (RSSI: %d)\n",
289
+ foundChannel, rssi);
290
+ WiFi.scanDelete();
291
+ return foundChannel;
292
+ } else {
293
+ Log(ERROR, "scanForMeshChannel(): Found mesh on invalid channel %d, ignoring\n",
294
+ foundChannel);
295
+ }
296
+ }
297
+ }
298
+
299
+ Log(CONNECTION, "scanForMeshChannel(): Mesh '%s' not found on any channel\n", meshSSID.c_str());
300
+ WiFi.scanDelete();
301
+ return 0; // Not found
302
+ }
303
+
236
304
  #endif
@@ -33,6 +33,9 @@ class StationScan {
33
33
  void yieldConnectToAP() {
34
34
  task.yield([this]() { connectToAP(); });
35
35
  }
36
+
37
+ // Helper to scan all channels for a specific mesh SSID
38
+ static uint8_t scanForMeshChannel(TSTRING meshSSID, bool meshHidden);
36
39
 
37
40
  /// Valid APs found during the last scan
38
41
  std::list<WiFi_AP_Record_t> lastAPs;