@alteriom/painlessmesh 1.8.12 → 1.8.13

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/library.json CHANGED
@@ -6,7 +6,7 @@
6
6
  "type": "git",
7
7
  "url": "https://github.com/Alteriom/painlessMesh"
8
8
  },
9
- "version": "1.8.12",
9
+ "version": "1.8.13",
10
10
  "frameworks": [
11
11
  "arduino"
12
12
  ],
@@ -1,5 +1,5 @@
1
1
  name=Alteriom PainlessMesh
2
- version=1.8.12
2
+ version=1.8.13
3
3
  author=Coopdis,Scotty Franzyshen,Edwin van Leeuwen,Germán Martín,Maximilian Schwarz,Doanh Doanh,Alteriom
4
4
  maintainer=Alteriom
5
5
  sentence=A painless way to setup a mesh with ESP8266 and ESP32 devices with Alteriom extensions
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@alteriom/painlessmesh",
3
- "version": "1.8.12",
3
+ "version": "1.8.13",
4
4
  "description": "painlessMesh is a user-friendly library for creating mesh networks with ESP8266 and ESP32 devices. This Alteriom fork includes additional packages for sensor data (SensorPackage), device commands (CommandPackage), and status monitoring (StatusPackage). It handles routing and network management automatically, so you can focus on your application. The library uses JSON-based messaging and syncs time across all nodes, making it ideal for coordinated behaviour like synchronized light displays or sensor networks reporting to a central node.",
5
5
  "keywords": [
6
6
  "arduino",
@@ -85,6 +85,6 @@
85
85
  "CHANGELOG.md",
86
86
  "RELEASE_GUIDE.md",
87
87
  "DOCUMENTATION_INDEX.md",
88
- "RELEASE_NOTES_1.8.12.md"
88
+ "RELEASE_NOTES_1.8.13.md"
89
89
  ]
90
90
  }
@@ -29,10 +29,10 @@
29
29
  /**
30
30
  * @brief AlteriomPainlessMesh library version information
31
31
  */
32
- #define ALTERIOM_PAINLESS_MESH_VERSION "1.8.12"
32
+ #define ALTERIOM_PAINLESS_MESH_VERSION "1.8.13"
33
33
  #define ALTERIOM_PAINLESS_MESH_VERSION_MAJOR 1
34
34
  #define ALTERIOM_PAINLESS_MESH_VERSION_MINOR 8
35
- #define ALTERIOM_PAINLESS_MESH_VERSION_PATCH 12
35
+ #define ALTERIOM_PAINLESS_MESH_VERSION_PATCH 13
36
36
 
37
37
  /**
38
38
  * @brief Library description and usage information
@@ -89,9 +89,9 @@ class Mesh : public painlessmesh::Mesh<Connection> {
89
89
 
90
90
  this->init(nodeId);
91
91
 
92
- // Add bridge election package handler (Type 611)
92
+ // Add bridge election package handler (Type BRIDGE_ELECTION)
93
93
  this->callbackList.onPackage(
94
- 611, // BRIDGE_ELECTION type
94
+ protocol::BRIDGE_ELECTION,
95
95
  [this](protocol::Variant& variant, std::shared_ptr<Connection>, uint32_t) {
96
96
  JsonDocument doc;
97
97
  TSTRING str;
@@ -113,9 +113,9 @@ class Mesh : public painlessmesh::Mesh<Connection> {
113
113
  return false; // Don't consume the package
114
114
  });
115
115
 
116
- // Add bridge takeover package handler (Type 612)
116
+ // Add bridge takeover package handler (Type BRIDGE_TAKEOVER)
117
117
  this->callbackList.onPackage(
118
- 612, // BRIDGE_TAKEOVER type
118
+ protocol::BRIDGE_TAKEOVER,
119
119
  [this](protocol::Variant& variant, std::shared_ptr<Connection>, uint32_t) {
120
120
  JsonDocument doc;
121
121
  TSTRING str;
@@ -817,7 +817,7 @@ class Mesh : public painlessmesh::Mesh<Connection> {
817
817
  JsonDocument doc;
818
818
  JsonObject obj = doc.to<JsonObject>();
819
819
 
820
- obj["type"] = 610; // BRIDGE_STATUS type
820
+ obj["type"] = protocol::BRIDGE_STATUS;
821
821
  obj["from"] = this->nodeId;
822
822
  obj["routing"] = 1; // SINGLE routing (direct to node)
823
823
  obj["dest"] = nodeId;
@@ -830,7 +830,7 @@ class Mesh : public painlessmesh::Mesh<Connection> {
830
830
  obj["routerChannel"] = WiFi.channel();
831
831
  obj["uptime"] = millis();
832
832
  obj["gatewayIP"] = WiFi.gatewayIP().toString();
833
- obj["message_type"] = 610;
833
+ obj["message_type"] = protocol::BRIDGE_STATUS;
834
834
 
835
835
  String msg;
836
836
  serializeJson(doc, msg);
@@ -838,8 +838,10 @@ class Mesh : public painlessmesh::Mesh<Connection> {
838
838
  Log(CONNECTION, "Sending bridge status directly to node %u (Internet: %s)\n",
839
839
  nodeId, hasInternet ? "YES" : "NO");
840
840
 
841
- // Send directly to the new node using routing table (which is now ready)
842
- this->sendSingle(nodeId, msg);
841
+ // Send directly to the new node using raw message to preserve type BRIDGE_STATUS
842
+ // Using sendSingle() would wrap it in type 1 (SINGLE) and hide type BRIDGE_STATUS
843
+ protocol::Variant variant(msg);
844
+ router::send<Connection>(variant, (*this));
843
845
  });
844
846
  });
845
847
 
@@ -1072,7 +1074,7 @@ class Mesh : public painlessmesh::Mesh<Connection> {
1072
1074
  // Broadcast candidacy using JSON directly (avoiding dependency on alteriom package)
1073
1075
  JsonDocument doc;
1074
1076
  JsonObject obj = doc.to<JsonObject>();
1075
- obj["type"] = 611; // BRIDGE_ELECTION
1077
+ obj["type"] = protocol::BRIDGE_ELECTION;
1076
1078
  obj["from"] = this->nodeId;
1077
1079
  obj["routing"] = 2; // BROADCAST
1078
1080
  obj["routerRSSI"] = routerRSSI;
@@ -1080,11 +1082,14 @@ class Mesh : public painlessmesh::Mesh<Connection> {
1080
1082
  obj["freeMemory"] = ESP.getFreeHeap();
1081
1083
  obj["timestamp"] = this->getNodeTime();
1082
1084
  obj["routerSSID"] = routerSSID;
1083
- obj["message_type"] = 611;
1085
+ obj["message_type"] = protocol::BRIDGE_ELECTION;
1084
1086
 
1085
1087
  String msg;
1086
1088
  serializeJson(doc, msg);
1087
- this->sendBroadcast(msg);
1089
+
1090
+ // Send election message using raw broadcast to preserve type BRIDGE_ELECTION
1091
+ protocol::Variant variant(msg);
1092
+ router::broadcast<protocol::Variant, Connection>(variant, (*this), 0);
1088
1093
 
1089
1094
  Log(CONNECTION, "startBridgeElection(): Candidacy broadcast sent\n");
1090
1095
 
@@ -1223,18 +1228,21 @@ class Mesh : public painlessmesh::Mesh<Connection> {
1223
1228
  Log(STARTUP, "Sending takeover announcement on current channel before switching...\n");
1224
1229
  JsonDocument doc;
1225
1230
  JsonObject obj = doc.to<JsonObject>();
1226
- obj["type"] = 612; // BRIDGE_TAKEOVER
1231
+ obj["type"] = protocol::BRIDGE_TAKEOVER;
1227
1232
  obj["from"] = this->nodeId;
1228
1233
  obj["routing"] = 2; // BROADCAST
1229
1234
  obj["previousBridge"] = previousBridgeId;
1230
1235
  obj["reason"] = "Election winner - best router signal";
1231
1236
  obj["routerRSSI"] = 0; // Not yet connected to router
1232
1237
  obj["timestamp"] = this->getNodeTime();
1233
- obj["message_type"] = 612;
1238
+ obj["message_type"] = protocol::BRIDGE_TAKEOVER;
1234
1239
 
1235
1240
  String msg;
1236
1241
  serializeJson(doc, msg);
1237
- this->sendBroadcast(msg);
1242
+
1243
+ // Send takeover message using raw broadcast to preserve type BRIDGE_TAKEOVER
1244
+ protocol::Variant variant(msg);
1245
+ router::broadcast<protocol::Variant, Connection>(variant, (*this), 0);
1238
1246
 
1239
1247
  // Give time for announcement to propagate before channel switch
1240
1248
  delay(1000);
@@ -1263,18 +1271,22 @@ class Mesh : public painlessmesh::Mesh<Connection> {
1263
1271
  Log(STARTUP, "Sending follow-up takeover announcement on new channel %d\n", _meshChannel);
1264
1272
  JsonDocument doc2;
1265
1273
  JsonObject obj2 = doc2.to<JsonObject>();
1266
- obj2["type"] = 612; // BRIDGE_TAKEOVER
1274
+ obj2["type"] = protocol::BRIDGE_TAKEOVER;
1267
1275
  obj2["from"] = this->nodeId;
1268
1276
  obj2["routing"] = 2; // BROADCAST
1269
1277
  obj2["previousBridge"] = previousBridgeId;
1270
1278
  obj2["reason"] = "Election winner - best router signal";
1271
1279
  obj2["routerRSSI"] = WiFi.RSSI();
1272
1280
  obj2["timestamp"] = this->getNodeTime();
1273
- obj2["message_type"] = 612;
1281
+ obj2["message_type"] = protocol::BRIDGE_TAKEOVER;
1274
1282
 
1275
1283
  String msg2;
1276
1284
  serializeJson(doc2, msg2);
1277
- this->sendBroadcast(msg2);
1285
+
1286
+ // Send follow-up takeover using raw broadcast to preserve type BRIDGE_TAKEOVER
1287
+ protocol::Variant variant2(msg2);
1288
+ router::broadcast<protocol::Variant, Connection>(variant2, (*this), 0);
1289
+
1278
1290
  Log(STARTUP, "✓ Follow-up takeover announcement sent\n");
1279
1291
  });
1280
1292
  }
@@ -1329,7 +1341,7 @@ class Mesh : public painlessmesh::Mesh<Connection> {
1329
1341
  JsonDocument doc;
1330
1342
  JsonObject obj = doc.to<JsonObject>();
1331
1343
 
1332
- obj["type"] = 610; // BRIDGE_STATUS type
1344
+ obj["type"] = protocol::BRIDGE_STATUS;
1333
1345
  obj["from"] = this->nodeId;
1334
1346
  obj["routing"] = 2; // BROADCAST routing
1335
1347
  obj["timestamp"] = this->getNodeTime();
@@ -1352,7 +1364,7 @@ class Mesh : public painlessmesh::Mesh<Connection> {
1352
1364
  obj["routerChannel"] = channel;
1353
1365
  obj["uptime"] = uptime;
1354
1366
  obj["gatewayIP"] = gatewayIP;
1355
- obj["message_type"] = 610;
1367
+ obj["message_type"] = protocol::BRIDGE_STATUS;
1356
1368
 
1357
1369
  String msg;
1358
1370
  serializeJson(doc, msg);
@@ -1367,7 +1379,10 @@ class Mesh : public painlessmesh::Mesh<Connection> {
1367
1379
  this->updateBridgeStatus(this->nodeId, hasInternet, rssi, channel,
1368
1380
  uptime, gatewayIP, this->getNodeTime());
1369
1381
 
1370
- this->sendBroadcast(msg);
1382
+ // Send bridge status using raw broadcast to preserve type BRIDGE_STATUS
1383
+ // Using sendBroadcast(msg) would wrap it in type 8 (BROADCAST) and hide type BRIDGE_STATUS
1384
+ protocol::Variant variant(msg);
1385
+ router::broadcast<protocol::Variant, Connection>(variant, (*this), 0);
1371
1386
  }
1372
1387
  void eventHandleInit() {
1373
1388
  using namespace logger;
@@ -5,8 +5,8 @@
5
5
  * @file painlessMesh.h
6
6
  * @brief Main header file for Alteriom painlessMesh library
7
7
  *
8
- * @version 1.8.12
9
- * @date 2025-11-19
8
+ * @version 1.8.13
9
+ * @date 2025-11-20
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
@@ -167,10 +167,10 @@ class Mesh : public ntp::MeshTime, public plugin::PackageHandler<T> {
167
167
  this->callbackList = painlessmesh::router::addPackageCallback(
168
168
  std::move(this->callbackList), (*this));
169
169
 
170
- // Add bridge status package handler (Type 610)
170
+ // Add bridge status package handler (Type BRIDGE_STATUS)
171
171
  // This will be called when any node receives a bridge status broadcast
172
172
  this->callbackList.onPackage(
173
- 610, // BRIDGE_STATUS type
173
+ protocol::BRIDGE_STATUS,
174
174
  [this](protocol::Variant& variant, std::shared_ptr<T>, uint32_t) {
175
175
  // We need to manually parse the JSON since BridgeStatusPackage is in alteriom namespace
176
176
  // and may not be available in all contexts. We'll parse the critical fields directly.
@@ -49,6 +49,13 @@ enum TimeType {
49
49
  TIME_REPLY
50
50
  };
51
51
 
52
+ // Bridge protocol package types
53
+ // These are used for bridge discovery, election, and coordination
54
+ constexpr int BRIDGE_STATUS = 610; // Bridge status broadcast (internet, RSSI, etc.)
55
+ constexpr int BRIDGE_ELECTION = 611; // Bridge election candidacy announcement
56
+ constexpr int BRIDGE_TAKEOVER = 612; // Bridge takeover notification
57
+ constexpr int BRIDGE_COORDINATION = 613; // Multi-bridge coordination (defined in plugin.hpp)
58
+
52
59
  class PackageInterface {
53
60
  public:
54
61
  virtual JsonObject addTo(JsonObject&& jsonObj) const = 0;
@@ -1,96 +0,0 @@
1
- # Release Notes - Version 1.8.12
2
-
3
- **Release Date:** 2025-11-19
4
-
5
- ## Overview
6
-
7
- Version 1.8.12 is a maintenance release focused on documentation improvements and code quality enhancements. This release includes changes from PRs #152 and #153, ensuring comprehensive documentation coverage and adherence to code formatting standards.
8
-
9
- ## What's New
10
-
11
- ### Documentation Enhancements
12
-
13
- - **Comprehensive Documentation Review** - All documentation has been reviewed and updated to reflect the current state of the library
14
- - **API Reference Updates** - Improved clarity and completeness in API documentation
15
- - **Example Code Documentation** - Enhanced inline documentation for example projects
16
- - **Package Documentation** - Updated documentation for all Alteriom custom packages
17
-
18
- ### Code Quality Improvements
19
-
20
- - **Prettier Configuration** - Added prettier configuration for consistent JSON and Markdown formatting
21
- - New `.prettierrc` configuration file
22
- - New `.prettierignore` file to exclude build artifacts and dependencies
23
- - Added `npm run format` and `npm run format:check` scripts
24
- - **Clang-Format Compliance** - Ensured all C++ code follows established formatting standards
25
- - **Code Organization** - Improved code structure and maintainability
26
-
27
- ### Version Updates
28
-
29
- - Updated all version references across:
30
- - `package.json` - NPM package version
31
- - `library.json` - PlatformIO library version
32
- - `library.properties` - Arduino library version
33
- - `src/painlessMesh.h` - Header file version comments
34
- - `src/AlteriomPainlessMesh.h` - Version defines and comments
35
-
36
- ## Installation
37
-
38
- ### Arduino Library Manager
39
- ```
40
- Sketch → Include Library → Manage Libraries → Search "AlteriomPainlessMesh" → Install
41
- ```
42
-
43
- ### PlatformIO
44
- ```ini
45
- [env:myenv]
46
- lib_deps =
47
- alteriom/AlteriomPainlessMesh @ ^1.8.12
48
- ```
49
-
50
- ### NPM
51
- ```bash
52
- npm install @alteriom/painlessmesh@1.8.12
53
- ```
54
-
55
- ## Compatibility
56
-
57
- - **ESP32** - All variants supported
58
- - **ESP8266** - All variants supported
59
- - **Arduino IDE** - Version 1.8.0 or higher
60
- - **PlatformIO** - Latest version
61
- - **ArduinoJson** - Version 7.4.2 or higher
62
- - **TaskScheduler** - Version 4.0.0 or higher
63
-
64
- ## Migration Guide
65
-
66
- This is a patch release with no breaking changes. Users can upgrade from any 1.8.x version without code modifications.
67
-
68
- ## Known Issues
69
-
70
- None identified in this release.
71
-
72
- ## Pull Requests Included
73
-
74
- - PR #152 - Documentation improvements
75
- - PR #153 - Code quality enhancements
76
-
77
- ## Contributors
78
-
79
- Special thanks to all contributors who helped make this release possible!
80
-
81
- ## Documentation
82
-
83
- - **Main Documentation**: https://alteriom.github.io/painlessMesh/
84
- - **API Reference**: https://alteriom.github.io/painlessMesh/#/api/doxygen
85
- - **Examples**: https://alteriom.github.io/painlessMesh/#/tutorials/basic-examples
86
- - **GitHub Repository**: https://github.com/Alteriom/painlessMesh
87
-
88
- ## Support
89
-
90
- For questions, issues, or feature requests:
91
- - **GitHub Issues**: https://github.com/Alteriom/painlessMesh/issues
92
- - **Documentation**: https://alteriom.github.io/painlessMesh/
93
-
94
- ## License
95
-
96
- This project is licensed under LGPL-3.0. See the LICENSE file for details.