Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork8.3k
mpremote: Fix disconnect handling on Windows and Linux.#17321
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Conversation
codecovbot commentedMay 19, 2025 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@## master #17321 +/- ##======================================= Coverage 98.56% 98.56% ======================================= Files 169 169 Lines 21946 21946 ======================================= Hits 21632 21632 Misses 314 314 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Code size report:
|
Josverl commentedMay 19, 2025 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
I think this is a good improvement to make I notice that you have not added or changed any tests. |
Good point! I've been trying to get better at test coverage lately but yeah I'm not sure how to test a feature like this without hardware in the loop. |
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
ad0f34e
toe4b80f2
CompareUh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
e4b80f2
to1c4a5b2
CompareUh oh!
There was an error while loading.Please reload this page.
Changes in this commit:- Handle SerialException on Windows when device disconnects.- Print clean 'device disconnected' message instead of stack trace.- Fix terminal formatting issues on Linux after disconnect.- Return disconnected state after console cleanup to avoid terminal issues.This ensures proper disconnect messages on both platforms without showingconfusing error traces to users.Signed-off-by: Andrew Leech <andrew.leech@planetinnovation.com.au>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Tested on Linux, it improves the printing of the disconnect message.
3a97175
intomicropython:masterUh oh!
There was an error while loading.Please reload this page.
Summary
Improves device disconnection handling in mpremote to show a clean "device disconnected" message instead of stack traces on Windows and fixes terminal formatting issues on Linux.
Problem
When a device disconnects during an mpremote session:
Solution
This PR fixes disconnect handling to:
File Changes
tools/mpremote/mpremote/console.py
:tools/mpremote/mpremote/repl.py
:tools/mpremote/mpremote/main.py
:Testing
Before/After Examples - I connected to ESP32S2 (usb serial) and once confirmed the repl is working, physically unplug the devices.
Windows (Before)
Windows (After)
Linux (Before)
Linux (After)