mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-26 04:43:34 +08:00
Tests: fixed spin() for InterlinkedTestNodes
This commit is contained in:
@@ -130,10 +130,19 @@ struct InterlinkedTestNodes
|
|||||||
|
|
||||||
int spinBoth(uavcan::MonotonicDuration duration)
|
int spinBoth(uavcan::MonotonicDuration duration)
|
||||||
{
|
{
|
||||||
const uavcan::MonotonicDuration duration_per_node = duration * 0.5;
|
assert(duration.isPositive());
|
||||||
const int ret = a.spin(duration_per_node);
|
unsigned int nspins2 = duration.toMSec() / 2 + 1;
|
||||||
if (ret < 0)
|
assert(nspins2 > 0);
|
||||||
return ret;
|
while (nspins2 --> 0)
|
||||||
return b.spin(duration_per_node);
|
{
|
||||||
|
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;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user