Skip to content

fix(config): don't dump config JSON to USB serial on save - #3070

Open
chinderdelis wants to merge 1 commit into
BruceDevices:devfrom
chinderdelis:config-no-serial-dump
Open

chinderdelis wants to merge 1 commit into
BruceDevices:devfrom
chinderdelis:config-no-serial-dump

Conversation

@chinderdelis

Copy link
Copy Markdown

Proposed Changes

BruceConfig::saveFile(), BruceConfigPins::loadFile() and BruceConfigPins::createFile() serialized the whole config JSON to Serial on every save. On USB-CDC builds that is a sizable write (~1.7 KB with the default config). When the host does not drain the CDC endpoint, HWCDC::write() waits for tx_timeout_ms (100 ms) and gives up after max_consec_timeouts (20), so the loop task is blocked for a long time while input/touch tasks keep running: the UI appears frozen.

Reproducible on a touch board by opening the Brightness menu and pressing Sel to save with no serial monitor attached. The screen stops updating until the CDC endpoint is drained (opening a serial monitor and pressing a key is enough).

Remove the unconditional debug dumps. The explicit settings serial command still prints the JSON, so debugging is unaffected.

Types of Changes

Bugfix

Verification

  • Freenove FNK0104AB (ESP32-S3, HWCDC): with no serial monitor open, settings bright 100, brightness menu drag+Sel and other config-saving menus stay responsive.
  • The save command now emits only the CLI prompt (32 bytes instead of ~1.7 KB).
  • settings CLI still dumps the full config as before.
  • ES3C28P build passes.

Testing

Hardware tested on Freenove FNK0104AB; compile-tested on ES3C28P.

Linked Issues

N/A

User-Facing Change

Fix UI freezes when saving the configuration while no serial monitor is attached.

Further Comments

N/A

serializeJsonPretty() wrote the whole config to Serial on every save. With nothing draining the USB-CDC endpoint, HWCDC::write() times out (100 ms x 20) and the loop task stalls, freezing the UI. Remove the debug dumps from saveFile(), loadFile() and createFile(); the explicit settings CLI dump is kept.

This branch has not been deployed

No deployments
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.

1 participant