@alteriom/painlessmesh 1.7.9 → 1.8.1
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 +118 -2
- package/README.md +159 -12
- package/docs/BRIDGE_FAILOVER.md +512 -0
- package/docs/BRIDGE_HEALTH_MONITORING.md +293 -0
- package/docs/CREATE_MISSING_RELEASES.md +321 -0
- package/docs/releases/RELEASE_SUMMARY_v1.7.8.md +523 -0
- package/docs/releases/RELEASE_SUMMARY_v1.7.9.md +542 -0
- package/examples/alteriom/alteriom_sensor_package.hpp +213 -0
- package/examples/alteriomSensorNode/alteriom_sensor_package.hpp +1014 -11
- package/examples/basic/basic.ino +6 -2
- package/examples/bridge/bridge.ino +44 -23
- package/examples/bridge/bridge_health_monitoring_example.ino +188 -0
- package/examples/bridgeAwareSensorNode/alteriom_sensor_package.hpp +1227 -0
- package/examples/bridgeAwareSensorNode/bridgeAwareSensorNode.ino +343 -0
- package/examples/bridgeAwareSensorNode/platformio.ini +26 -0
- package/examples/bridge_failover/README.md +358 -0
- package/examples/bridge_failover/bridge_failover.ino +180 -0
- package/examples/bridge_failover/platformio.ini +27 -0
- package/examples/diagnosticsExample/diagnosticsExample.ino +171 -0
- package/examples/diagnosticsExample/platformio.ini +26 -0
- package/examples/multi_bridge/README.md +346 -0
- package/examples/multi_bridge/primary_bridge.ino +96 -0
- package/examples/multi_bridge/regular_node.ino +141 -0
- package/examples/multi_bridge/secondary_bridge.ino +111 -0
- package/examples/ntpTimeSyncBridge/alteriom_sensor_package.hpp +1383 -0
- package/examples/ntpTimeSyncBridge/ntpTimeSyncBridge.ino +81 -0
- package/examples/ntpTimeSyncNode/alteriom_sensor_package.hpp +1383 -0
- package/examples/ntpTimeSyncNode/ntpTimeSyncNode.ino +109 -0
- package/examples/queued_alarms/README.md +390 -0
- package/examples/queued_alarms/queued_alarms.ino +265 -0
- package/examples/rtcIntegration/README.md +235 -0
- package/examples/rtcIntegration/rtcIntegration.ino +196 -0
- package/library.json +1 -1
- package/library.properties +1 -1
- package/package.json +1 -1
- package/src/arduino/wifi.hpp +888 -0
- package/src/painlessMeshSTA.cpp +63 -0
- package/src/painlessMeshSTA.h +3 -0
- package/src/painlessmesh/mesh.hpp +1327 -4
- package/src/painlessmesh/message_queue.hpp +368 -0
- package/src/painlessmesh/plugin.hpp +69 -0
- package/src/painlessmesh/rtc.hpp +203 -0
package/src/painlessMeshSTA.cpp
CHANGED
|
@@ -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);
|
|
@@ -238,4 +254,51 @@ void ICACHE_FLASH_ATTR StationScan::connectToAP() {
|
|
|
238
254
|
}
|
|
239
255
|
}
|
|
240
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
|
+
|
|
241
304
|
#endif
|
package/src/painlessMeshSTA.h
CHANGED
|
@@ -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;
|