@alteriom/painlessmesh 1.8.14 → 1.9.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 (208) hide show
  1. package/BRIDGE_TO_INTERNET.md +229 -0
  2. package/CHANGELOG.md +89 -1
  3. package/CONTRIBUTING.md +79 -0
  4. package/README.md +70 -143
  5. package/docs/README.md +1 -0
  6. package/docs/api/shared-gateway.md +1207 -0
  7. package/docs/troubleshooting/common-issues.md +28 -0
  8. package/docs/troubleshooting/faq.md +113 -12
  9. package/examples/basic/test/simulator/CMakeLists.txt +40 -0
  10. package/examples/basic/test/simulator/README.md +149 -0
  11. package/examples/basic/test/simulator/firmware/basic_firmware.hpp +117 -0
  12. package/examples/basic/test/simulator/scenarios/basic_mesh_test.yaml +81 -0
  13. package/examples/bridge/bridge.ino +17 -4
  14. package/examples/bridge_failover/README.md +81 -0
  15. package/examples/bridge_failover/bridge_failover.ino +51 -6
  16. package/examples/sharedGateway/README.md +235 -0
  17. package/examples/{meshCommandNode → sharedGateway}/platformio.ini +3 -2
  18. package/examples/sharedGateway/sharedGateway.ino +303 -0
  19. package/library.json +3 -22
  20. package/library.properties +1 -1
  21. package/package.json +3 -3
  22. package/src/arduino/wifi.hpp +380 -13
  23. package/src/painlessmesh/gateway.hpp +2120 -0
  24. package/src/painlessmesh/mesh.hpp +1034 -6
  25. package/src/painlessmesh/message_tracker.hpp +311 -0
  26. package/src/painlessmesh/protocol.hpp +6 -0
  27. package/DOCUMENTATION_INDEX.md +0 -146
  28. package/docs/API_DESIGN_GUIDELINES.md +0 -414
  29. package/docs/ARDUINO_LIBRARY_MANAGER_SUBMISSION.md +0 -331
  30. package/docs/BOOLEAN_NAMING_CONVENTION.md +0 -235
  31. package/docs/BRIDGE_FAILOVER.md +0 -512
  32. package/docs/BRIDGE_HEALTH_MONITORING.md +0 -293
  33. package/docs/CHANNEL_SYNCHRONIZATION.md +0 -209
  34. package/docs/CREATE_MISSING_RELEASES.md +0 -321
  35. package/docs/DOCUMENTATION_MIGRATION_PLAN.md +0 -176
  36. package/docs/FAQ_VERSION_NUMBERS.md +0 -152
  37. package/docs/IMPLEMENTATION_PLAN_MESH_TOPOLOGY.md +0 -1062
  38. package/docs/MESH_TOPOLOGY_GUIDE.md +0 -992
  39. package/docs/MESH_TOPOLOGY_PROGRESS.md +0 -422
  40. package/docs/MQTT_BRIDGE_COMMANDS.md +0 -894
  41. package/docs/MQTT_BRIDGE_IMPLEMENTATION_SUMMARY.md +0 -324
  42. package/docs/MQTT_COMMAND_SCHEMA_PROPOSAL.md +0 -576
  43. package/docs/MQTT_SCHEMA_COMPLIANCE.md +0 -340
  44. package/docs/MQTT_SCHEMA_PROPOSALS.md +0 -446
  45. package/docs/MQTT_SCHEMA_REVIEW.md +0 -690
  46. package/docs/OTA_COMMANDS_REFERENCE.md +0 -554
  47. package/docs/PHASE1_GUIDE.md +0 -349
  48. package/docs/PHASE2_GUIDE.md +0 -543
  49. package/docs/QUICK_REFERENCE_VERSIONING.md +0 -127
  50. package/docs/RELEASE_AGENT_SUMMARY.md +0 -386
  51. package/docs/SCHEMA_VALIDATION_CHECKLIST.md +0 -222
  52. package/docs/VERSION_MANAGEMENT.md +0 -213
  53. package/docs/archive/DOCUSAURUS_DEPLOYMENT.md +0 -166
  54. package/docs/archive/FEATURE_PROPOSALS.md +0 -337
  55. package/docs/archive/LIBRARY_JSON_FIX.md +0 -98
  56. package/docs/archive/LIBRARY_STRUCTURE_FIX.md +0 -215
  57. package/docs/archive/PHASE1_IMPLEMENTATION.md +0 -325
  58. package/docs/archive/PHASE2_IMPLEMENTATION.md +0 -567
  59. package/docs/archive/RELEASE_SUMMARY.md +0 -173
  60. package/docs/archive/SCONS_BUILD_FIX.md +0 -313
  61. package/docs/archive/TRIGGER_RELEASE.md +0 -280
  62. package/docs/archive/VECTOR_INCLUDE_FIX.md +0 -129
  63. package/docs/archive/ota-and-status-enhancements.md +0 -911
  64. package/docs/archive/ota-status-architecture-diagrams.md +0 -658
  65. package/docs/archive/ota-status-quick-reference.md +0 -284
  66. package/docs/design/.gitkeep +0 -1
  67. package/docs/design/STATION_CREDENTIALS_DESIGN.md +0 -182
  68. package/docs/development/ARDUINO_COMPLIANCE_SUMMARY.md +0 -71
  69. package/docs/development/CODE_REFACTORING_RECOMMENDATIONS.md +0 -1011
  70. package/docs/development/DOCKER_TESTING.md +0 -196
  71. package/docs/development/PLATFORMIO_USAGE.md +0 -180
  72. package/docs/development/TESTING_SUMMARY.md +0 -126
  73. package/docs/development/contributing.md +0 -301
  74. package/docs/development/documentation.md +0 -583
  75. package/docs/features/DIAGNOSTICS_API.md +0 -534
  76. package/docs/implementation/BRIDGE_ARCHITECTURE_IMPLEMENTATION.md +0 -340
  77. package/docs/implementation/BRIDGE_HEALTH_MONITORING_IMPLEMENTATION.md +0 -213
  78. package/docs/implementation/BRIDGE_STATUS_FEATURE.md +0 -635
  79. package/docs/implementation/DIAGNOSTICS_API_IMPLEMENTATION.md +0 -232
  80. package/docs/implementation/IMPLEMENTATION_COMPLETE.md +0 -228
  81. package/docs/implementation/IMPLEMENTATION_NTP_TIME_SYNC.md +0 -325
  82. package/docs/implementation/IMPLEMENTATION_SUMMARY.md +0 -316
  83. package/docs/implementation/MESSAGE_QUEUE_IMPLEMENTATION.md +0 -405
  84. package/docs/implementation/MULTI_BRIDGE_IMPLEMENTATION.md +0 -520
  85. package/docs/implementation/NTP_TIME_SYNC_FEATURE.md +0 -392
  86. package/docs/improvements/FUTURE_PROPOSALS.md +0 -1016
  87. package/docs/improvements/IMPLEMENTATION_HISTORY.md +0 -1091
  88. package/docs/improvements/OTA_STATUS_ENHANCEMENTS.md +0 -709
  89. package/docs/improvements/README.md +0 -212
  90. package/docs/internal/CUSTOM_AGENT_ANALYSIS.md +0 -391
  91. package/docs/internal/ISSUE_65_VERIFICATION.md +0 -947
  92. package/docs/internal/ISSUE_66_CLOSURE.md +0 -249
  93. package/docs/internal/ISSUE_66_STATUS.md +0 -316
  94. package/docs/internal/PR_SUMMARY.md +0 -315
  95. package/docs/internal/REVIEW_SUMMARY.md +0 -332
  96. package/docs/multi-bridge-setup.md +0 -1025
  97. package/docs/platformio-publishing.md +0 -255
  98. package/docs/platformio-setup-summary.md +0 -121
  99. package/docs/releases/ANNOUNCEMENT_v1.8.6.md +0 -63
  100. package/docs/releases/ANNOUNCEMENT_v1.8.7.md +0 -113
  101. package/docs/releases/BRIDGE_STATUS_SELF_REGISTRATION_FIX.md +0 -221
  102. package/docs/releases/FEATURE_HISTORY.md +0 -543
  103. package/docs/releases/GITHUB_RELEASE_v1.8.6.md +0 -71
  104. package/docs/releases/GITHUB_RELEASE_v1.8.7.md +0 -90
  105. package/docs/releases/PATCH_v1.7.2.md +0 -262
  106. package/docs/releases/PATCH_v1.7.3.md +0 -262
  107. package/docs/releases/PATCH_v1.7.4.md +0 -219
  108. package/docs/releases/PHASE1_SUMMARY.md +0 -246
  109. package/docs/releases/PHASE2_SUMMARY.md +0 -499
  110. package/docs/releases/PUBLISH_v1.8.0_INSTRUCTIONS.md +0 -163
  111. package/docs/releases/QUICK_START_RELEASES.md +0 -113
  112. package/docs/releases/RELEASE_CHECKLIST_1.8.10.md +0 -331
  113. package/docs/releases/RELEASE_CHECKLIST_1.8.9.md +0 -207
  114. package/docs/releases/RELEASE_CHECKLIST_v1.7.4.md +0 -253
  115. package/docs/releases/RELEASE_CHECKLIST_v1.7.5.md +0 -315
  116. package/docs/releases/RELEASE_CHECKLIST_v1.7.6.md +0 -389
  117. package/docs/releases/RELEASE_CHECKLIST_v1.8.0.md +0 -331
  118. package/docs/releases/RELEASE_CHECKLIST_v1.8.2.md +0 -309
  119. package/docs/releases/RELEASE_NOTES_1.7.0.md +0 -539
  120. package/docs/releases/RELEASE_NOTES_1.8.10.md +0 -239
  121. package/docs/releases/RELEASE_NOTES_1.8.9.md +0 -213
  122. package/docs/releases/RELEASE_NOTES_v1.8.0.md +0 -685
  123. package/docs/releases/RELEASE_NOTES_v1.8.1.md +0 -221
  124. package/docs/releases/RELEASE_NOTES_v1.8.2.md +0 -421
  125. package/docs/releases/RELEASE_NOTES_v1.8.3.md +0 -292
  126. package/docs/releases/RELEASE_NOTES_v1.8.4.md +0 -277
  127. package/docs/releases/RELEASE_NOTES_v1.8.6.md +0 -205
  128. package/docs/releases/RELEASE_NOTES_v1.8.7.md +0 -184
  129. package/docs/releases/RELEASE_PLAN_v1.7.6.md +0 -816
  130. package/docs/releases/RELEASE_SUMMARY_1.8.10.md +0 -193
  131. package/docs/releases/RELEASE_SUMMARY_v1.7.4.md +0 -276
  132. package/docs/releases/RELEASE_SUMMARY_v1.7.5.md +0 -322
  133. package/docs/releases/RELEASE_SUMMARY_v1.7.6.md +0 -436
  134. package/docs/releases/RELEASE_SUMMARY_v1.7.7.md +0 -391
  135. package/docs/releases/RELEASE_SUMMARY_v1.7.8.md +0 -523
  136. package/docs/releases/RELEASE_SUMMARY_v1.7.9.md +0 -542
  137. package/docs/troubleshooting/ARDUINO_IDE_VERSION_FIX_SUMMARY.md +0 -229
  138. package/docs/troubleshooting/ARDUINO_LIBRARY_NAME_FIX.md +0 -197
  139. package/docs/troubleshooting/CRASH_QUICK_REF.md +0 -93
  140. package/docs/troubleshooting/ESP32_C6_COMPATIBILITY.md +0 -157
  141. package/docs/troubleshooting/FREERTOS_ASSERTION_FAILURE.md +0 -288
  142. package/docs/troubleshooting/FREERTOS_FIX_IMPLEMENTATION.md +0 -267
  143. package/docs/troubleshooting/NPM_PUBLISHING_ISSUE_SUMMARY.md +0 -110
  144. package/docs/troubleshooting/PAINLESSMESH_V1.7.4_COMPILATION_ISSUES.md +0 -547
  145. package/docs/troubleshooting/QUICK_FIX_FREERTOS.md +0 -164
  146. package/docs/troubleshooting/SENSOR_NODE_CONNECTION_CRASH.md +0 -264
  147. package/docs/troubleshooting/station-reconnection-issues.md +0 -172
  148. package/docs/v1.7.7_MQTT_IMPROVEMENTS.md +0 -794
  149. package/docs/wiki/API-Reference.md +0 -246
  150. package/docs/wiki/Complete-Documentation.md +0 -123
  151. package/examples/alteriomImproved/alteriom_sensor_package.hpp +0 -224
  152. package/examples/alteriomImproved/improved_sensor_node.ino +0 -248
  153. package/examples/alteriomImproved/platformio.ini +0 -32
  154. package/examples/alteriomMetricsHealth/alteriom_sensor_package.hpp +0 -796
  155. package/examples/alteriomMetricsHealth/metrics_health_node.ino +0 -429
  156. package/examples/alteriomMetricsHealth/platformio.ini +0 -26
  157. package/examples/alteriomPhase1/alteriom_sensor_package.hpp +0 -224
  158. package/examples/alteriomPhase1/phase1_features.ino +0 -242
  159. package/examples/alteriomPhase1/platformio.ini +0 -26
  160. package/examples/alteriomPhase2/alteriom_sensor_package.hpp +0 -224
  161. package/examples/alteriomPhase2/phase2_features.ino +0 -186
  162. package/examples/alteriomPhase2/platformio.ini +0 -26
  163. package/examples/alteriomSensorNode/alteriom_sensor_node.ino +0 -186
  164. package/examples/alteriomSensorNode/alteriom_sensor_package.hpp +0 -1227
  165. package/examples/alteriomSensorNode/platformio.ini +0 -26
  166. package/examples/bridge/alteriom_sensor_package.hpp +0 -1170
  167. package/examples/bridge/bridge_health_monitoring_example.ino +0 -188
  168. package/examples/bridge/enhanced_mqtt_bridge.hpp +0 -610
  169. package/examples/bridge/enhanced_mqtt_bridge_example.ino +0 -226
  170. package/examples/bridge/mesh_event_publisher.hpp +0 -253
  171. package/examples/bridge/mesh_topology_reporter.hpp +0 -303
  172. package/examples/bridge/mqtt_command_bridge.hpp +0 -459
  173. package/examples/bridge/mqtt_status_bridge.hpp +0 -519
  174. package/examples/bridgeAwareSensorNode/alteriom_sensor_package.hpp +0 -1227
  175. package/examples/bridgeAwareSensorNode/bridgeAwareSensorNode.ino +0 -342
  176. package/examples/bridgeAwareSensorNode/platformio.ini +0 -26
  177. package/examples/diagnosticsExample/diagnosticsExample.ino +0 -171
  178. package/examples/diagnosticsExample/platformio.ini +0 -26
  179. package/examples/echoNode/echoNode.ino +0 -33
  180. package/examples/echoNode/platformio.ini +0 -26
  181. package/examples/meshCommandNode/alteriom_sensor_package.hpp +0 -235
  182. package/examples/meshCommandNode/meshCommandNode.ino +0 -265
  183. package/examples/mqttCommandBridge/alteriom_sensor_package.hpp +0 -235
  184. package/examples/mqttCommandBridge/mesh_event_publisher.hpp +0 -253
  185. package/examples/mqttCommandBridge/mesh_topology_reporter.hpp +0 -303
  186. package/examples/mqttCommandBridge/mqttCommandBridge.ino +0 -254
  187. package/examples/mqttCommandBridge/mqtt_command_bridge.hpp +0 -462
  188. package/examples/mqttCommandBridge/platformio.ini +0 -27
  189. package/examples/mqttStatusBridge/mqttStatusBridge.ino +0 -218
  190. package/examples/mqttStatusBridge/mqtt_status_bridge.hpp +0 -522
  191. package/examples/mqttStatusBridge/platformio.ini +0 -27
  192. package/examples/mqttTopologyTest/README.md +0 -467
  193. package/examples/mqttTopologyTest/mqttTopologyTest.ino +0 -754
  194. package/examples/mqttTopologyTest/platformio.ini +0 -27
  195. package/examples/multi_bridge/README.md +0 -346
  196. package/examples/multi_bridge/primary_bridge.ino +0 -96
  197. package/examples/multi_bridge/regular_node.ino +0 -141
  198. package/examples/multi_bridge/secondary_bridge.ino +0 -111
  199. package/examples/ntpTimeSyncBridge/alteriom_sensor_package.hpp +0 -1383
  200. package/examples/ntpTimeSyncBridge/ntpTimeSyncBridge.ino +0 -86
  201. package/examples/ntpTimeSyncNode/alteriom_sensor_package.hpp +0 -1383
  202. package/examples/ntpTimeSyncNode/ntpTimeSyncNode.ino +0 -109
  203. package/examples/queued_alarms/README.md +0 -390
  204. package/examples/queued_alarms/queued_alarms.ino +0 -265
  205. package/examples/routing_demo/README.md +0 -172
  206. package/examples/routing_demo/routing_demo.ino +0 -102
  207. package/examples/rtcIntegration/README.md +0 -294
  208. package/examples/rtcIntegration/rtcIntegration.ino +0 -210
@@ -1,547 +0,0 @@
1
- # painlessMesh v1.7.4 & v1.7.5 Compilation Issues
2
-
3
- > ## ✅ RESOLVED IN v1.7.6 (October 19, 2025)
4
- >
5
- > **The compilation issues described in this document have been fixed in v1.7.6.**
6
- >
7
- > **Solution:** Removed `scheduler_queue.hpp` and `scheduler_queue.cpp` files that required disabled `_TASK_THREAD_SAFE` macro.
8
- >
9
- > **Action Required:** Upgrade to v1.7.6 immediately if you're on v1.7.4 or v1.7.5.
10
- >
11
- > **Details:** See [RELEASE_SUMMARY_v1.7.6.md](../releases/RELEASE_SUMMARY_v1.7.6.md)
12
-
13
- **Date**: October 19, 2025
14
- **Affected Versions**: v1.7.4, v1.7.5
15
- **Resolved Version**: v1.7.6
16
- **Working Version**: v1.7.2
17
- **Platform**: ESP32 (espressif32@6.8.1)
18
- **Framework**: Arduino
19
- **Project**: Alteriom Firmware
20
-
21
- ---
22
-
23
- ## Executive Summary
24
-
25
- painlessMesh versions v1.7.4 and v1.7.5, which include FreeRTOS crash fixes, fail to compile with TaskScheduler v4.0.2 due to missing type definitions (`_task_request_t`) in the thread-safe scheduler queue implementation. The issue stems from an incompatibility between the thread-safe mode (`_TASK_THREAD_SAFE`) and the standard TaskScheduler configuration.
26
-
27
- **Impact**: Cannot upgrade from v1.7.2 to access FreeRTOS crash fixes, leaving devices vulnerable to `vTaskPriorityDisinheritAfterTimeout` assertion failures when sensor nodes connect.
28
-
29
- ---
30
-
31
- ## Problem Description
32
-
33
- ### Symptom
34
-
35
- Compilation fails when building with painlessMesh v1.7.4 or v1.7.5:
36
-
37
- ```
38
- .pio/libdeps/universal-gateway/AlteriomPainlessMesh/src/painlessmesh/scheduler_queue.cpp:16:49:
39
- error: '_task_request_t' was not declared in this scope
40
- tsQueue = xQueueCreate(TS_QUEUE_LEN, sizeof(_task_request_t));
41
- ^~~~~~~~~~~~~~~
42
- ```
43
-
44
- ### Root Cause
45
-
46
- The `scheduler_queue.cpp` implementation expects the `_task_request_t` type to be defined by TaskScheduler when `_TASK_THREAD_SAFE` is enabled, but:
47
-
48
- 1. **TaskScheduler v4.0.2** only defines `_task_request_t` when `_TASK_THREAD_SAFE` is enabled **before** including `TaskScheduler.h`
49
- 2. **painlessMesh v1.7.4/v1.7.5** enables `_TASK_THREAD_SAFE` in `painlessTaskOptions.h` but this happens **after** TaskScheduler headers are processed
50
- 3. **Timing Issue**: The macro definition occurs too late in the compilation sequence
51
-
52
- ### What Changed in v1.7.4+
53
-
54
- painlessMesh v1.7.4 introduced a thread-safe scheduler queue to fix FreeRTOS crashes:
55
-
56
- **New Files**:
57
- - `src/painlessmesh/scheduler_queue.hpp`
58
- - `src/painlessmesh/scheduler_queue.cpp`
59
-
60
- **Modified Files**:
61
- - `src/painlessTaskOptions.h` - Added `#define _TASK_THREAD_SAFE` for ESP32
62
- - `src/painlessmesh/mesh.hpp` - Added queue initialization
63
-
64
- **Purpose**: Prevent FreeRTOS `vTaskPriorityDisinheritAfterTimeout` assertion failures by using FreeRTOS queues for thread-safe task control.
65
-
66
- ---
67
-
68
- ## Compilation Error Details
69
-
70
- ### v1.7.4 Build Attempt (Build 8022)
71
-
72
- **Command**:
73
- ```bash
74
- $env:BUILD_NUMBER_OVERRIDE="8022"; docker-compose run --rm alteriom-builder pio run -e universal-gateway
75
- ```
76
-
77
- **Error Output**:
78
- ```
79
- Compiling .pio/build/universal-gateway/lib55b/AlteriomPainlessMesh/painlessmesh/scheduler_queue.cpp.o
80
-
81
- .pio/libdeps/universal-gateway/AlteriomPainlessMesh/src/painlessmesh/scheduler_queue.cpp:
82
- In function 'bool painlessmesh::scheduler::initQueue()':
83
-
84
- .pio/libdeps/universal-gateway/AlteriomPainlessMesh/src/painlessmesh/scheduler_queue.cpp:16:49:
85
- error: '_task_request_t' was not declared in this scope
86
- tsQueue = xQueueCreate(TS_QUEUE_LEN, sizeof(_task_request_t));
87
- ^~~~~~~~~~~~~~~
88
-
89
- .pio/libdeps/universal-gateway/AlteriomPainlessMesh/src/painlessmesh/scheduler_queue.cpp:29:28:
90
- error: '_task_request_t' was not declared in this scope
91
- bool _task_enqueue_request(_task_request_t* req) {
92
- ^~~~~~~~~~~~~~~
93
-
94
- .pio/libdeps/universal-gateway/AlteriomPainlessMesh/src/painlessmesh/scheduler_queue.cpp:29:45:
95
- error: 'req' was not declared in this scope
96
- bool _task_enqueue_request(_task_request_t* req) {
97
- ^~~
98
-
99
- .pio/libdeps/universal-gateway/AlteriomPainlessMesh/src/painlessmesh/scheduler_queue.cpp:56:28:
100
- error: '_task_request_t' was not declared in this scope
101
- bool _task_dequeue_request(_task_request_t* req) {
102
- ^~~~~~~~~~~~~~~
103
-
104
- .pio/libdeps/universal-gateway/AlteriomPainlessMesh/src/painlessmesh/scheduler_queue.cpp:56:45:
105
- error: 'req' was not declared in this scope
106
- bool _task_dequeue_request(_task_request_t* req) {
107
- ^~~
108
-
109
- *** [.pio/build/universal-gateway/lib55b/AlteriomPainlessMesh/painlessmesh/scheduler_queue.cpp.o] Error 1
110
- ```
111
-
112
- ### v1.7.5 Build Attempt (Build 8024)
113
-
114
- **Command**:
115
- ```bash
116
- $env:BUILD_NUMBER_OVERRIDE="8024"; docker-compose run --rm alteriom-builder pio run -e universal-gateway
117
- ```
118
-
119
- **Result**: **IDENTICAL ERRORS** to v1.7.4
120
-
121
- **Library Version Installed**: `AlteriomPainlessMesh@1.7.5+sha.499d597`
122
-
123
- **Conclusion**: v1.7.5 did not resolve the compilation issues present in v1.7.4.
124
-
125
- ---
126
-
127
- ## Technical Analysis
128
-
129
- ### Expected Type Definition
130
-
131
- The `_task_request_t` type should be defined in TaskScheduler when thread-safe mode is enabled:
132
-
133
- **Expected from TaskScheduler** (`TaskSchedulerDeclarations.h`):
134
- ```cpp
135
- #ifdef _TASK_THREAD_SAFE
136
- typedef struct {
137
- Task* task;
138
- unsigned long param1;
139
- long param2;
140
- TaskCallback param3;
141
- TaskOnEnable param4;
142
- TaskOnDisable param5;
143
- int request_type;
144
- } _task_request_t;
145
- #endif
146
- ```
147
-
148
- ### Actual Configuration
149
-
150
- **painlessMesh v1.7.4/v1.7.5** (`src/painlessTaskOptions.h`):
151
- ```cpp
152
- #define _TASK_PRIORITY // Support for layered scheduling priority
153
-
154
- // Thread-safe scheduler for ESP32 to prevent FreeRTOS assertion failures
155
- #ifdef ESP32
156
- #define _TASK_THREAD_SAFE // Enable FreeRTOS queue-based task control
157
- // Note: _TASK_STD_FUNCTION is incompatible with _TASK_THREAD_SAFE in TaskScheduler v4.0.x
158
- #else
159
- #define _TASK_STD_FUNCTION // Support for std::function (ESP8266 ONLY)
160
- #endif
161
- ```
162
-
163
- ### Include Order Problem
164
-
165
- The issue is with the include order and macro visibility:
166
-
167
- 1. **Step 1**: Project includes `painlessMesh.h`
168
- 2. **Step 2**: `painlessMesh.h` includes `TaskSchedulerDeclarations.h` (before `painlessTaskOptions.h`)
169
- 3. **Step 3**: TaskScheduler processes without `_TASK_THREAD_SAFE` defined
170
- 4. **Step 4**: `_task_request_t` type is NOT defined
171
- 5. **Step 5**: Later, `scheduler_queue.cpp` tries to use undefined type
172
-
173
- ### Additional Incompatibility
174
-
175
- painlessMesh documentation notes:
176
- > "_TASK_STD_FUNCTION is incompatible with _TASK_THREAD_SAFE in TaskScheduler v4.0.x"
177
-
178
- This creates a fundamental conflict:
179
- - **ESP8266**: Uses `_TASK_STD_FUNCTION` (std::function callbacks)
180
- - **ESP32**: Needs `_TASK_THREAD_SAFE` (FreeRTOS queue)
181
- - **TaskScheduler v4.0.2**: Cannot support both simultaneously
182
-
183
- ---
184
-
185
- ## Build Environment Details
186
-
187
- ### Successful Build (v1.7.2)
188
-
189
- **Version**: `AlteriomPainlessMesh@1.7.2+sha.1d0ba8d`
190
- **Build Number**: 8021
191
- **Compilation**: ✅ **SUCCESS**
192
- **Runtime**: ❌ Crashes with FreeRTOS assertion when sensor nodes connect
193
-
194
- **Build Output**:
195
- ```
196
- Library Manager: AlteriomPainlessMesh@1.7.2+sha.1d0ba8d has been installed!
197
- [SUCCESS] Took 260.55 seconds
198
- RAM: [==== ] 36.2% (used 118620 bytes from 327680 bytes)
199
- Flash: [========= ] 85.6% (used 1570349 bytes from 1835008 bytes)
200
- ```
201
-
202
- ### Failed Build (v1.7.4)
203
-
204
- **Version**: `AlteriomPainlessMesh@1.7.4+sha.7cd66ac`
205
- **Build Number**: 8022
206
- **Compilation**: ❌ **FAILED**
207
- **Error**: Missing `_task_request_t` type definition
208
-
209
- **Build Time to Failure**: ~288 seconds (4 min 48 sec)
210
- **Failure Point**: Compiling `scheduler_queue.cpp`
211
-
212
- ### Failed Build (v1.7.5)
213
-
214
- **Version**: `AlteriomPainlessMesh@1.7.5+sha.499d597`
215
- **Build Number**: 8024
216
- **Compilation**: ❌ **FAILED**
217
- **Error**: Missing `_task_request_t` type definition (identical to v1.7.4)
218
-
219
- **Build Time to Failure**: ~242 seconds (4 min 2 sec)
220
- **Failure Point**: Compiling `scheduler_queue.cpp`
221
-
222
- ### Docker Build Environment
223
-
224
- **Platform**: Espressif 32 (6.8.1)
225
- **Framework**: Arduino (framework-arduinoespressif32 @ 3.20017.241212+sha.dcc1105b)
226
- **Toolchain**: toolchain-xtensa-esp32 @ 8.4.0+2021r2-patch5
227
- **Board**: ESP32-D0WD-V3 (revision 3)
228
-
229
- **Libraries**:
230
- - **TaskScheduler**: v4.0.2 (arkhipenko/TaskScheduler)
231
- - **ArduinoJson**: v7.4.2
232
- - **AsyncTCP**: v3.4.9
233
- - **PubSubClient**: v2.8.0
234
-
235
- ---
236
-
237
- ## Attempted Workarounds
238
-
239
- ### Attempt 1: Use v1.7.3
240
-
241
- **Theory**: v1.7.3 might be intermediate version between v1.7.2 (working) and v1.7.4 (broken)
242
-
243
- **Configuration**:
244
- ```ini
245
- [common_libs]
246
- lib_deps =
247
- https://github.com/Alteriom/painlessMesh.git#v1.7.3
248
- ```
249
-
250
- **Result**: ❌ **FAILED**
251
- - Git tag v1.7.3 exists but resolves to SHA `86e2ccc` which is **v1.7.2**
252
- - Library Manager shows: `AlteriomPainlessMesh@1.7.2+sha.86e2ccc`
253
- - Conclusion: v1.7.3 tag is mislabeled
254
-
255
- ### Attempt 2: Use v1.7.5 (Latest)
256
-
257
- **Theory**: v1.7.5 might fix the v1.7.4 compilation issues
258
-
259
- **Configuration**:
260
- ```ini
261
- [common_libs]
262
- lib_deps =
263
- https://github.com/Alteriom/painlessMesh.git#v1.7.5
264
- ```
265
-
266
- **Result**: ❌ **FAILED**
267
- - Identical compilation errors to v1.7.4
268
- - Same missing `_task_request_t` type
269
- - No improvement in include order or type visibility
270
-
271
- ### Attempt 3: Uninstall and Reinstall Library
272
-
273
- **Theory**: Cached library might be corrupt or using wrong version
274
-
275
- **Commands**:
276
- ```bash
277
- docker-compose run --rm alteriom-builder pio pkg uninstall --library "https://github.com/Alteriom/painlessMesh.git#v1.7.2"
278
- docker-compose run --rm alteriom-builder pio pkg install --library "https://github.com/Alteriom/painlessMesh.git#v1.7.4"
279
- ```
280
-
281
- **Result**: ❌ **FAILED**
282
- - Fresh library download still has compilation errors
283
- - Confirms issue is in library code, not local environment
284
-
285
- ---
286
-
287
- ## Current Workaround
288
-
289
- ### Stay on v1.7.2 with Known Limitations
290
-
291
- **Configuration** (`platformio.ini`):
292
- ```ini
293
- [common_libs]
294
- lib_deps =
295
- https://github.com/Alteriom/painlessMesh.git#v1.7.2 ; Only version that compiles
296
- knolleary/PubSubClient@^2.8
297
- ```
298
-
299
- **Trade-offs**:
300
- - ✅ **Compiles successfully**
301
- - ✅ **Can test MQTT buffer fixes** (for ~15 seconds before crash)
302
- - ❌ **FreeRTOS crashes** when sensor nodes connect (~15-20 seconds uptime)
303
- - ❌ **Cannot achieve stable mesh network**
304
-
305
- **Crash Pattern**:
306
- ```
307
- [GATEWAY MESH DEBUG] Current connected nodes: 1
308
- [GATEWAY MESH DEBUG] Node IDs: 1693975713
309
- CONNECTION: newConnectionTask(): adding 1693975713 now= 15192604
310
-
311
- assert failed: vTaskPriorityDisinheritAfterTimeout tasks.c:5034
312
- (pxTCB != pxCurrentTCB[xPortGetCoreID()])
313
-
314
- Backtrace: 0x40083831:0x3ffb1e70 0x4008ee75:0x3ffb1e90 0x4009465d:0x3ffb1eb0
315
-
316
- E (15264) esp_core_dump_flash: Core dump flash config is corrupted!
317
- Rebooting...
318
- ```
319
-
320
- ---
321
-
322
- ## Impact on Alteriom Project
323
-
324
- ### Development Blocked
325
-
326
- 1. **Phase 2 MQTT Commands**: Cannot fully test due to 15-second crash loop
327
- 2. **Mesh Stability**: Cannot achieve multi-node mesh networks
328
- 3. **Production Deployment**: Cannot deploy gateway firmware with sensor nodes
329
-
330
- ### Current Status
331
-
332
- **Build 8021** (Current):
333
- - **Firmware Version**: GW 2.3.7
334
- - **Build Number**: 8021 (32-MSH)
335
- - **painlessMesh**: v1.7.2
336
- - **MQTT Buffer**: 4096 bytes (increased from 256 - **READY TO TEST**)
337
- - **Status**: Compiles ✅, Crashes ❌
338
-
339
- **Testing Limitations**:
340
- - Can observe MQTT diagnostics for ~15 seconds
341
- - Can send commands but device reboots before response
342
- - Cannot validate MQTT buffer fix effectiveness
343
- - Cannot test `get_config` command responses
344
-
345
- ---
346
-
347
- ## Recommended Solutions
348
-
349
- ### Option 1: Wait for painlessMesh v1.7.6 (RECOMMENDED)
350
-
351
- **Requirements**:
352
- - Fix `_task_request_t` type visibility issue
353
- - Ensure `_TASK_THREAD_SAFE` macro is defined before TaskScheduler inclusion
354
- - Test compilation with TaskScheduler v4.0.2
355
- - Validate thread-safe queue implementation works
356
-
357
- **Timeline**: Unknown - depends on upstream maintainers
358
-
359
- **Risk**: Low - lets experts fix the issue properly
360
-
361
- ### Option 2: Manual Patch v1.7.5 Locally
362
-
363
- **Steps**:
364
- 1. Clone painlessMesh v1.7.5 locally
365
- 2. Modify include order in `scheduler_queue.hpp`:
366
- ```cpp
367
- #ifdef ESP32
368
-
369
- // MUST include TaskScheduler declarations FIRST
370
- #define _TASK_THREAD_SAFE // Define BEFORE including TaskScheduler
371
- #include <TaskSchedulerDeclarations.h>
372
-
373
- #include <freertos/FreeRTOS.h>
374
- #include <freertos/queue.h>
375
- // ... rest of includes
376
- ```
377
- 3. Test compilation
378
- 4. Submit pull request to painlessMesh
379
-
380
- **Risk**: Medium - requires understanding of build system
381
-
382
- ### Option 3: Increase Semaphore Timeout in v1.7.2
383
-
384
- **Workaround**: Apply FreeRTOS fix manually without thread-safe queue
385
-
386
- **Implementation**:
387
- Modify `.pio/libdeps/universal-gateway/AlteriomPainlessMesh/src/painlessmesh/mesh.hpp` line 544:
388
-
389
- **Change from**:
390
- ```cpp
391
- return xSemaphoreTake(xSemaphore, (TickType_t)10) == pdTRUE;
392
- ```
393
-
394
- **Change to**:
395
- ```cpp
396
- return xSemaphoreTake(xSemaphore, (TickType_t)100) == pdTRUE;
397
- ```
398
-
399
- **Effectiveness**: ~80-85% reduction in crashes (according to painlessMesh docs)
400
- **Risk**: Medium - modifies library code directly, lost on clean builds
401
- **Benefit**: No compilation issues, simpler fix
402
-
403
- ---
404
-
405
- ## Files Affected
406
-
407
- ### Working Version (v1.7.2)
408
-
409
- **Modified in Alteriom Project**:
410
- - `platformio.ini` - Library version pinned to v1.7.2
411
- - `src/gateway/common_functions.cpp` - Added MQTT diagnostics (Build 8021)
412
- - `platformio.ini` - Added `-D MQTT_MAX_PACKET_SIZE=4096` (Build 8021)
413
-
414
- ### Problematic Files (v1.7.4/v1.7.5)
415
-
416
- **painlessMesh Library**:
417
- - `src/painlessTaskOptions.h` - Defines `_TASK_THREAD_SAFE` (too late in compilation)
418
- - `src/painlessmesh/scheduler_queue.hpp` - Declares queue functions
419
- - `src/painlessmesh/scheduler_queue.cpp` - **FAILS TO COMPILE** - missing type definitions
420
- - `src/painlessmesh/mesh.hpp` - Calls `scheduler::initQueue()`
421
-
422
- ---
423
-
424
- ## Testing Evidence
425
-
426
- ### Build Timeline
427
-
428
- | Build | Version | Status | Duration | Outcome |
429
- |-------|---------|--------|----------|---------|
430
- | 8020 | v1.7.2 | ✅ Success | 260s | Compiles, crashes in runtime |
431
- | 8021 | v1.7.2 | ✅ Success | ~260s | Compiles, crashes in runtime, **has MQTT fix** |
432
- | 8022 | v1.7.4 | ❌ Failed | 288s | Compilation error: `_task_request_t` |
433
- | 8023 | v1.7.3 | ❌ Failed | 291s | Actually v1.7.2, same issues |
434
- | 8024 | v1.7.5 | ❌ Failed | 242s | Compilation error: `_task_request_t` |
435
-
436
- ### Serial Output (v1.7.2 Runtime Crash)
437
-
438
- ```
439
- === GATEWAY NODE BOOT SEQUENCE ===
440
- Firmware Version: GW 2.3.7
441
- Build Info: Build 8021 (32-MSH)
442
- Gateway Device ID: ALT-6825DD341CA4
443
-
444
- [PHASE 1] Display initialization... ✓
445
- [PHASE 2] Configuration loading... ✓
446
- [PHASE 3] WiFi connection... ✓
447
- WiFi connected! IP: 192.168.1.178
448
-
449
- [PHASE 4] Time synchronization... ✓
450
- [PHASE 5] MQTT connection... ✓
451
- ✅ MQTT: Connected successfully
452
- ✅ MQTT: Subscribed to gateway command topic: alteriom/gateway/ALT-6825DD341CA4/command
453
-
454
- [PHASE 6] Mesh initialization... ✓
455
- [PHASE 7] Sensor initialization... ✓
456
- [PHASE 8] Display ready... ✓
457
-
458
- Total Boot Time: 11389 ms
459
- Ready for operation.
460
-
461
- [INFO] Active mesh nodes: 0
462
-
463
- [15 seconds later]
464
-
465
- [GATEWAY MESH DEBUG] Current connected nodes: 1
466
- [GATEWAY MESH DEBUG] Node IDs: 1693975713
467
- CONNECTION: newConnectionTask(): adding 1693975713 now= 15192604
468
-
469
- assert failed: vTaskPriorityDisinheritAfterTimeout tasks.c:5034
470
- (pxTCB != pxCurrentTCB[xPortGetCoreID()])
471
-
472
- Backtrace: 0x40083831:0x3ffb1e70 0x4008ee75:0x3ffb1e90 0x4009465d:0x3ffb1eb0 ...
473
-
474
- Rebooting...
475
- ```
476
-
477
- **Crash Frequency**: 100% reproducible when sensor node connects
478
-
479
- ---
480
-
481
- ## GitHub Issue Template
482
-
483
- ### Title
484
- `[ESP32] v1.7.4/v1.7.5 Compilation Failure: _task_request_t not declared`
485
-
486
- ### Description
487
- ```markdown
488
- ## Environment
489
- - **Platform**: ESP32 (espressif32@6.8.1)
490
- - **Framework**: Arduino
491
- - **TaskScheduler Version**: v4.0.2
492
- - **painlessMesh Versions Affected**: v1.7.4, v1.7.5
493
- - **Working Version**: v1.7.2
494
-
495
- ## Issue
496
- Compilation fails with "error: '_task_request_t' was not declared" when building with v1.7.4 or v1.7.5.
497
-
498
- ## Error Output
499
- ```
500
- .pio/libdeps/.../AlteriomPainlessMesh/src/painlessmesh/scheduler_queue.cpp:16:49:
501
- error: '_task_request_t' was not declared in this scope
502
- tsQueue = xQueueCreate(TS_QUEUE_LEN, sizeof(_task_request_t));
503
- ^~~~~~~~~~~~~~~
504
- ```
505
-
506
- ## Root Cause
507
- The `_task_request_t` type is not visible when compiling `scheduler_queue.cpp` because:
508
- 1. `_TASK_THREAD_SAFE` is defined in `painlessTaskOptions.h`
509
- 2. TaskScheduler headers are included before this definition takes effect
510
- 3. Type definition depends on macro being set before TaskScheduler inclusion
511
-
512
- ## Proposed Fix
513
- Move `#define _TASK_THREAD_SAFE` to occur before including TaskScheduler headers, or include `TaskSchedulerDeclarations.h` after defining the macro in `scheduler_queue.hpp`.
514
-
515
- ## Workaround
516
- Stay on v1.7.2, which compiles successfully (but has FreeRTOS crash bug).
517
- ```
518
-
519
- ---
520
-
521
- ## References
522
-
523
- ### painlessMesh Documentation
524
- - v1.7.4 Release Notes: `docs/releases/PATCH_v1.7.4.md`
525
- - FreeRTOS Fix Implementation: `docs/troubleshooting/FREERTOS_FIX_IMPLEMENTATION.md`
526
- - Quick Fix Guide: `docs/troubleshooting/QUICK_FIX_FREERTOS.md`
527
-
528
- ### Related Commits
529
- - **7391717**: "fix: Implement thread-safe scheduler for ESP32 FreeRTOS" (v1.7.4)
530
- - **65afb16**: "fix: Increase semaphore timeout from 10 to 100 ticks" (v1.7.4)
531
- - **499d597**: v1.7.5 release commit
532
-
533
- ### External Links
534
- - [TaskScheduler GitHub](https://github.com/arkhipenko/TaskScheduler)
535
- - [painlessMesh Repository](https://github.com/Alteriom/painlessMesh)
536
- - [FreeRTOS Documentation](https://www.freertos.org/a00113.html)
537
-
538
- ---
539
-
540
- ## Document Status
541
-
542
- **Last Updated**: October 19, 2025
543
- **Author**: Alteriom Development Team
544
- **Status**: Active Issue
545
- **Next Review**: When painlessMesh v1.7.6 is released
546
-
547
- **Keywords**: painlessMesh, TaskScheduler, FreeRTOS, ESP32, compilation error, _task_request_t, thread-safe, v1.7.4, v1.7.5
@@ -1,164 +0,0 @@
1
- # Quick Fix: FreeRTOS Assertion Failure
2
-
3
- ## Immediate Solution
4
-
5
- If you're experiencing `assert failed: vTaskPriorityDisinheritAfterTimeout` crashes, apply this quick fix NOW:
6
-
7
- ### Option A: Increase Semaphore Timeout (5 minutes to fix)
8
-
9
- **File:** `src/painlessmesh/mesh.hpp`
10
- **Line:** 544
11
-
12
- **Change from:**
13
- ```cpp
14
- return xSemaphoreTake(xSemaphore, (TickType_t)10) == pdTRUE;
15
- ```
16
-
17
- **Change to:**
18
- ```cpp
19
- return xSemaphoreTake(xSemaphore, (TickType_t)100) == pdTRUE;
20
- ```
21
-
22
- **Steps:**
23
- ```bash
24
- # 1. Edit the file
25
- code src/painlessmesh/mesh.hpp
26
-
27
- # 2. Find line 544 and change 10 to 100
28
-
29
- # 3. Rebuild and upload
30
- pio run -t upload
31
-
32
- # 4. Test
33
- ```
34
-
35
- ### Option B: Enable Thread-Safe Scheduler (10 minutes to fix)
36
-
37
- **File:** Create or edit `painlessTaskOptions.h` in your sketch folder
38
-
39
- **Add:**
40
- ```cpp
41
- #ifndef _PAINLESS_TASK_OPTIONS_H_
42
- #define _PAINLESS_TASK_OPTIONS_H_
43
-
44
- #ifdef ESP32
45
- #define _TASK_THREAD_SAFE // Enable thread safety
46
- #define _TASK_PRIORITY // Enable priority scheduling
47
- #endif
48
-
49
- #endif
50
- ```
51
-
52
- **In your main sketch, add BEFORE including painlessMesh:**
53
- ```cpp
54
- #include "painlessTaskOptions.h"
55
- #include <painlessMesh.h>
56
- ```
57
-
58
- ### Option C: Use Binary Semaphore (5 minutes to fix)
59
-
60
- **File:** `src/painlessmesh/mesh.hpp`
61
- **Line:** 43
62
-
63
- **Change from:**
64
- ```cpp
65
- xSemaphore = xSemaphoreCreateMutex();
66
- ```
67
-
68
- **Change to:**
69
- ```cpp
70
- xSemaphore = xSemaphoreCreateBinary();
71
- xSemaphoreGive(xSemaphore); // Initialize
72
- ```
73
-
74
- ## Which Option Should I Use?
75
-
76
- | Option | Complexity | Effectiveness | Risk |
77
- |--------|-----------|---------------|------|
78
- | A: Increase Timeout | ⭐ Easy | ⭐⭐⭐ Good | Low |
79
- | B: Thread-Safe | ⭐⭐ Medium | ⭐⭐⭐⭐⭐ Excellent | Very Low |
80
- | C: Binary Semaphore | ⭐ Easy | ⭐⭐⭐ Good | Medium |
81
-
82
- **Recommendation:** Start with **Option A** for immediate relief, then implement **Option B** for long-term stability.
83
-
84
- ## Verification
85
-
86
- After applying the fix:
87
-
88
- ```cpp
89
- void setup() {
90
- Serial.begin(115200);
91
- mesh.init(...);
92
-
93
- // Add monitoring
94
- mesh.onNewConnection([](uint32_t nodeId) {
95
- Serial.printf("New connection: %u, Free heap: %d\n",
96
- nodeId, ESP.getFreeHeap());
97
- });
98
- }
99
-
100
- void loop() {
101
- mesh.update();
102
-
103
- // Monitor every 10 seconds
104
- static uint32_t lastCheck = 0;
105
- if (millis() - lastCheck > 10000) {
106
- lastCheck = millis();
107
- Serial.printf("Heap: %d, Min: %d, Stack HWM: %d\n",
108
- ESP.getFreeHeap(),
109
- ESP.getMinFreeHeap(),
110
- uxTaskGetStackHighWaterMark(NULL));
111
- }
112
- }
113
- ```
114
-
115
- ## Still Crashing?
116
-
117
- 1. **Check stack size:**
118
- ```cpp
119
- // In platformio.ini
120
- build_flags = -DCONFIG_ARDUINO_LOOP_STACK_SIZE=8192
121
- ```
122
-
123
- 2. **Reduce connections:**
124
- ```cpp
125
- // In configuration.hpp or your sketch
126
- #define MAX_CONN 4 // Reduce from 10
127
- ```
128
-
129
- 3. **Enable detailed logging:**
130
- ```cpp
131
- #define CORE_DEBUG_LEVEL 4
132
- ```
133
-
134
- 4. See full documentation: [FREERTOS_ASSERTION_FAILURE.md](./FREERTOS_ASSERTION_FAILURE.md)
135
-
136
- ## Emergency: Disable Semaphore Completely
137
-
138
- **⚠️ WARNING:** Only use if nothing else works and you're sure mesh is single-threaded
139
-
140
- **File:** `src/painlessmesh/mesh.hpp`
141
-
142
- **Lines 542-560, replace with:**
143
- ```cpp
144
- bool semaphoreTake() {
145
- return true; // EMERGENCY: Disabled semaphore
146
- }
147
-
148
- void semaphoreGive() {
149
- // No-op
150
- }
151
- ```
152
-
153
- This removes all thread safety but will stop the crashes. **Use at your own risk!**
154
-
155
- ---
156
-
157
- **Success Rate:**
158
- - Option A: ~80% of cases resolved
159
- - Option B: ~95% of cases resolved
160
- - Option C: ~70% of cases resolved
161
- - Emergency: 100% but unsafe
162
-
163
- **Time to Fix:** 5-10 minutes
164
- **Testing Time:** 30 minutes (verify stability)