@alteriom/painlessmesh 1.9.3 → 1.9.4

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 CHANGED
@@ -5,6 +5,18 @@ All notable changes to this project will be documented in this file.
5
5
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
6
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
7
 
8
+ ## [1.9.4] - 2025-12-03
9
+
10
+ ### Fixed
11
+
12
+ - **TCP Server Initialization Order** (#219) - Fixed TCP connection error -14 when mesh nodes connect to bridge
13
+ - **Root Cause**: TCP server was being initialized before the AP interface was configured in `init()`, causing it to bind incorrectly and reject incoming connections from mesh nodes
14
+ - **Symptom**: Regular mesh nodes could discover the bridge AP and get an IP, but TCP connections failed with error -14 (connection refused)
15
+ - **Solution**: Reordered initialization in `init()` to start TCP server after AP is configured:
16
+ - `eventHandleInit()` → `apInit(nodeId)` → `tcpServerInit()` (previously tcpServerInit was first)
17
+ - Added 100ms stabilization delay in `initAsBridge()` and `initAsSharedGateway()` after mesh init
18
+ - **Impact**: Fixes `sendToInternet` not working because nodes couldn't establish mesh connections to the bridge
19
+
8
20
  ## [1.9.3] - 2025-12-02
9
21
 
10
22
  ### Fixed
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.9.3",
9
+ "version": "1.9.4",
10
10
  "frameworks": [
11
11
  "arduino"
12
12
  ],
@@ -1,5 +1,5 @@
1
1
  name=Alteriom PainlessMesh
2
- version=1.9.3
2
+ version=1.9.4
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.9.3",
3
+ "version": "1.9.4",
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",
@@ -270,7 +270,6 @@ class Mesh : public painlessmesh::Mesh<Connection> {
270
270
  }
271
271
  });
272
272
 
273
- tcpServerInit();
274
273
  eventHandleInit();
275
274
 
276
275
  _apIp = IPAddress(0, 0, 0, 0);
@@ -278,6 +277,12 @@ class Mesh : public painlessmesh::Mesh<Connection> {
278
277
  if (connectMode & WIFI_AP) {
279
278
  apInit(nodeId); // setup AP
280
279
  }
280
+
281
+ // Initialize TCP server AFTER AP is configured
282
+ // This ensures the network interfaces are ready when the server starts
283
+ // Fixes TCP connection error -14 when nodes try to connect to bridge
284
+ tcpServerInit();
285
+
281
286
  if (connectMode & WIFI_STA) {
282
287
  this->initStation();
283
288
  }
@@ -394,6 +399,10 @@ class Mesh : public painlessmesh::Mesh<Connection> {
394
399
  init(meshSSID, meshPassword, baseScheduler, port, WIFI_AP_STA,
395
400
  detectedChannel, 0, MAX_CONN);
396
401
 
402
+ // Allow network stack to stabilize after AP and TCP server initialization
403
+ // This prevents TCP connection errors (-14) when nodes connect
404
+ delay(100);
405
+
397
406
  Log(STARTUP, "Step 3: Establishing bridge connection...\n");
398
407
 
399
408
  // Step 3: Re-establish router connection using stationManual
@@ -565,6 +574,10 @@ class Mesh : public painlessmesh::Mesh<Connection> {
565
574
  this->setScheduler(userScheduler);
566
575
  init(meshPrefix, meshPassword, port, WIFI_AP_STA, detectedChannel, 0, MAX_CONN);
567
576
 
577
+ // Allow network stack to stabilize after AP and TCP server initialization
578
+ // This prevents TCP connection errors (-14) when nodes connect
579
+ delay(100);
580
+
568
581
  Log(STARTUP, "Step 3: Establishing router connection in shared gateway mode...\n");
569
582
 
570
583
  // Step 3: Establish router connection using stationManual