-
Notifications
You must be signed in to change notification settings - Fork 4.3k
Added a new option to advanced serial settings to force DTR low for E… #13482
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Can you provide an image of the serial setting |
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.
Pull Request Overview
This PR adds a configurable DTR (Data Terminal Ready) setting to QGroundControl's serial link configuration to prevent ESP32 devices from resetting when establishing a serial connection. ESP32 devices using USB serial chips interpret DTR high as a reset signal, causing them to reboot and lock up during telemetry connection.
Key changes:
- Added
dtrForceLow
property toSerialConfiguration
class with default value offalse
- Modified serial worker to conditionally set DTR based on the new configuration option
- Added "Force DTR Low" checkbox to the Serial Link advanced settings UI
Reviewed Changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.
File | Description |
---|---|
src/Comms/SerialLink.h | Added dtrForceLow property, getter/setter methods, and signal declaration |
src/Comms/SerialLink.cc | Implemented settings persistence and modified DTR control logic in serial worker |
src/UI/AppSettings/SerialSettings.qml | Added checkbox UI control for the new DTR setting |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
The pull request CI generates binaries for the build, so if you want to test this out, you can download the installer / package for your arch below and give it a go: NOTES: |
Based on your notes, should we just set defaults based on platform? |
Good question. The notes above are from my testing summary, describing behaviour specific to ESP-based devices (like ELRS TX modules), not general defaults. The “Force DTR Low” checkbox is only required for devices that use an ESP32 USB interface, since those reset when DTR is asserted high. For most other serial devices (autopilots, modems, etc.), the existing behavior of setting DTR high should remain the default. Windows seems to be the problematic platform here (as usual 😛), where DTR needs to be forced LOW if you are connecting to an ESP-based device. Ubuntu seems to work the opposite to windows, and if I check the Force DTR Low checkbox then attempt to connect to an ESP-based device, it triggers a lockup, so Ubuntu needs it unchecked. The intent isn’t to set platform-based defaults, but instead to leave the behaviour exactly as it was prior to my change, while additionally giving users a way to configure this when connecting to ESP-based hardware that’s sensitive to DTR. |
Also worth noting: |
All seems crazy as to how a user is going to know what to do here. Given the randomness of how all this works on the hardware/OS combination side it's hard to say what else to do though. It's kinda like "try one or the other and see what works". At least since it's under advanced most folks won't fart around with it. Should we mention something about ELRS in the UI. It seems like folks using that constantly run into piles or problems with it. |
Totally agree that this checkbox won't be very intuitive to the user unless they specifically know the context around it being needed for ESP devices. If we do end up taking this proposed approach:
Alternatively, I can pause this checkbox approach and instead look into auto-detecting an ELRS device based on USB vendor ID data and auto-set DTR to false on Windows. The latter approach may be tricky, and also may only work for ELRS hardware and not any generic ESP devices. |
I'm ok with this is as. @HTRamsey Opinions? |
Add configurable DTR setting to prevent ESP32 reset on serial connection
Description
QGroundControl's serial link implementation currently sets DTR high immediately after opening the port, which triggers a reset on ESP32 devices using USB serial chips (e.g., CP210x, CH340). This causes the ESP32 to reboot and lock up during telemetry connection.
This change adds a new "Force DTR Low" checkbox in the Serial Link advanced settings that allows users to force DTR low on port for devices that require it (like ESP32). Defaults unchecked for backward compatibility.
Changes:
dtrForceLow
property toSerialConfiguration
class (defaultsfalse
)SerialWorker::_onPortConnected()
to set DTR based on configurationSerialSettings.qml
Test Steps
Checklist:
Related Issue
None
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.