Skip to content

Commit 16b8a83

Browse files
committedMar 26, 2019
Fix issue #478 (2/2)
Signed-off-by: Frederic.Pillon <[email protected]>
1 parent dd3d946 commit 16b8a83

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed
 

‎cores/arduino/stm32/usb/cdc/usbd_cdc_if.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -263,10 +263,10 @@ void CDC_deInit(void)
263263

264264
bool CDC_connected()
265265
{
266-
// Save the transmitStart value in a local variable - fix #478
266+
/* Save the transmitStart value in a local variable to avoid twice reading - fix #478 */
267267
uint32_t transmitTime = transmitStart;
268268
if (transmitTime) {
269-
transmitTime = HAL_GetTick() - transmitStart;
269+
transmitTime = HAL_GetTick() - transmitTime;
270270
}
271271
return hUSBD_Device_CDC.dev_state == USBD_STATE_CONFIGURED
272272
&& transmitTime < USB_CDC_TRANSMIT_TIMEOUT

0 commit comments

Comments
 (0)
Please sign in to comment.