Skip to content

Roll back library versions and initialize pin state to prevent idle crashing#102

Merged
harpua555 merged 2 commits intomainfrom
dev
Feb 4, 2026
Merged

Roll back library versions and initialize pin state to prevent idle crashing#102
harpua555 merged 2 commits intomainfrom
dev

Conversation

@harpua555
Copy link
Owner

@harpua555 harpua555 commented Feb 4, 2026

Summary by CodeRabbit

  • Bug Fixes

    • Enhanced filament runout sensor handling to prevent unexpected crashes during idle operation.
  • Chores

    • Updated library dependencies to optimize system stability.
    • Implemented periodic diagnostics monitoring to track memory usage and active client connections.

Fixes crashes and unresponsive web UI during idle time by properly configuring
the FILAMENT_RUNOUT_PIN before reading its state
Copilot AI review requested due to automatic review settings February 4, 2026 22:18
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Feb 4, 2026

Walkthrough

This 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

Cohort / File(s) Summary
Library Dependency Updates
platformio.ini
Downgraded AsyncTCP from 3.4.9 to 3.3.7 and ESPAsyncWebServer from 3.9.3 to 3.7.3 in common lib_deps.
Pin Initialization
src/ElegooCC.cpp
Added INPUT_PULLUP initialization for FILAMENT_RUNOUT_PIN during setup to prevent floating input and associated crashes.
Diagnostics Logging
src/WebServer.cpp
Added periodic diagnostics block logging SSE client count and heap metrics every 30 seconds, with performance timing around broadcastStatusUpdate that logs warnings if execution exceeds 100 ms.
🚥 Pre-merge checks | ✅ 2 | ❌ 1
❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title directly summarizes the main changes: rolling back library versions and initializing pin state to prevent crashes. It is specific, clear, and accurately reflects the core fixes in the changeset.

✏️ 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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment on lines +504 to +511
// 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());
}
Copy link

Copilot AI Feb 4, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copilot uses AI. Check for mistakes.
Comment on lines +516 to +522
unsigned long t0 = millis();
broadcastStatusUpdate();
unsigned long elapsed = millis() - t0;
if (elapsed > 100)
{
logger.logf("WARNING: SSE broadcast took %lu ms", elapsed);
}
Copy link

Copilot AI Feb 4, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copilot uses AI. Check for mistakes.
@harpua555 harpua555 merged commit ddd6a6b into main Feb 4, 2026
18 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants