@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.
- package/CHANGELOG.md +139 -3
- package/README.md +114 -4
- package/RELEASE_GUIDE.md +57 -8
- 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/README.md +2 -1
- package/docs/RELEASE_AGENT_SUMMARY.md +386 -0
- package/docs/releases/RELEASE_SUMMARY_v1.7.8.md +523 -0
- package/docs/releases/RELEASE_SUMMARY_v1.7.9.md +542 -0
- package/docs/troubleshooting/ESP32_C6_COMPATIBILITY.md +157 -0
- package/docs/troubleshooting/common-issues.md +28 -0
- package/examples/alteriom/alteriom_sensor_package.hpp +233 -1
- package/examples/alteriom/platformio.ini +1 -1
- package/examples/alteriomImproved/platformio.ini +1 -1
- package/examples/alteriomMetricsHealth/metrics_health_node.ino +18 -7
- package/examples/alteriomMetricsHealth/platformio.ini +1 -1
- package/examples/alteriomPhase1/platformio.ini +1 -1
- package/examples/alteriomPhase2/platformio.ini +1 -1
- package/examples/alteriomSensorNode/alteriom_sensor_package.hpp +1014 -11
- package/examples/alteriomSensorNode/platformio.ini +1 -1
- package/examples/basic/basic.ino +6 -2
- package/examples/basic/platformio.ini +1 -1
- package/examples/bridge/alteriom_sensor_package.hpp +1170 -0
- package/examples/bridge/bridge.ino +44 -23
- package/examples/bridge/bridge_health_monitoring_example.ino +188 -0
- package/examples/bridge/enhanced_mqtt_bridge.hpp +1 -1
- package/examples/bridge/mqtt_command_bridge.hpp +2 -2
- package/examples/bridge/platformio.ini +2 -1
- 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/echoNode/platformio.ini +1 -1
- package/examples/logClient/platformio.ini +1 -1
- package/examples/logServer/platformio.ini +1 -1
- package/examples/mqttStatusBridge/platformio.ini +1 -1
- package/examples/namedMesh/platformio.ini +1 -1
- 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/otaReceiver/platformio.ini +1 -1
- package/examples/rtcIntegration/README.md +235 -0
- package/examples/rtcIntegration/rtcIntegration.ino +196 -0
- package/examples/startHere/platformio.ini +1 -1
- package/examples/webServer/platformio.ini +1 -1
- package/library.json +93 -53
- package/library.properties +1 -1
- package/package.json +2 -2
- package/src/arduino/wifi.hpp +581 -0
- package/src/painlessMeshSTA.cpp +68 -0
- package/src/painlessMeshSTA.h +3 -0
- package/src/painlessmesh/mesh.hpp +1127 -4
- package/src/painlessmesh/rtc.hpp +203 -0
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file ntpTimeSyncBridge.ino
|
|
3
|
+
* @brief Example: Bridge node with NTP time synchronization
|
|
4
|
+
*
|
|
5
|
+
* This example demonstrates a bridge node that:
|
|
6
|
+
* 1. Connects to WiFi router (bridge mode)
|
|
7
|
+
* 2. Queries NTP server for accurate time
|
|
8
|
+
* 3. Broadcasts NTP time to mesh nodes via NTPTimeSyncPackage
|
|
9
|
+
*
|
|
10
|
+
* Regular mesh nodes can receive this broadcast and sync their local time,
|
|
11
|
+
* eliminating the need for each node to query NTP individually.
|
|
12
|
+
*/
|
|
13
|
+
|
|
14
|
+
#include "painlessMesh.h"
|
|
15
|
+
#include "examples/alteriom/alteriom_sensor_package.hpp"
|
|
16
|
+
|
|
17
|
+
// Mesh configuration
|
|
18
|
+
#define MESH_PREFIX "AlteriomMesh"
|
|
19
|
+
#define MESH_PASSWORD "your_mesh_password"
|
|
20
|
+
#define MESH_PORT 5555
|
|
21
|
+
|
|
22
|
+
// WiFi router configuration (for bridge)
|
|
23
|
+
#define ROUTER_SSID "your_router_ssid"
|
|
24
|
+
#define ROUTER_PASSWORD "your_router_password"
|
|
25
|
+
|
|
26
|
+
// NTP configuration
|
|
27
|
+
#define NTP_SERVER "pool.ntp.org"
|
|
28
|
+
#define NTP_OFFSET 0 // Timezone offset in seconds (0 = UTC)
|
|
29
|
+
#define NTP_INTERVAL 60000 // Update interval in milliseconds
|
|
30
|
+
|
|
31
|
+
Scheduler userScheduler;
|
|
32
|
+
painlessMesh mesh;
|
|
33
|
+
|
|
34
|
+
using namespace alteriom;
|
|
35
|
+
|
|
36
|
+
// Task to broadcast NTP time periodically
|
|
37
|
+
Task taskBroadcastNTP(NTP_INTERVAL, TASK_FOREVER, [](){
|
|
38
|
+
// Create NTP time sync package
|
|
39
|
+
auto pkg = NTPTimeSyncPackage();
|
|
40
|
+
pkg.from = mesh.getNodeId();
|
|
41
|
+
|
|
42
|
+
// Get NTP time from mesh (if available)
|
|
43
|
+
pkg.ntpTime = mesh.getNodeTime() / 1000000; // Convert to seconds
|
|
44
|
+
pkg.accuracy = 50; // Estimate 50ms uncertainty
|
|
45
|
+
pkg.source = NTP_SERVER;
|
|
46
|
+
pkg.timestamp = millis();
|
|
47
|
+
|
|
48
|
+
// Serialize and broadcast to mesh
|
|
49
|
+
String msg = pkg.toJson();
|
|
50
|
+
mesh.sendBroadcast(msg);
|
|
51
|
+
|
|
52
|
+
Serial.printf("Broadcast NTP time: %u from %s (accuracy: %ums)\n",
|
|
53
|
+
pkg.ntpTime, pkg.source.c_str(), pkg.accuracy);
|
|
54
|
+
});
|
|
55
|
+
|
|
56
|
+
void setup() {
|
|
57
|
+
Serial.begin(115200);
|
|
58
|
+
|
|
59
|
+
// Initialize mesh
|
|
60
|
+
mesh.setDebugMsgTypes(ERROR | STARTUP | CONNECTION);
|
|
61
|
+
mesh.init(MESH_PREFIX, MESH_PASSWORD, &userScheduler, MESH_PORT);
|
|
62
|
+
|
|
63
|
+
// Configure as bridge (connects to router)
|
|
64
|
+
mesh.stationManual(ROUTER_SSID, ROUTER_PASSWORD);
|
|
65
|
+
mesh.setHostname("AlteriomBridge");
|
|
66
|
+
|
|
67
|
+
// Set root node (optional, helps with mesh stability)
|
|
68
|
+
mesh.setRoot(true);
|
|
69
|
+
mesh.setContainsRoot(true);
|
|
70
|
+
|
|
71
|
+
// Add NTP broadcast task
|
|
72
|
+
userScheduler.addTask(taskBroadcastNTP);
|
|
73
|
+
taskBroadcastNTP.enable();
|
|
74
|
+
|
|
75
|
+
Serial.println("Bridge node with NTP time sync initialized");
|
|
76
|
+
Serial.printf("Broadcasting NTP time every %d seconds\n", NTP_INTERVAL / 1000);
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
void loop() {
|
|
80
|
+
mesh.update();
|
|
81
|
+
}
|