mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-04-14 10:07:39 +08:00
Tests: fixed spin() for InterlinkedTestNodes
This commit is contained in:
parent
8828b79c4e
commit
5cc74bf872
@ -130,10 +130,19 @@ struct InterlinkedTestNodes
|
||||
|
||||
int spinBoth(uavcan::MonotonicDuration duration)
|
||||
{
|
||||
const uavcan::MonotonicDuration duration_per_node = duration * 0.5;
|
||||
const int ret = a.spin(duration_per_node);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
return b.spin(duration_per_node);
|
||||
assert(duration.isPositive());
|
||||
unsigned int nspins2 = duration.toMSec() / 2 + 1;
|
||||
assert(nspins2 > 0);
|
||||
while (nspins2 --> 0)
|
||||
{
|
||||
int ret = -1;
|
||||
ret = a.spin(uavcan::MonotonicDuration::fromMSec(1));
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
ret = b.spin(uavcan::MonotonicDuration::fromMSec(1));
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
};
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user