From ba0e47edb7573796c88b00c33d8c2463c61a0aab Mon Sep 17 00:00:00 2001 From: cfif Date: Mon, 6 Apr 2026 14:33:50 +0300 Subject: [PATCH] =?UTF-8?q?=D0=9E=D0=B1=D0=BD=D0=BE=D0=B2=D0=BB=D0=B5?= =?UTF-8?q?=D0=BD=D0=B8=D0=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Src/SerialPortVirt.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/Src/SerialPortVirt.c b/Src/SerialPortVirt.c index d8c7d74..b9e735e 100644 --- a/Src/SerialPortVirt.c +++ b/Src/SerialPortVirt.c @@ -12,7 +12,7 @@ static uint16_t vSerialPortReceiveQueue(uint8_t *data, uint16_t size, uint32_t t uint16_t received = 0; uint32_t endMs = SystemGetMs() + timeout; - uint32_t leftMs; + uint32_t leftMs = 0; uint16_t granted = 0; @@ -21,7 +21,13 @@ static uint16_t vSerialPortReceiveQueue(uint8_t *data, uint16_t size, uint32_t t } while (size && (((timeout == SystemWaitForever) || (endMs > SystemGetMs())) || (received < granted))) { - leftMs = endMs - SystemGetMs(); + + if (timeout == SystemWaitForever) { + leftMs = SystemWaitForever; + } else { + leftMs = endMs - SystemGetMs(); + } + if (osMessageQueueGet(queueId, data, NULL, leftMs) == osOK) { --size; ++received;