Skip to content

Commit aa8785c

Browse files
committed
pbio/drv/usb_stm32: remove subscribe timeout
Remove the transmit_timer that was monitoring whether the host was reading data or not. In practice, this was causing false positives when the host was just slow to read data, which caused the connection to effectively drop.
1 parent 3e8cb1e commit aa8785c

File tree

1 file changed

+0
-14
lines changed

1 file changed

+0
-14
lines changed

lib/pbio/drv/usb/usb_stm32.c

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -399,7 +399,6 @@ PROCESS_THREAD(pbdrv_usb_process, ev, data) {
399399
static bool bcd_busy;
400400
static pbio_pybricks_error_t result;
401401
static struct etimer status_timer;
402-
static struct etimer transmit_timer;
403402
static uint32_t prev_status_flags = ~0;
404403
static uint32_t new_status_flags;
405404

@@ -474,13 +473,6 @@ PROCESS_THREAD(pbdrv_usb_process, ev, data) {
474473
}
475474

476475
if (transmitting) {
477-
if (etimer_expired(&transmit_timer)) {
478-
// Transmission has taken too long, so reset the state to allow
479-
// new transmissions. This can happen if the host stops reading
480-
// data for some reason.
481-
pbdrv_usb_stm32_reset_tx_state();
482-
}
483-
484476
continue;
485477
}
486478

@@ -511,12 +503,6 @@ PROCESS_THREAD(pbdrv_usb_process, ev, data) {
511503
USBD_Pybricks_TransmitPacket(&husbd, usb_stdout_buf, usb_stdout_sz);
512504
}
513505
}
514-
515-
if (transmitting) {
516-
// If the FIFO isn't emptied quickly, then there probably isn't an
517-
// app anymore. This timer is used to detect such a condition.
518-
etimer_set(&transmit_timer, 50);
519-
}
520506
}
521507

522508
PROCESS_END();

0 commit comments

Comments
 (0)