mirror of
https://github.com/PX4/PX4-Autopilot.git
synced 2026-05-31 02:16:53 +08:00
Revert to original loop
Original loop was correct, and slightly more efficient. Retain initialization of ret to handle the case where passed in count is 0.
This commit is contained in:
@@ -274,12 +274,11 @@ int
|
|||||||
PX4IO_Uploader::recv_bytes(uint8_t *p, unsigned count)
|
PX4IO_Uploader::recv_bytes(uint8_t *p, unsigned count)
|
||||||
{
|
{
|
||||||
int ret = OK;
|
int ret = OK;
|
||||||
while (count) {
|
while (count--) {
|
||||||
ret = recv_byte_with_timeout(p++, 5000);
|
ret = recv_byte_with_timeout(p++, 5000);
|
||||||
|
|
||||||
if (ret != OK)
|
if (ret != OK)
|
||||||
break;
|
break;
|
||||||
count--;
|
|
||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user