@alteriom/painlessmesh 1.9.19 → 1.10.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.
Files changed (51) hide show
  1. package/CHANGELOG.md +168 -0
  2. package/README.md +102 -63
  3. package/RELEASE_GUIDE.md +147 -8
  4. package/examples/alteriom/README.md +4 -4
  5. package/examples/alteriom/alteriom_custom_package_template.hpp +320 -0
  6. package/examples/alteriom/alteriom_sensor_package.hpp +1 -1
  7. package/examples/alteriom/mppt_example/alteriom_mppt_example.ino +208 -0
  8. package/examples/bridge_failover/bridge_failover.ino +17 -0
  9. package/examples/sendToInternet/CMakeLists.txt +54 -0
  10. package/examples/sendToInternet/PC_NODE_README.md +517 -0
  11. package/examples/sendToInternet/README.md +39 -1
  12. package/examples/sendToInternet/build.sh +153 -0
  13. package/examples/sendToInternet/mock_server_test.ino +361 -0
  14. package/examples/sendToInternet/pc_mesh_node.cpp +361 -0
  15. package/examples/tcpRetryConfig/README.md +110 -0
  16. package/examples/tcpRetryConfig/platformio.ini +26 -0
  17. package/examples/tcpRetryConfig/tcpRetryConfig.ino +154 -0
  18. package/keywords.txt +3 -0
  19. package/library.json +4 -1
  20. package/library.properties +1 -1
  21. package/package.json +3 -3
  22. package/src/AlteriomPainlessMesh.h +6 -14
  23. package/src/arduino/wifi.hpp +352 -114
  24. package/src/connection.cpp +10 -0
  25. package/src/painlessMesh.h +2 -15
  26. package/src/painlessTaskOptions.h +9 -0
  27. package/src/painlessmesh/buffer.hpp +4 -1
  28. package/src/painlessmesh/configuration.hpp +13 -2
  29. package/src/painlessmesh/connection.hpp +36 -21
  30. package/src/painlessmesh/gateway.hpp +0 -1061
  31. package/src/painlessmesh/mesh.hpp +102 -107
  32. package/src/painlessmesh/message_queue.hpp +25 -15
  33. package/src/painlessmesh/metrics.hpp +2 -262
  34. package/src/painlessmesh/plugin.hpp +27 -5
  35. package/src/painlessmesh/tcp.hpp +158 -29
  36. package/src/painlessmesh/validation.hpp +0 -143
  37. package/docs/README.md +0 -132
  38. package/docs/alteriom/overview.md +0 -531
  39. package/docs/api/core-api.md +0 -607
  40. package/docs/api/shared-gateway.md +0 -1207
  41. package/docs/architecture/mesh-architecture.md +0 -399
  42. package/docs/architecture/plugin-system.md +0 -517
  43. package/docs/getting-started/arduino-manual-install.md +0 -313
  44. package/docs/getting-started/first-mesh.md +0 -410
  45. package/docs/getting-started/installation.md +0 -275
  46. package/docs/getting-started/quickstart.md +0 -158
  47. package/docs/troubleshooting/common-issues.md +0 -679
  48. package/docs/troubleshooting/debugging.md +0 -455
  49. package/docs/troubleshooting/external-device-connection.md +0 -283
  50. package/docs/troubleshooting/faq.md +0 -574
  51. package/docs/tutorials/basic-examples.md +0 -718
@@ -1,283 +0,0 @@
1
- # Connecting External Devices to painlessMesh Bridge
2
-
3
- This guide explains how to connect external devices (phones, computers, test equipment) to a painlessMesh bridge node's WiFi Access Point for debugging and testing purposes.
4
-
5
- ## Overview
6
-
7
- Each painlessMesh node operates in AP+STA mode, broadcasting a WiFi Access Point (AP) with the mesh SSID. External devices can connect to this AP, though they typically don't get internet access (unless using shared gateway mode).
8
-
9
- ## When to Connect External Devices
10
-
11
- You might want to connect external devices to the mesh AP when:
12
- - Debugging mesh connectivity issues
13
- - Running diagnostic tools (ping, network scanners)
14
- - Testing DHCP configuration
15
- - Monitoring mesh traffic
16
- - Developing custom mesh applications
17
-
18
- ## Connection Details
19
-
20
- ### Basic Information
21
-
22
- | Setting | Value |
23
- |---------|-------|
24
- | **SSID** | Your `MESH_PREFIX` value (e.g., "FishFarmMesh", "whateverYouLike") |
25
- | **Password** | Your `MESH_PASSWORD` value (e.g., "securepass", "somethingSneaky") |
26
- | **Security** | WPA2-PSK |
27
- | **IP Range** | 10.x.x.x/24 (automatically assigned via DHCP) |
28
- | **Gateway** | 10.x.x.1 (the bridge node itself) |
29
- | **DNS** | 10.x.x.1 (the bridge node) |
30
-
31
- ### Node-Specific IP Addressing
32
-
33
- Each mesh node gets a unique IP address based on its Node ID:
34
- ```
35
- IP = 10.(NodeID >> 8).(NodeID & 0xFF).1
36
- ```
37
-
38
- Example: If Node ID is `0x1A2B`, the AP IP would be `10.26.43.1`
39
-
40
- Connected clients receive IPs in the same subnet, typically starting from `.2`
41
-
42
- ## Connection Limits
43
-
44
- The number of devices that can connect simultaneously depends on the platform:
45
-
46
- | Platform | Max Connections | Notes |
47
- |----------|----------------|-------|
48
- | **ESP32** | 10 (default) | Configurable via `MAX_CONN` |
49
- | **ESP8266** | 4 (default) | Configurable via `MAX_CONN` |
50
-
51
- **Important**: Mesh nodes also count toward this limit! If 3 mesh nodes are connected to a bridge, only 7 slots remain for external devices on ESP32 (or 1 on ESP8266).
52
-
53
- ## Step-by-Step Connection Guide
54
-
55
- ### 1. Verify Bridge is Running
56
-
57
- Check the serial output for these messages:
58
- ```
59
- init(): Mesh channel set to X
60
- apInit(): AP configured - SSID: YourMeshName, Channel: X, IP: 10.x.x.1
61
- apInit(): AP active - Max connections: 10
62
- ```
63
-
64
- ### 2. Connect Your Device
65
-
66
- #### On Android:
67
- 1. Open WiFi settings
68
- 2. Look for network with your MESH_PREFIX name
69
- 3. Enter your MESH_PASSWORD
70
- 4. Wait for connection (may take 5-10 seconds)
71
- 5. Check IP address (should be 10.x.x.x)
72
-
73
- #### On Windows 11:
74
- 1. Click WiFi icon in system tray
75
- 2. Find network with your MESH_PREFIX name
76
- 3. Click "Connect"
77
- 4. Enter your MESH_PASSWORD
78
- 5. Open Command Prompt and run `ipconfig` to verify IP
79
-
80
- #### On macOS:
81
- 1. Click WiFi icon in menu bar
82
- 2. Select network with your MESH_PREFIX name
83
- 3. Enter your MESH_PASSWORD
84
- 4. Open Terminal and run `ifconfig` to verify IP
85
-
86
- #### On Linux:
87
- 1. Use NetworkManager GUI or command line:
88
- ```bash
89
- nmcli device wifi connect "FishFarmMesh" password "securepass"
90
- ```
91
- 2. Verify connection:
92
- ```bash
93
- ip addr show
94
- ```
95
-
96
- ### 3. Test Connectivity
97
-
98
- Once connected, test basic connectivity:
99
-
100
- ```bash
101
- # Ping the bridge/gateway
102
- ping 10.x.x.1
103
-
104
- # Check if you got an IP via DHCP
105
- # Windows: ipconfig
106
- # Linux/Mac: ifconfig or ip addr
107
-
108
- # Try to reach other mesh nodes (if you know their IPs)
109
- ping 10.y.y.1
110
- ```
111
-
112
- ## Troubleshooting
113
-
114
- ### Can't See the SSID
115
-
116
- **Possible Causes:**
117
- 1. Bridge hasn't finished initializing (wait 10-15 seconds after boot)
118
- 2. Channel conflict with nearby WiFi networks
119
- 3. WiFi range issue
120
- 4. AP not properly started
121
-
122
- **Solutions:**
123
- 1. Check serial output for "AP configured" message
124
- 2. Ensure `CONNECTION` debug level is enabled:
125
- ```cpp
126
- mesh.setDebugMsgTypes(ERROR | STARTUP | CONNECTION);
127
- ```
128
- 3. Try power cycling the bridge
129
- 4. Check if the AP is hidden:
130
- ```cpp
131
- // In your sketch, ensure:
132
- mesh.init(MESH_PREFIX, MESH_PASSWORD, &scheduler, MESH_PORT,
133
- WIFI_AP_STA, channel, 0); // 0 = not hidden
134
- ```
135
-
136
- ### Can Connect But Don't Get IP Address
137
-
138
- **Possible Causes:**
139
- 1. DHCP server not initialized
140
- 2. Too many devices connected (limit reached)
141
- 3. IP conflict
142
- 4. WiFi stack timing issue
143
-
144
- **Solutions:**
145
- 1. Disconnect and reconnect after 10 seconds
146
- 2. Check serial output for connection count
147
- 3. Try rebooting the bridge node
148
- 4. Ensure you're using the latest painlessMesh version with DHCP fixes
149
-
150
- ### Connection Drops Frequently
151
-
152
- **Possible Causes:**
153
- 1. Channel change during mesh discovery
154
- 2. Weak signal strength
155
- 3. Network congestion
156
- 4. Too many mesh topology changes
157
-
158
- **Solutions:**
159
- 1. This is normal during initial mesh formation when channels are being discovered
160
- 2. After 30-60 seconds, the mesh should stabilize on one channel
161
- 3. Move closer to the bridge node
162
- 4. Use a fixed channel if you know your router's channel:
163
- ```cpp
164
- mesh.init(MESH_PREFIX, MESH_PASSWORD, &scheduler, MESH_PORT,
165
- WIFI_AP_STA, 6); // Force channel 6
166
- ```
167
-
168
- ### Can't Access Internet
169
-
170
- **This is expected behavior!** Regular mesh nodes don't provide internet routing by default.
171
-
172
- **Options for Internet Access:**
173
-
174
- 1. **Use Shared Gateway Mode**: All nodes connect to router
175
- ```cpp
176
- mesh.initAsSharedGateway(MESH_PREFIX, MESH_PASSWORD,
177
- ROUTER_SSID, ROUTER_PASSWORD,
178
- &scheduler, MESH_PORT);
179
- ```
180
-
181
- 2. **Connect to the Router**: Connect your device to the router WiFi instead, then communicate with mesh nodes via the bridge
182
-
183
- 3. **Custom Routing**: Implement custom NAT/routing on the bridge (advanced)
184
-
185
- ## Advanced: Using with Test Tools
186
-
187
- ### ESPping or Similar Tools
188
-
189
- If you're using tools like ESPping (https://github.com/dvarrel/ESPping) to debug mesh connectivity:
190
-
191
- 1. Connect the test device to the mesh AP
192
- 2. You'll get an IP in the 10.x.x.x range
193
- 3. You can now ping mesh nodes directly:
194
- ```bash
195
- ping 10.x.x.1 # The bridge you're connected to
196
- ```
197
- 4. To find other mesh nodes, check the bridge's serial output for their IPs
198
-
199
- ### Network Scanners
200
-
201
- Tools like `nmap`, `arp-scan`, or Android apps like "Network Analyzer" can help:
202
-
203
- ```bash
204
- # Scan the mesh network
205
- sudo nmap -sn 10.x.x.0/24
206
-
207
- # Or use arp-scan
208
- sudo arp-scan --interface=wlan0 10.x.x.0/24
209
- ```
210
-
211
- ### Packet Analysis
212
-
213
- If you need to capture mesh traffic:
214
-
215
- 1. Connect your computer to the mesh AP
216
- 2. Use Wireshark or tcpdump to capture packets
217
- 3. Filter for TCP port 5555 (default mesh port)
218
- ```
219
- tcp.port == 5555
220
- ```
221
-
222
- ## Example Debug Session
223
-
224
- Here's a complete example of connecting and debugging:
225
-
226
- ```bash
227
- # 1. Connect to mesh AP
228
- nmcli device wifi connect "FishFarmMesh" password "securepass"
229
-
230
- # 2. Check your IP
231
- ip addr show wlan0
232
- # Should show: inet 10.26.43.2/24
233
-
234
- # 3. Ping the gateway (bridge)
235
- ping -c 3 10.26.43.1
236
- # Should get replies
237
-
238
- # 4. Check DHCP lease
239
- cat /var/lib/NetworkManager/dhclient-*.lease
240
- # Shows lease details from 10.26.43.1
241
-
242
- # 5. Scan for other mesh nodes
243
- sudo nmap -sn 10.0.0.0/8 --exclude 10.26.43.2
244
- # May find other nodes on 10.x.x.1 addresses
245
-
246
- # 6. Try connecting to mesh TCP port
247
- nc -v 10.26.43.1 5555
248
- # Should connect if node is accepting connections
249
- ```
250
-
251
- ## Security Considerations
252
-
253
- ### Important Warnings
254
-
255
- 1. **Don't use weak passwords**: The mesh password protects your entire network
256
- 2. **Change default credentials**: Always change from example values like "whateverYouLike"
257
- 3. **No internet isolation**: External devices on mesh AP can potentially communicate with all mesh nodes
258
- 4. **Production vs. Debug**: Consider disabling external connections in production:
259
- ```cpp
260
- // Limit max connections to only mesh nodes
261
- mesh.init(MESH_PREFIX, MESH_PASSWORD, &scheduler, MESH_PORT,
262
- WIFI_AP_STA, channel, 0, 4); // Max 4 on ESP8266
263
- ```
264
-
265
- ### Best Practices
266
-
267
- 1. **Use strong passwords**: At least 8 characters, mixed case, numbers
268
- 2. **Monitor connections**: Log when devices connect/disconnect
269
- 3. **Implement timeouts**: Automatically disconnect idle external devices
270
- 4. **Network segmentation**: Use VLANs if possible for mesh vs. debug traffic
271
-
272
- ## Related Documentation
273
-
274
- - [Bridge Setup Guide](../BRIDGE_TO_INTERNET.md)
275
- - [Shared Gateway Mode](../api/shared-gateway.md)
276
- - [Common Issues](common-issues.md)
277
- - [ESP32-C6 Compatibility](ESP32_C6_COMPATIBILITY.md)
278
-
279
- ## Changelog
280
-
281
- - **Unreleased**: Initial documentation for external device connections
282
- - Added DHCP server initialization fixes for ESP32
283
- - Improved AP restart timing for channel changes