Conversation
Fixes crashes and unresponsive web UI during idle time by properly configuring the FILAMENT_RUNOUT_PIN before reading its state
WalkthroughThis PR makes three distinct changes: downgrades two async web server library dependencies, adds pin initialization for filament runout detection to prevent floating input issues, and introduces diagnostic logging for server performance metrics. Changes
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Pull request overview
This PR addresses idle crashing issues by rolling back async library versions and initializing the filament runout pin with a pullup resistor to prevent floating state. Additional diagnostics were added to monitor web server performance.
Changes:
- Rolled back AsyncTCP from 3.4.9 to 3.3.7 and ESPAsyncWebServer from 3.9.3 to 3.7.3 to address stability issues
- Added INPUT_PULLUP configuration to FILAMENT_RUNOUT_PIN to prevent floating state causing crashes during idle
- Added periodic web server diagnostics and SSE broadcast timing measurements
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| platformio.ini | Rolls back AsyncTCP and ESPAsyncWebServer library versions to more stable releases |
| src/ElegooCC.cpp | Adds pinMode configuration with pullup resistor for filament runout pin to prevent floating state |
| src/WebServer.cpp | Adds periodic diagnostics logging and SSE broadcast performance monitoring |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| // Periodic web server diagnostics (every 30s) | ||
| static unsigned long lastDiagMs = 0; | ||
| if (now - lastDiagMs >= 30000) | ||
| { | ||
| lastDiagMs = now; | ||
| logger.logf("WebServer diag: SSE clients=%d, heap=%u, minHeap=%u", | ||
| statusEvents.count(), ESP.getFreeHeap(), ESP.getMinFreeHeap()); | ||
| } |
There was a problem hiding this comment.
These diagnostic additions don't appear to be related to the PR's stated purpose of preventing idle crashing. The PR title mentions "Roll back library versions and initialize pin state to prevent idle crashing", but these diagnostics are for monitoring SSE clients and heap usage. If these diagnostics were added to help debug the crashing issue, that should be clarified in the PR description. If they're unrelated to the crash fix, they should be in a separate PR to maintain clear change history.
| unsigned long t0 = millis(); | ||
| broadcastStatusUpdate(); | ||
| unsigned long elapsed = millis() - t0; | ||
| if (elapsed > 100) | ||
| { | ||
| logger.logf("WARNING: SSE broadcast took %lu ms", elapsed); | ||
| } |
There was a problem hiding this comment.
This broadcast timing measurement also doesn't appear to be related to the PR's stated purpose of preventing idle crashing. Like the diagnostics above, if this is for debugging the crash issue, that relationship should be clarified. Otherwise, it should be in a separate PR.
Summary by CodeRabbit
Bug Fixes
Chores