Обновление
This commit is contained in:
parent
72d6add914
commit
ba0e47edb7
|
|
@ -12,7 +12,7 @@ static uint16_t vSerialPortReceiveQueue(uint8_t *data, uint16_t size, uint32_t t
|
||||||
uint16_t received = 0;
|
uint16_t received = 0;
|
||||||
|
|
||||||
uint32_t endMs = SystemGetMs() + timeout;
|
uint32_t endMs = SystemGetMs() + timeout;
|
||||||
uint32_t leftMs;
|
uint32_t leftMs = 0;
|
||||||
|
|
||||||
uint16_t granted = 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))) {
|
while (size && (((timeout == SystemWaitForever) || (endMs > SystemGetMs())) || (received < granted))) {
|
||||||
|
|
||||||
|
if (timeout == SystemWaitForever) {
|
||||||
|
leftMs = SystemWaitForever;
|
||||||
|
} else {
|
||||||
leftMs = endMs - SystemGetMs();
|
leftMs = endMs - SystemGetMs();
|
||||||
|
}
|
||||||
|
|
||||||
if (osMessageQueueGet(queueId, data, NULL, leftMs) == osOK) {
|
if (osMessageQueueGet(queueId, data, NULL, leftMs) == osOK) {
|
||||||
--size;
|
--size;
|
||||||
++received;
|
++received;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue