Skip to content
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

A couple of serial port improvements #2531

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

keith-packard
Copy link
Contributor

@keith-packard keith-packard commented Nov 19, 2024

This series contains two somewhat unrelated changes.

  1. Limit USB device checking to twice per second. This speeds up interactions with devices considerably by avoiding a pile of python code run to discover that nothing has changed.
  2. Avoid calling QtSerial's setBaudRate method when the rate is unchanged. In my local testing, QtSerial seems to perform an intermediate baud rate setting to 4Mb before setting back to the target rate. On my device (Arduino NanoEvery), this causes the device to get reset unnecessarily.

@keith-packard keith-packard force-pushed the serial-port-patches branch 3 times, most recently from dd2299f to f6ce342 Compare November 20, 2024 21:49
Share list of USB devices and only update that once a second.  When
updating, measure if the list has changed by comparing the list
length, and then looking at each entry's portName, description and
serialNumber. If nothing has changed, short-circuit all of the list
updating logic.

Signed-off-by: Keith Packard <keithp@keithp.com>
Allow serial port code to set the baud rate as well as query. Avoid
re-setting the baud rate to the current value as QtSerial seems to
do two baud rate settings, first to 4Mbaud and then to the target rate
in this case.

Signed-off-by: Keith Packard <keithp@keithp.com>
Use the base baudrate property setter instead of directly calling
QtSerial as that avoids re-setting the rate to the current rate
which can confusing the target with two baud rate settings.

Signed-off-by: Keith Packard <keithp@keithp.com>
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