diff options
| author | hathach <[email protected]> | 2026-03-02 22:32:15 +0700 |
|---|---|---|
| committer | hathach <[email protected]> | 2026-03-02 22:32:15 +0700 |
| commit | 2a27bd9db0f97f2d5034336626accbe2bb6bd330 (patch) | |
| tree | 73690bb937bad8839f1e8f224246d6288a5f6050 | |
| parent | c0adaca3a5cecb07da686d0c5f0ad9802295c58b (diff) | |
more call_after timeout adjustment with rtos
| -rw-r--r-- | src/host/usbh.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/host/usbh.c b/src/host/usbh.c index e161d212e..20791340e 100644 --- a/src/host/usbh.c +++ b/src/host/usbh.c @@ -668,10 +668,12 @@ void tuh_task_ext(uint32_t timeout_ms, bool in_isr) { } // above after_cb() can re-schedule another function, we need to re-check and reduce timeout of - // the main event timeout to make sure we aren't blocking more than call_after timeout. + // the main event timeout to make sure we aren't blocking more than call_after remaining ms. if (_usbh_data.call_after.func != NULL) { remain_ms = (int32_t) (_usbh_data.call_after.at_ms - tusb_time_millis_api()); - if (remain_ms > 0 && timeout_ms > (uint32_t)remain_ms) { + if (remain_ms <= 0) { + timeout_ms = 0; // expired already + } else if (timeout_ms > (uint32_t)remain_ms) { timeout_ms = (uint32_t)remain_ms; } } |
