@alteriom/painlessmesh 1.9.19 → 1.9.20

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 (41) hide show
  1. package/CHANGELOG.md +47 -0
  2. package/README.md +82 -63
  3. package/examples/alteriom/README.md +4 -4
  4. package/examples/alteriom/alteriom_custom_package_template.hpp +320 -0
  5. package/examples/alteriom/alteriom_sensor_package.hpp +1 -1
  6. package/examples/alteriom/mppt_example/alteriom_mppt_example.ino +208 -0
  7. package/examples/bridge_failover/bridge_failover.ino +17 -0
  8. package/examples/sendToInternet/CMakeLists.txt +54 -0
  9. package/examples/sendToInternet/PC_NODE_README.md +517 -0
  10. package/examples/sendToInternet/README.md +39 -1
  11. package/examples/sendToInternet/build.sh +153 -0
  12. package/examples/sendToInternet/mock_server_test.ino +361 -0
  13. package/examples/sendToInternet/pc_mesh_node.cpp +361 -0
  14. package/library.json +4 -1
  15. package/library.properties +1 -1
  16. package/package.json +3 -3
  17. package/src/AlteriomPainlessMesh.h +5 -13
  18. package/src/arduino/wifi.hpp +306 -100
  19. package/src/connection.cpp +10 -0
  20. package/src/painlessMesh.h +1 -14
  21. package/src/painlessmesh/connection.hpp +11 -16
  22. package/src/painlessmesh/gateway.hpp +0 -1061
  23. package/src/painlessmesh/mesh.hpp +29 -85
  24. package/src/painlessmesh/message_queue.hpp +1 -2
  25. package/src/painlessmesh/metrics.hpp +2 -262
  26. package/src/painlessmesh/validation.hpp +0 -143
  27. package/docs/README.md +0 -132
  28. package/docs/alteriom/overview.md +0 -531
  29. package/docs/api/core-api.md +0 -607
  30. package/docs/api/shared-gateway.md +0 -1207
  31. package/docs/architecture/mesh-architecture.md +0 -399
  32. package/docs/architecture/plugin-system.md +0 -517
  33. package/docs/getting-started/arduino-manual-install.md +0 -313
  34. package/docs/getting-started/first-mesh.md +0 -410
  35. package/docs/getting-started/installation.md +0 -275
  36. package/docs/getting-started/quickstart.md +0 -158
  37. package/docs/troubleshooting/common-issues.md +0 -679
  38. package/docs/troubleshooting/debugging.md +0 -455
  39. package/docs/troubleshooting/external-device-connection.md +0 -283
  40. package/docs/troubleshooting/faq.md +0 -574
  41. package/docs/tutorials/basic-examples.md +0 -718
@@ -1,679 +0,0 @@
1
- # Common Issues and Solutions
2
-
3
- This guide covers the most frequently encountered problems when working with painlessMesh and their solutions.
4
-
5
- ## Architecture & Design Issues
6
-
7
- ### Regular Nodes Cannot Access Internet / HTTP Requests Fail
8
-
9
- **Symptoms:**
10
- - HTTP/HTTPS requests fail with "connection refused"
11
- - `WiFi.status()` shows disconnected on regular mesh nodes
12
- - Internet services (APIs, WhatsApp bot, etc.) only work on bridge node
13
-
14
- **Cause:**
15
-
16
- This is **expected behavior**, not a bug. Only bridge nodes have internet access.
17
-
18
- **Solution:**
19
-
20
- See the dedicated guide for this common architecture mistake:
21
-
22
- 📖 **[Common Architecture Mistakes](common-architecture-mistakes.md)**
23
-
24
- **Quick Summary:**
25
-
26
- painlessMesh uses a bridge-forwarding pattern:
27
- - **Bridge node**: Has internet access, forwards data to/from internet
28
- - **Regular nodes**: No internet access, send data to bridge
29
- - **Architecture**: Regular nodes → Bridge → Internet
30
-
31
- Regular nodes must send data to the bridge, which then forwards to internet services.
32
-
33
- ## Platform-Specific Issues
34
-
35
- ### ESP32-C6 Crashes on Startup
36
-
37
- **Symptoms:**
38
- - Device crashes immediately after mesh initialization
39
- - Endless reboot loop
40
- - Error message: `assert failed: tcp_alloc ... (Required to lock TCPIP core functionality!)`
41
-
42
- **Solution:**
43
-
44
- This is a known compatibility issue with ESP32-C6 and newer ESP32 variants. See the dedicated guide:
45
-
46
- 📖 **[ESP32-C6 Compatibility Guide](ESP32_C6_COMPATIBILITY.md)**
47
-
48
- **Quick Fix:**
49
- Update your AsyncTCP library to version 3.3.0 or newer, or use the ESP32Async library which includes proper LWIP locking for Arduino ESP32 core 3.1.0+.
50
-
51
- For PlatformIO, add to your `platformio.ini`:
52
- ```ini
53
- lib_deps =
54
- esp32async/AsyncTCP @ ^3.4.7
55
- ```
56
-
57
- For Arduino IDE, download and install manually from: https://github.com/ESP32Async/AsyncTCP
58
-
59
- ---
60
-
61
- ## Connection Issues
62
-
63
- ### External Devices Cannot Connect to Mesh AP
64
-
65
- **Symptoms:**
66
- - Phone or computer can't see the mesh WiFi network
67
- - Can see network but can't connect
68
- - Connected but no IP address assigned
69
- - Connection drops frequently
70
-
71
- **Solution:**
72
-
73
- See the dedicated guide for connecting external devices:
74
-
75
- 📖 **[Connecting External Devices Guide](external-device-connection.md)**
76
-
77
- **Quick Summary:**
78
-
79
- External devices (phones, computers, test equipment) can connect to the bridge node's WiFi AP for debugging:
80
- - **SSID**: Your MESH_PREFIX value
81
- - **Password**: Your MESH_PASSWORD value
82
- - **IP Range**: 10.x.x.x/24 (DHCP automatic)
83
- - **Limits**: ESP32 supports 10 devices, ESP8266 supports 4
84
-
85
- Common issues are DHCP timing, channel changes, and connection limits.
86
-
87
- ---
88
-
89
- ### Nodes Not Connecting
90
-
91
- **Symptoms:**
92
- - Nodes don't appear in each other's node lists
93
- - No "New Connection" messages in serial output
94
- - Mesh remains disconnected
95
-
96
- **Solutions:**
97
-
98
- #### 1. Check Network Credentials
99
- Ensure all nodes use identical network settings:
100
-
101
- ```cpp
102
- // These MUST be identical on all nodes
103
- #define MESH_PREFIX "MyMeshNetwork" // Exact match required
104
- #define MESH_PASSWORD "password123" // Case sensitive
105
- #define MESH_PORT 5555 // Must match
106
- ```
107
-
108
- #### 2. Verify WiFi Range
109
- - Nodes must be within WiFi range (typically 50-200m)
110
- - Check for interference from other 2.4GHz devices
111
- - Try moving nodes closer together for testing
112
-
113
- #### 3. Check Serial Output
114
- Enable connection debugging:
115
-
116
- ```cpp
117
- mesh.setDebugMsgTypes(ERROR | STARTUP | CONNECTION);
118
- ```
119
-
120
- Look for error messages like:
121
- - "Failed to connect to mesh"
122
- - "Connection timeout"
123
- - "Authentication failed"
124
-
125
- #### 4. Reset Network Settings
126
- Clear stored WiFi credentials:
127
-
128
- ```cpp
129
- void setup() {
130
- // Add this before mesh.init()
131
- WiFi.disconnect(true); // Clear stored networks
132
- delay(1000);
133
-
134
- mesh.init(MESH_PREFIX, MESH_PASSWORD, &userScheduler, MESH_PORT);
135
- }
136
- ```
137
-
138
- ### Frequent Disconnections
139
-
140
- **Symptoms:**
141
- - Nodes connect but disconnect shortly after
142
- - Repeated "Connection dropped" messages
143
- - Unstable mesh topology
144
-
145
- **Solutions:**
146
-
147
- #### 1. Check Power Supply
148
- - Ensure stable power supply (USB power can be insufficient)
149
- - Use adequate power adapters (≥1A for ESP32, ≥500mA for ESP8266)
150
- - Check for voltage drops during WiFi transmission
151
-
152
- #### 2. Reduce Connection Load
153
- Limit the number of simultaneous connections:
154
-
155
- ```cpp
156
- // Reduce connection count on ESP8266
157
- #define MAX_CONN 2 // Instead of default 4
158
- ```
159
-
160
- #### 3. Increase Connection Timeout
161
- ```cpp
162
- // Extend connection timeouts
163
- #define CONNECTION_TIMEOUT 60000 // 60 seconds instead of 30
164
- ```
165
-
166
- #### 4. Memory Issues
167
- Monitor memory usage:
168
-
169
- ```cpp
170
- void checkMemory() {
171
- Serial.printf("Free heap: %d bytes\n", ESP.getFreeHeap());
172
- if (ESP.getFreeHeap() < 10000) { // ESP32
173
- Serial.println("WARNING: Low memory!");
174
- }
175
- }
176
- ```
177
-
178
- ### TCP Connection Error -14 (ERR_CONN)
179
-
180
- **Symptoms:**
181
- - Serial output shows: `tcp_err(): error trying to connect -14`
182
- - Nodes get an IP address but fail to establish mesh connection
183
- - Connection attempts keep failing and retrying
184
-
185
- **Cause:**
186
-
187
- The error -14 (ERR_CONN in LwIP) indicates a TCP connection failure. This typically occurs when:
188
- 1. The TCP server on the target node is not ready when the connection is attempted
189
- 2. There's a timing issue between WiFi association and TCP readiness
190
- 3. Network stack hasn't fully stabilized after IP acquisition
191
- 4. The target node is overloaded or has resource constraints
192
-
193
- **Solutions:**
194
-
195
- #### 1. Update AsyncTCP Library (Most Common Fix)
196
- The error often occurs with older AsyncTCP versions that don't have proper thread safety for ESP32 Arduino Core 3.x:
197
-
198
- For PlatformIO:
199
- ```ini
200
- lib_deps =
201
- esp32async/AsyncTCP @ ^3.4.7
202
- ```
203
-
204
- For Arduino IDE, install manually from: https://github.com/ESP32Async/AsyncTCP
205
-
206
- #### 2. Built-in Retry Mechanism
207
- painlessMesh now includes automatic TCP connection retry with the following behavior:
208
- - Up to 6 total connection attempts (initial + 5 retries)
209
- - Exponential backoff delays between retries: 1s, 2s, 4s, 8s, 8s (total ~23s)
210
- - 500ms stabilization delay after IP acquisition before first connection attempt
211
- - Full WiFi reconnection with 10s delay only triggered after all retries are exhausted
212
-
213
- This exponential backoff helps handle transient timing issues automatically while reducing network congestion from multiple retrying nodes.
214
-
215
- #### 3. Check Node Resource Usage
216
- Monitor memory and ensure nodes aren't overloaded:
217
-
218
- ```cpp
219
- void loop() {
220
- mesh.update();
221
-
222
- // Monitor health periodically
223
- static unsigned long lastCheck = 0;
224
- if (millis() - lastCheck > 10000) {
225
- lastCheck = millis();
226
- Serial.printf("Free heap: %d, WiFi RSSI: %d\n",
227
- ESP.getFreeHeap(), WiFi.RSSI());
228
- }
229
- }
230
- ```
231
-
232
- #### 4. Ensure Proper Initialization Order
233
- Make sure the mesh is properly initialized before connections are attempted:
234
-
235
- ```cpp
236
- void setup() {
237
- Serial.begin(115200);
238
- delay(100); // Let serial initialize
239
-
240
- mesh.setDebugMsgTypes(ERROR | STARTUP | CONNECTION);
241
- mesh.init(MESH_PREFIX, MESH_PASSWORD, &userScheduler, MESH_PORT);
242
- // Add callbacks after init
243
- mesh.onReceive(&receivedCallback);
244
- mesh.onNewConnection(&newConnectionCallback);
245
- }
246
- ```
247
-
248
- #### 5. Check WiFi Signal Strength
249
- Poor signal can cause connection timing issues:
250
- - Ensure nodes are within good WiFi range
251
- - Check for interference from other 2.4GHz devices
252
- - Monitor RSSI values (should be above -80 dBm for reliable connections)
253
-
254
- ## Message Delivery Issues
255
-
256
- ### Messages Not Being Received
257
-
258
- **Symptoms:**
259
- - `sendBroadcast()` returns `true` but messages don't arrive
260
- - Callbacks not triggered
261
- - Silent message failures
262
-
263
- **Solutions:**
264
-
265
- #### 1. Check Callback Registration
266
- Ensure callbacks are set before `mesh.init()`:
267
-
268
- ```cpp
269
- void setup() {
270
- Serial.begin(115200);
271
-
272
- // Set callbacks BEFORE init
273
- mesh.onReceive(&receivedCallback);
274
- mesh.onNewConnection(&newConnectionCallback);
275
-
276
- // Then initialize
277
- mesh.init(MESH_PREFIX, MESH_PASSWORD, &userScheduler, MESH_PORT);
278
- }
279
- ```
280
-
281
- #### 2. Verify Message Format
282
- Check JSON formatting for custom messages:
283
-
284
- ```cpp
285
- void sendSensorData() {
286
- // Proper JSON formatting
287
- String msg = "{";
288
- msg += "\"type\":\"sensor\",";
289
- msg += "\"value\":" + String(sensorValue) + ",";
290
- msg += "\"timestamp\":" + String(mesh.getNodeTime());
291
- msg += "}"; // Don't forget closing brace
292
-
293
- mesh.sendBroadcast(msg);
294
- }
295
- ```
296
-
297
- #### 3. Enable Communication Debugging
298
- ```cpp
299
- mesh.setDebugMsgTypes(ERROR | STARTUP | CONNECTION | COMMUNICATION);
300
- ```
301
-
302
- #### 4. Check Network Congestion
303
- Reduce message frequency if network is congested:
304
-
305
- ```cpp
306
- // Instead of every second
307
- Task taskSendMessage(10000, TASK_FOREVER, &sendMessage); // Every 10 seconds
308
- ```
309
-
310
- ### Large Messages Being Dropped
311
-
312
- **Symptoms:**
313
- - Small messages work, large ones don't
314
- - Memory errors in serial output
315
- - Random message failures
316
-
317
- **Solutions:**
318
-
319
- #### 1. Reduce Message Size
320
- ```cpp
321
- // Keep messages under 1KB for reliability
322
- String createMessage() {
323
- String msg = "{\"data\":\"";
324
- msg += shortData; // Keep data concise
325
- msg += "\"}";
326
-
327
- if (msg.length() > 1000) {
328
- Serial.println("Warning: Message too large");
329
- return "{}"; // Send empty object
330
- }
331
-
332
- return msg;
333
- }
334
- ```
335
-
336
- #### 2. Split Large Data
337
- ```cpp
338
- void sendLargeData(String largeData) {
339
- const size_t chunkSize = 500;
340
-
341
- for (size_t i = 0; i < largeData.length(); i += chunkSize) {
342
- String chunk = largeData.substring(i, i + chunkSize);
343
- String msg = "{\"chunk\":" + String(i/chunkSize) + ",\"data\":\"" + chunk + "\"}";
344
- mesh.sendBroadcast(msg);
345
- delay(100); // Small delay between chunks
346
- }
347
- }
348
- ```
349
-
350
- ## Memory Issues
351
-
352
- ### ESP8266 Memory Limitations
353
-
354
- **Symptoms:**
355
- - Frequent crashes or resets
356
- - "Out of memory" errors
357
- - Unstable behavior under load
358
-
359
- **Solutions:**
360
-
361
- #### 1. Reduce Buffer Sizes
362
- ```cpp
363
- // Use smaller JSON documents
364
- DynamicJsonDocument doc(512); // Instead of 1024 or larger
365
-
366
- // Limit string sizes
367
- TSTRING deviceName;
368
- deviceName.reserve(32); // Pre-allocate reasonable size
369
- ```
370
-
371
- #### 2. Limit Concurrent Connections
372
- ```cpp
373
- #define MAX_CONN 2 // ESP8266 works best with 2-3 connections
374
- ```
375
-
376
- #### 3. Optimize Task Usage
377
- ```cpp
378
- // Combine multiple tasks into one
379
- Task taskMultiFunction(30000, TASK_FOREVER, [](){
380
- sendSensorData();
381
- checkStatus();
382
- cleanupMemory();
383
- });
384
- ```
385
-
386
- #### 4. Implement Memory Monitoring
387
- ```cpp
388
- void monitorMemory() {
389
- uint32_t freeHeap = ESP.getFreeHeap();
390
- Serial.printf("Free heap: %u bytes\n", freeHeap);
391
-
392
- if (freeHeap < 5000) { // Critical threshold for ESP8266
393
- Serial.println("CRITICAL: Very low memory!");
394
- // Take corrective action
395
- mesh.stop();
396
- delay(1000);
397
- ESP.restart();
398
- }
399
- }
400
- ```
401
-
402
- ### ESP32 Memory Issues
403
-
404
- **Symptoms:**
405
- - Slower performance over time
406
- - Memory leaks
407
- - Task watchdog timeouts
408
-
409
- **Solutions:**
410
-
411
- #### 1. Monitor Heap Fragmentation
412
- ```cpp
413
- void checkHeapHealth() {
414
- Serial.printf("Free heap: %u bytes\n", ESP.getFreeHeap());
415
- Serial.printf("Largest block: %u bytes\n", ESP.getMaxAllocHeap());
416
-
417
- // If largest block is much smaller than free heap,
418
- // heap is fragmented
419
- if (ESP.getMaxAllocHeap() < ESP.getFreeHeap() / 2) {
420
- Serial.println("Warning: Heap fragmentation detected");
421
- }
422
- }
423
- ```
424
-
425
- #### 2. Use Static Allocation When Possible
426
- ```cpp
427
- // Instead of dynamic allocation
428
- StaticJsonDocument<1024> doc; // Pre-allocated
429
-
430
- // Or use stack allocation for small objects
431
- char buffer[256];
432
- snprintf(buffer, sizeof(buffer), "{\"value\":%d}", value);
433
- ```
434
-
435
- ## Compilation Issues
436
-
437
- ### Library Not Found
438
-
439
- **Symptoms:**
440
- - "painlessMesh.h: No such file or directory"
441
- - Library compilation errors
442
-
443
- **Solutions:**
444
-
445
- #### 1. Arduino IDE
446
- - Go to **Sketch → Include Library → Manage Libraries**
447
- - Search for "painlessMesh" and install latest version
448
- - Ensure ArduinoJson and TaskScheduler are also installed
449
-
450
- #### 2. PlatformIO
451
- Add to `platformio.ini`:
452
- ```ini
453
- lib_deps =
454
- painlessMesh
455
- bblanchon/ArduinoJson@^6.21.3
456
- arkhipenko/TaskScheduler@^3.7.0
457
- ```
458
-
459
- ### Version Compatibility Issues
460
-
461
- **Symptoms:**
462
- - Compilation errors after library updates
463
- - API function not found errors
464
- - Deprecated warnings
465
-
466
- **Solutions:**
467
-
468
- #### 1. Check Version Compatibility
469
- ```cpp
470
- // Check painlessMesh version
471
- #include "painlessMesh.h"
472
- Serial.printf("painlessMesh version: %s\n", PAINLESSMESH_VERSION);
473
- ```
474
-
475
- #### 2. Lock Library Versions
476
- In `platformio.ini`:
477
- ```ini
478
- lib_deps =
479
- painlessMesh@1.5.0 # Lock to specific version
480
- bblanchon/ArduinoJson@6.21.3
481
- arkhipenko/TaskScheduler@3.7.0
482
- ```
483
-
484
- #### 3. Update Deprecated APIs
485
- ```cpp
486
- // Old API (deprecated)
487
- mesh.onReceive(&receivedCallback);
488
-
489
- // New API (if changed in your version)
490
- mesh.onReceive([](uint32_t from, String& msg) {
491
- receivedCallback(from, msg);
492
- });
493
- ```
494
-
495
- ## Performance Issues
496
-
497
- ### Slow Message Delivery
498
-
499
- **Symptoms:**
500
- - Messages take several seconds to arrive
501
- - High latency in mesh communication
502
- - Sluggish response times
503
-
504
- **Solutions:**
505
-
506
- #### 1. Check Network Topology
507
- ```cpp
508
- void printTopology() {
509
- String topology = mesh.subConnectionJson(true);
510
- Serial.println("Current topology:");
511
- Serial.println(topology);
512
-
513
- // Look for long chains or star topologies
514
- // Optimal: balanced tree with short paths
515
- }
516
- ```
517
-
518
- #### 2. Reduce Message Frequency
519
- ```cpp
520
- // Instead of high frequency
521
- Task taskFastSender(1000, TASK_FOREVER, &sendMessage); // Every second
522
-
523
- // Use lower frequency
524
- Task taskSlowSender(10000, TASK_FOREVER, &sendMessage); // Every 10 seconds
525
- ```
526
-
527
- #### 3. Optimize Message Size
528
- ```cpp
529
- // Compact JSON formatting
530
- String createOptimizedMessage() {
531
- // Use short field names
532
- String msg = "{\"t\":" + String(temp) + ",\"h\":" + String(hum) + "}";
533
- return msg;
534
- }
535
- ```
536
-
537
- ### High CPU Usage
538
-
539
- **Symptoms:**
540
- - ESP becomes hot during operation
541
- - Watchdog timer resets
542
- - Sluggish response to other tasks
543
-
544
- **Solutions:**
545
-
546
- #### 1. Add Delays in Tight Loops
547
- ```cpp
548
- void loop() {
549
- mesh.update();
550
-
551
- // Add small delay to prevent CPU overload
552
- delay(10);
553
-
554
- // Or yield to other tasks
555
- yield();
556
- }
557
- ```
558
-
559
- #### 2. Reduce Debug Output
560
- ```cpp
561
- // Only use essential debug messages in production
562
- mesh.setDebugMsgTypes(ERROR); // Only errors
563
- ```
564
-
565
- #### 3. Optimize Task Scheduling
566
- ```cpp
567
- // Spread tasks over time
568
- Task task1(30000, TASK_FOREVER, &function1); // Every 30s
569
- Task task2(35000, TASK_FOREVER, &function2); // Every 35s (offset)
570
- Task task3(40000, TASK_FOREVER, &function3); // Every 40s
571
- ```
572
-
573
- ## Platform-Specific Issues
574
-
575
- ### ESP8266 Specific
576
-
577
- **Reset Loops:**
578
- ```cpp
579
- // Increase watchdog timeout
580
- ESP.wdtDisable();
581
- // Perform long operations
582
- ESP.wdtEnable(5000); // 5 second timeout
583
- ```
584
-
585
- **Flash Memory Issues:**
586
- ```cpp
587
- // Check flash size
588
- Serial.printf("Flash size: %u bytes\n", ESP.getFlashChipSize());
589
-
590
- // Ensure adequate space for SPIFFS/LittleFS
591
- // Reserve at least 64KB for filesystem
592
- ```
593
-
594
- ### ESP32 Specific
595
-
596
- **Core Affinity:**
597
- ```cpp
598
- // Pin mesh tasks to specific core if needed
599
- void setup() {
600
- // Use core 0 for mesh (core 1 for app)
601
- xTaskCreatePinnedToCore(meshTask, "MeshTask", 8192, NULL, 1, NULL, 0);
602
- }
603
- ```
604
-
605
- **Partition Scheme:**
606
- Ensure adequate partition sizes in partition table:
607
- ```
608
- # Name, Type, SubType, Offset, Size, Flags
609
- nvs, data, nvs, 0x9000, 0x5000,
610
- otadata, data, ota, 0xe000, 0x2000,
611
- app0, app, ota_0, 0x10000, 0x140000,
612
- app1, app, ota_1, 0x150000,0x140000,
613
- spiffs, data, spiffs, 0x290000,0x160000,
614
- ```
615
-
616
- ## Debugging Techniques
617
-
618
- ### Serial Output Analysis
619
-
620
- Enable comprehensive debugging:
621
- ```cpp
622
- mesh.setDebugMsgTypes(ERROR | STARTUP | CONNECTION | SYNC |
623
- COMMUNICATION | GENERAL | MSG_TYPES | REMOTE);
624
- ```
625
-
626
- Look for patterns in the output:
627
- - Repeated connection attempts
628
- - Memory allocation failures
629
- - Message transmission errors
630
- - Time synchronization issues
631
-
632
- ### Network Analysis
633
-
634
- Use WiFi monitoring tools:
635
- - WiFi Analyzer apps to check channel congestion
636
- - Router logs to see connection patterns
637
- - Packet capture tools for advanced debugging
638
-
639
- ### Code Instrumentation
640
-
641
- Add timing measurements:
642
- ```cpp
643
- void timedFunction() {
644
- unsigned long start = millis();
645
-
646
- // Your code here
647
- performOperation();
648
-
649
- unsigned long duration = millis() - start;
650
- if (duration > 1000) { // Alert if > 1 second
651
- Serial.printf("Slow operation: %lu ms\n", duration);
652
- }
653
- }
654
- ```
655
-
656
- ## Getting Help
657
-
658
- If you're still experiencing issues:
659
-
660
- 1. **Check the [FAQ](faq.md)** for additional solutions
661
- 2. **Search existing issues** on [GitHub](https://github.com/Alteriom/painlessMesh/issues)
662
- 3. **Post in the community forum** with:
663
- - Complete serial output with debug enabled
664
- - Hardware details (ESP32/ESP8266 model)
665
- - Network topology (number of nodes, layout)
666
- - Code snippets showing the problem
667
- 4. **Create a minimal test case** that reproduces the issue
668
- 5. **Include library versions** and platform information
669
-
670
- ## Prevention Best Practices
671
-
672
- - **Start simple** - Test with 2 nodes before scaling up
673
- - **Monitor resources** - Check memory and CPU usage regularly
674
- - **Use version control** - Track changes that might introduce issues
675
- - **Test incremental changes** - Don't change everything at once
676
- - **Document your setup** - Keep notes on working configurations
677
- - **Regular testing** - Verify mesh operation after any changes
678
-
679
- Remember: Most mesh networking issues are related to network configuration, power supply, or memory management. Check these fundamentals first before diving into complex debugging.