Skip to content

Replace tud_cdc_connected() with tud_ready() to ensure proper USB state detection #63

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

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file modified pico_sdk_sigrok/build/pico_sdk_sigrok.uf2
Binary file not shown.
4 changes: 2 additions & 2 deletions pico_sdk_sigrok/pico_sdk_sigrok.c
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ volatile bool mask_xfer_err;
void my_stdio_usb_out_chars(const char *buf, int length) {
static uint64_t last_avail_time;
uint32_t owner;
if (tud_cdc_connected()) {
if (tud_ready()) {
for (int i = 0; i < length;) {
int n = length - i;
int avail = (int) tud_cdc_write_available();
Expand All @@ -81,7 +81,7 @@ void my_stdio_usb_out_chars(const char *buf, int length) {
} else {
tud_task();
tud_cdc_write_flush();
if (!tud_cdc_connected() ||
if (!tud_ready() ||
(!tud_cdc_write_available() && time_us_64() > last_avail_time + PICO_STDIO_USB_STDOUT_TIMEOUT_US)) {
break;
}
Expand Down