@alteriom/painlessmesh 1.8.10 → 1.8.12
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 +71 -12
- package/DOCUMENTATION_INDEX.md +146 -0
- package/README.md +1 -1
- package/RELEASE_NOTES_1.8.12.md +96 -0
- package/docs/CHANNEL_SYNCHRONIZATION.md +209 -0
- package/docs/releases/RELEASE_CHECKLIST_1.8.10.md +331 -0
- package/docs/releases/RELEASE_CHECKLIST_1.8.9.md +207 -0
- package/docs/releases/RELEASE_NOTES_1.8.10.md +239 -0
- package/docs/releases/RELEASE_NOTES_1.8.9.md +213 -0
- package/docs/releases/RELEASE_SUMMARY_1.8.10.md +193 -0
- package/examples/rtcIntegration/README.md +59 -0
- package/examples/rtcIntegration/rtcIntegration.ino +14 -0
- package/library.json +1 -1
- package/library.properties +1 -1
- package/package.json +7 -3
- package/src/AlteriomPainlessMesh.h +2 -2
- package/src/arduino/wifi.hpp +73 -26
- package/src/painlessMesh.h +2 -2
- package/src/painlessMeshSTA.cpp +46 -0
- package/src/painlessMeshSTA.h +14 -0
- package/src/painlessmesh/buffer.hpp +3 -3
- package/src/painlessmesh/layout.hpp +6 -2
- package/src/painlessmesh/mesh.hpp +61 -5
- package/src/painlessmesh/message_queue.hpp +3 -3
- package/src/painlessmesh/ntp.hpp +18 -2
- package/src/painlessmesh/protocol.hpp +10 -1
- package/src/painlessmesh/router.hpp +4 -4
|
@@ -123,23 +123,27 @@ class NodeTree : public PackageInterface {
|
|
|
123
123
|
public:
|
|
124
124
|
uint32_t nodeId = 0;
|
|
125
125
|
bool root = false;
|
|
126
|
+
bool hasTimeAuthority = false; // True if node has RTC or Internet time source
|
|
126
127
|
std::list<NodeTree> subs;
|
|
127
128
|
|
|
128
129
|
NodeTree() {}
|
|
129
130
|
virtual ~NodeTree() = default; // Add virtual destructor
|
|
130
131
|
|
|
131
|
-
NodeTree(uint32_t nodeID, bool iAmRoot) {
|
|
132
|
+
NodeTree(uint32_t nodeID, bool iAmRoot, bool timeAuthority = false) {
|
|
132
133
|
nodeId = nodeID;
|
|
133
134
|
root = iAmRoot;
|
|
135
|
+
hasTimeAuthority = timeAuthority;
|
|
134
136
|
}
|
|
135
137
|
|
|
136
138
|
NodeTree(JsonObject jsonObj) {
|
|
137
139
|
#if ARDUINOJSON_VERSION_MAJOR < 7
|
|
138
140
|
if (jsonObj.containsKey("root")) root = jsonObj["root"].as<bool>();
|
|
141
|
+
if (jsonObj.containsKey("hasTimeAuthority")) hasTimeAuthority = jsonObj["hasTimeAuthority"].as<bool>();
|
|
139
142
|
if (jsonObj.containsKey("nodeId"))
|
|
140
143
|
#else
|
|
141
144
|
|
|
142
145
|
if (jsonObj["root"].is<bool>()) root = jsonObj["root"].as<bool>();
|
|
146
|
+
if (jsonObj["hasTimeAuthority"].is<bool>()) hasTimeAuthority = jsonObj["hasTimeAuthority"].as<bool>();
|
|
143
147
|
if (jsonObj["nodeId"].is<uint32_t>())
|
|
144
148
|
#endif
|
|
145
149
|
nodeId = jsonObj["nodeId"].as<uint32_t>();
|
|
@@ -161,6 +165,7 @@ class NodeTree : public PackageInterface {
|
|
|
161
165
|
JsonObject addTo(JsonObject&& jsonObj) const {
|
|
162
166
|
jsonObj["nodeId"] = nodeId;
|
|
163
167
|
if (root) jsonObj["root"] = root;
|
|
168
|
+
if (hasTimeAuthority) jsonObj["hasTimeAuthority"] = hasTimeAuthority;
|
|
164
169
|
if (subs.size() > 0) {
|
|
165
170
|
#if ARDUINOJSON_VERSION_MAJOR == 7
|
|
166
171
|
JsonArray subsArr = jsonObj["subs"].to<JsonArray>();
|
|
@@ -181,6 +186,7 @@ class NodeTree : public PackageInterface {
|
|
|
181
186
|
|
|
182
187
|
bool operator==(const NodeTree& b) const {
|
|
183
188
|
if (!(this->nodeId == b.nodeId && this->root == b.root &&
|
|
189
|
+
this->hasTimeAuthority == b.hasTimeAuthority &&
|
|
184
190
|
this->subs.size() == b.subs.size()))
|
|
185
191
|
return false;
|
|
186
192
|
auto itA = this->subs.begin();
|
|
@@ -203,6 +209,7 @@ class NodeTree : public PackageInterface {
|
|
|
203
209
|
size_t jsonObjectSize() const {
|
|
204
210
|
size_t base = 1;
|
|
205
211
|
if (root) ++base;
|
|
212
|
+
if (hasTimeAuthority) ++base;
|
|
206
213
|
if (subs.size() > 0) ++base;
|
|
207
214
|
size_t size = JSON_OBJECT_SIZE(base);
|
|
208
215
|
if (subs.size() > 0) size += JSON_ARRAY_SIZE(subs.size());
|
|
@@ -215,6 +222,7 @@ class NodeTree : public PackageInterface {
|
|
|
215
222
|
nodeId = 0;
|
|
216
223
|
subs.clear();
|
|
217
224
|
root = false;
|
|
225
|
+
hasTimeAuthority = false;
|
|
218
226
|
}
|
|
219
227
|
};
|
|
220
228
|
|
|
@@ -263,6 +271,7 @@ class NodeSyncRequest : public NodeTree {
|
|
|
263
271
|
size_t jsonObjectSize() const {
|
|
264
272
|
size_t base = 4;
|
|
265
273
|
if (root) ++base;
|
|
274
|
+
if (hasTimeAuthority) ++base;
|
|
266
275
|
if (subs.size() > 0) ++base;
|
|
267
276
|
size_t size = JSON_OBJECT_SIZE(base);
|
|
268
277
|
if (subs.size() > 0) size += JSON_ARRAY_SIZE(subs.size());
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
#ifndef _PAINLESS_MESH_ROUTER_HPP_
|
|
1
|
+
#ifndef _PAINLESS_MESH_ROUTER_HPP_
|
|
2
2
|
#define _PAINLESS_MESH_ROUTER_HPP_
|
|
3
3
|
|
|
4
4
|
#include <algorithm>
|
|
@@ -235,14 +235,14 @@ void routePackage(layout::Layout<T> layout, std::shared_ptr<T> connection,
|
|
|
235
235
|
// Base capacity: message length + overhead for JSON structure
|
|
236
236
|
// Each nesting level adds overhead for pointers and metadata
|
|
237
237
|
size_t calculatedCapacity = pkg.length() +
|
|
238
|
-
JSON_OBJECT_SIZE(10) * std::max(nestingDepth, size_t(1)) +
|
|
238
|
+
JSON_OBJECT_SIZE(10) * (std::max)(nestingDepth, size_t(1)) +
|
|
239
239
|
512; // Additional buffer for strings and padding
|
|
240
240
|
#endif
|
|
241
241
|
|
|
242
242
|
// Cap at 8KB for safety on ESP8266 (which has ~80KB total heap)
|
|
243
243
|
// Messages larger than this should be rejected
|
|
244
244
|
constexpr size_t MAX_MESSAGE_CAPACITY = 8192;
|
|
245
|
-
size_t capacity = std::min(calculatedCapacity, MAX_MESSAGE_CAPACITY);
|
|
245
|
+
size_t capacity = (std::min)(calculatedCapacity, MAX_MESSAGE_CAPACITY);
|
|
246
246
|
|
|
247
247
|
auto variant = std::make_shared<protocol::Variant>(pkg, capacity);
|
|
248
248
|
|
|
@@ -330,7 +330,7 @@ void handleNodeSync(T& mesh, protocol::NodeTree newTree,
|
|
|
330
330
|
[&mesh, nodeId]() { mesh.changedConnectionCallbacks.execute(nodeId); });
|
|
331
331
|
} else {
|
|
332
332
|
conn->nodeSyncTask.delay();
|
|
333
|
-
mesh.stability += std::min(1000 - mesh.stability, (size_t)25);
|
|
333
|
+
mesh.stability += (std::min)(1000 - mesh.stability, (size_t)25);
|
|
334
334
|
}
|
|
335
335
|
}
|
|
336
336
|
|