Skip to content

Add delay() in plotter examples #1047

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

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open

Conversation

wh201906
Copy link

@wh201906 wh201906 commented May 14, 2023

What This PR Changes

This PR adds delay() in the examples of software/ide-v2/tutorials/ide-v2-serial-plotter
The original examples doesn't have delay() in the loop(), which is fine for the boards with hardware serial ports. The baudrate (9600) limits the data speed.
normal
However, for boards with USB serial port, the baudrate doesn't take affect. The board will send data to the PC at the maximum speed.
too_fast

Contribution Guidelines

@jhansson-ard jhansson-ard added the community Bugs and fixes suggested by the community label May 16, 2023
@wh201906
Copy link
Author

@jhansson-ard Hi. Would this PR be accepted?

@jhansson-ard jhansson-ard requested a review from jacobhylen July 18, 2023 14:11
@jhansson-ard
Copy link
Contributor

Hello @wh201906! I've added someone from my team to take a look at your suggestion.

Thank you so much for your contributions! ⭐

@wh201906
Copy link
Author

wh201906 commented Dec 2, 2023

@jhansson-ard @jacobhylen Hi. Would this PR get accepted?

@wh201906
Copy link
Author

wh201906 commented Dec 2, 2023

I set the delay timeout as 20ms because the original example takes around 32ms to send a frame to the hardware serial.
(9600baud,8N1->960Bytes/s, ~31bytes per frame, (31B)/(960B/s)≈32.292ms)
With the delay(20), the plot speed of the hardware serial won't go too slow, but the speed of USB serial is throttled to the same order of magnitude as the hardware serial's.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
community Bugs and fixes suggested by the community
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants