We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent dd3d946 commit 16b8a83Copy full SHA for 16b8a83
cores/arduino/stm32/usb/cdc/usbd_cdc_if.c
@@ -263,10 +263,10 @@ void CDC_deInit(void)
263
264
bool CDC_connected()
265
{
266
- // Save the transmitStart value in a local variable - fix #478
+ /* Save the transmitStart value in a local variable to avoid twice reading - fix #478 */
267
uint32_t transmitTime = transmitStart;
268
if (transmitTime) {
269
- transmitTime = HAL_GetTick() - transmitStart;
+ transmitTime = HAL_GetTick() - transmitTime;
270
}
271
return hUSBD_Device_CDC.dev_state == USBD_STATE_CONFIGURED
272
&& transmitTime < USB_CDC_TRANSMIT_TIMEOUT
0 commit comments