Skip to content
Snippets Groups Projects
Commit c2cac44c authored by q3k's avatar q3k
Browse files

st3m: partial usb unfucking

I have returned from the USB mines bearing great news.

The badge should now get less stuck when doing CDC comms.

Apparently, TinyUSB does not attempt to flush its CDC TX FIFO unless you
request it or unless it just finished another transfer.
parent 17a0ae3a
No related branches found
No related tags found
No related merge requests found
...@@ -145,16 +145,6 @@ void st3m_gfx_splash(const char *c); ...@@ -145,16 +145,6 @@ void st3m_gfx_splash(const char *c);
// Called by st3m_usb_cdc when it has the opportunity to send some data to the // Called by st3m_usb_cdc when it has the opportunity to send some data to the
// host. // host.
size_t st3m_console_cdc_on_txpoll(uint8_t *buffer, size_t bufsize) { size_t st3m_console_cdc_on_txpoll(uint8_t *buffer, size_t bufsize) {
// I have no idea why this is needed, but it is. Otherwise a large backlog
// of data cuases the IN endpoint to get stuck.
//
// I've spend three days debugging this.
//
// No, I'm not fine. Thanks for asking, though. I appreciate it.
if (bufsize > 0) {
bufsize -= 1;
}
int64_t now = esp_timer_get_time(); int64_t now = esp_timer_get_time();
xSemaphoreTake(_state.mu, portMAX_DELAY); xSemaphoreTake(_state.mu, portMAX_DELAY);
......
...@@ -46,6 +46,7 @@ void st3m_usb_cdc_txpoll(void) { ...@@ -46,6 +46,7 @@ void st3m_usb_cdc_txpoll(void) {
for (;;) { for (;;) {
uint32_t space = tud_cdc_n_write_available(st3m_usb_interface_app_cdc); uint32_t space = tud_cdc_n_write_available(st3m_usb_interface_app_cdc);
if (space == 0) { if (space == 0) {
tud_cdc_n_write_flush(st3m_usb_interface_app_cdc);
return; return;
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment