@@ -275,6 +275,7 @@ static bool WP_Initialise(COM_HANDLE port)
275275 tinyusb_config_cdcacm_t amc_cfg = {
276276 .usb_dev = TINYUSB_USBDEV_0 ,
277277 .cdc_port = TINYUSB_CDC_ACM_0 ,
278+ // parameter deprecated, therefore it doesn't matter what we put here
278279 .rx_unread_buf_sz = 1056 ,
279280 .callback_rx = & WP_Cdc_Rx_Callback ,
280281 .callback_rx_wanted_char = NULL ,
@@ -339,7 +340,9 @@ uint8_t WP_TransmitMessage(WP_Message *message)
339340 }
340341 }
341342
342- tinyusb_cdcacm_write_flush (TINYUSB_CDC_ACM_0 , 0 );
343+ // need to call flush with a timeout to have it behave cooperatively with the RTOS
344+ // OK to silently ignore errors here
345+ tinyusb_cdcacm_write_flush (TINYUSB_CDC_ACM_0 , pdMS_TO_TICKS (250 ));
343346
344347 return true;
345348}
@@ -358,16 +361,17 @@ static bool WP_Initialise(COM_HANDLE port)
358361 // uninstall driver for console
359362 // ESP_ERROR_CHECK(uart_driver_delete(ESP32_WP_UART));
360363
361- uart_config_t uart_config = {// baudrate
362- .baud_rate = TARGET_SERIAL_BAUDRATE ,
363- // baudrate
364- .data_bits = UART_DATA_8_BITS ,
365- // parity mode
366- .parity = UART_PARITY_DISABLE ,
367- // stop bit mode
368- .stop_bits = UART_STOP_BITS_1 ,
369- // hardware flow control(cts/rts)
370- .flow_ctrl = UART_HW_FLOWCTRL_DISABLE };
364+ uart_config_t uart_config = {
365+ // baudrate
366+ .baud_rate = TARGET_SERIAL_BAUDRATE ,
367+ // baudrate
368+ .data_bits = UART_DATA_8_BITS ,
369+ // parity mode
370+ .parity = UART_PARITY_DISABLE ,
371+ // stop bit mode
372+ .stop_bits = UART_STOP_BITS_1 ,
373+ // hardware flow control(cts/rts)
374+ .flow_ctrl = UART_HW_FLOWCTRL_DISABLE };
371375
372376 ESP_ERROR_CHECK (uart_param_config (ESP32_WP_UART , & uart_config ));
373377
0 commit comments