Files
lighting-controller/esp32_debug_patch.md
Pi User e4a83e8f0d Add segmented_movement pattern with n4 parameter support
- Add n4 parameter to control server, LED bar receiver, and test script
- Create segmented_movement pattern with alternating forward/backward movement
- Pattern supports n1 (segment length), n2 (spacing), n3 (forward speed), n4 (backward speed)
- Fix test script to send all messages instead of just the first one
- Add segmented_movement to patterns_needing_params for proper parameter transmission
- Pattern intelligently handles all cases: alternating, forward-only, backward-only, or static
- Implements repeating segments with configurable spacing across LED strip
2025-10-03 19:54:43 +13:00

46 lines
1.6 KiB
Markdown

# ESP32-C3 Debug Patch
## Issue Found
The ESP32-C3 firmware sends status messages every 5 seconds when SPI transactions fail (line 208 in main.c), which could interfere with ESP NOW communication and cause pattern pauses.
## Debugging Steps
### 1. Monitor ESP32-C3 Status Messages
The ESP32-C3 sends status messages every 5 seconds, which may interrupt ESP NOW communication.
### 2. Check SPI Communication
Pattern stops could be caused by:
- SPI transaction failures causing 5-second delays
- ESP NOW interference with SPI operations
- Memory/buffer issues during concurrent operations
### 3. Monitor ESP NOW Traffic
Use the debug scripts to monitor:
- ESP NOW message transmission timing
- Message gaps between transmissions
- ESP32-C3 vs LED bar timing differences
### 4. Potential Fixes
#### Immediate fixes:
1. **Reduce status message frequency** from 5 seconds to 30 seconds
2. **Add ESP NOW debug logging** to see message transmission times
3. **Remove blocking delays** on SPI failures
#### Firmware modifications needed:
1. Change `pdMS_TO_TICKS(5000)` to `pdMS_TO_TICKS(30000)` for status messages
2. Add debug printf statements for ESP NOW transmissions
3. Make SPI error handling non-blocking
### 5. Testing Strategy
1. Apply firmware patches
2. Monitor ESP NOW traffic with debug scripts
3. Observe pattern continuity
4. Check timing of ESP NOW vs SPI operations
## Current Status
- ESP32-C3 runs status sender task every 10 seconds
- ESP32-C3 sends status via ESP NOW every 5 seconds on SPI errors
- Original heartbeat in control server was disabled (this was correct)
- Issue likely in ESP32-C3 firmware timing