mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-23 06:33:33 +08:00
Fixed type signedness through the entire codebase; driver interfaces do not use starndard types now
This commit is contained in:
@@ -66,7 +66,7 @@ TEST(Scheduler, Timers)
|
||||
ASSERT_GT(1100, tcc.events_b.size());
|
||||
{
|
||||
uavcan::MonotonicTime next_expected_deadline = start_ts + durMono(1000);
|
||||
for (unsigned int i = 0; i < tcc.events_b.size(); i++)
|
||||
for (unsigned i = 0; i < tcc.events_b.size(); i++)
|
||||
{
|
||||
ASSERT_TRUE(areTimestampsClose(tcc.events_b[i].scheduled_time, next_expected_deadline));
|
||||
ASSERT_TRUE(areTimestampsClose(tcc.events_b[i].scheduled_time, tcc.events_b[i].real_time));
|
||||
|
||||
@@ -137,7 +137,7 @@ TEST(Subscriber, Basic)
|
||||
|
||||
ASSERT_EQ(2, node.getDispatcher().getNumMessageListeners());
|
||||
|
||||
for (unsigned int i = 0; i < rx_frames.size(); i++)
|
||||
for (unsigned i = 0; i < rx_frames.size(); i++)
|
||||
{
|
||||
can_driver.ifaces[0].pushRx(rx_frames[i]);
|
||||
can_driver.ifaces[1].pushRx(rx_frames[i]);
|
||||
@@ -149,7 +149,7 @@ TEST(Subscriber, Basic)
|
||||
* Validation
|
||||
*/
|
||||
ASSERT_EQ(listener.extended.size(), rx_frames.size());
|
||||
for (unsigned int i = 0; i < rx_frames.size(); i++)
|
||||
for (unsigned i = 0; i < rx_frames.size(); i++)
|
||||
{
|
||||
const Listener::ReceivedDataStructureCopy s = listener.extended.at(i);
|
||||
ASSERT_TRUE(s.msg == expected_msg);
|
||||
@@ -161,7 +161,7 @@ TEST(Subscriber, Basic)
|
||||
}
|
||||
|
||||
ASSERT_EQ(listener.simple.size(), rx_frames.size());
|
||||
for (unsigned int i = 0; i < rx_frames.size(); i++)
|
||||
for (unsigned i = 0; i < rx_frames.size(); i++)
|
||||
{
|
||||
ASSERT_TRUE(listener.simple.at(i) == expected_msg);
|
||||
}
|
||||
@@ -268,7 +268,7 @@ TEST(Subscriber, SingleFrameTransfer)
|
||||
ASSERT_EQ(0, sub.getFailureCount());
|
||||
|
||||
ASSERT_EQ(4, listener.simple.size());
|
||||
for (unsigned int i = 0; i < 4; i++)
|
||||
for (unsigned i = 0; i < 4; i++)
|
||||
{
|
||||
ASSERT_TRUE(listener.simple.at(i) == root_ns_a::EmptyMessage());
|
||||
}
|
||||
|
||||
@@ -57,7 +57,7 @@ struct PairableCanDriver : public uavcan::ICanDriver, public uavcan::ICanIface
|
||||
with->other = this;
|
||||
}
|
||||
|
||||
uavcan::ICanIface* getIface(int iface_index)
|
||||
uavcan::ICanIface* getIface(uavcan::uint8_t iface_index)
|
||||
{
|
||||
if (iface_index == 0)
|
||||
{
|
||||
@@ -66,30 +66,27 @@ struct PairableCanDriver : public uavcan::ICanDriver, public uavcan::ICanIface
|
||||
return NULL;
|
||||
}
|
||||
|
||||
int getNumIfaces() const { return 1; }
|
||||
uavcan::uint8_t getNumIfaces() const { return 1; }
|
||||
|
||||
int select(uavcan::CanSelectMasks& inout_masks, uavcan::MonotonicTime blocking_deadline)
|
||||
uavcan::int16_t select(uavcan::CanSelectMasks& inout_masks, uavcan::MonotonicTime blocking_deadline)
|
||||
{
|
||||
assert(other);
|
||||
if (inout_masks.read == 1)
|
||||
{
|
||||
inout_masks.read = (read_queue.size() || loopback_queue.size()) ? 1 : 0;
|
||||
}
|
||||
|
||||
if (inout_masks.read || inout_masks.write)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
while (clock.getMonotonic() < blocking_deadline)
|
||||
{
|
||||
usleep(1000);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int send(const uavcan::CanFrame& frame, uavcan::MonotonicTime, uavcan::CanIOFlags flags)
|
||||
uavcan::int16_t send(const uavcan::CanFrame& frame, uavcan::MonotonicTime, uavcan::CanIOFlags flags)
|
||||
{
|
||||
assert(other);
|
||||
other->read_queue.push(frame);
|
||||
@@ -100,8 +97,8 @@ struct PairableCanDriver : public uavcan::ICanDriver, public uavcan::ICanIface
|
||||
return 1;
|
||||
}
|
||||
|
||||
int receive(uavcan::CanFrame& out_frame, uavcan::MonotonicTime& out_ts_monotonic, uavcan::UtcTime& out_ts_utc,
|
||||
uavcan::CanIOFlags& out_flags)
|
||||
uavcan::int16_t receive(uavcan::CanFrame& out_frame, uavcan::MonotonicTime& out_ts_monotonic,
|
||||
uavcan::UtcTime& out_ts_utc, uavcan::CanIOFlags& out_flags)
|
||||
{
|
||||
assert(other);
|
||||
out_flags = 0;
|
||||
@@ -122,9 +119,9 @@ struct PairableCanDriver : public uavcan::ICanDriver, public uavcan::ICanIface
|
||||
return 1;
|
||||
}
|
||||
|
||||
int configureFilters(const uavcan::CanFilterConfig*, int) { return -1; }
|
||||
int getNumFilters() const { return 0; }
|
||||
uint64_t getErrorCount() const { return error_count; }
|
||||
uavcan::int16_t configureFilters(const uavcan::CanFilterConfig*, uavcan::uint16_t) { return -1; }
|
||||
uavcan::uint16_t getNumFilters() const { return 0; }
|
||||
uavcan::uint64_t getErrorCount() const { return error_count; }
|
||||
};
|
||||
|
||||
|
||||
@@ -159,7 +156,7 @@ struct InterlinkedTestNodes
|
||||
int spinBoth(uavcan::MonotonicDuration duration)
|
||||
{
|
||||
assert(!duration.isNegative());
|
||||
unsigned int nspins2 = duration.toMSec() / 2;
|
||||
unsigned nspins2 = duration.toMSec() / 2;
|
||||
nspins2 = nspins2 ? nspins2 : 1;
|
||||
while (nspins2 --> 0)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user