mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-24 10:03:35 +08:00
make px4::ok work, use it in px4::spin
This commit is contained in:
@@ -35,9 +35,6 @@
|
||||
# NuttX / uORB adapter library
|
||||
#
|
||||
|
||||
SRCS = px4_nuttx_impl.cpp \
|
||||
px4_publisher.cpp \
|
||||
px4_subscriber.cpp \
|
||||
px4_nodehandle.cpp
|
||||
SRCS = px4_nuttx_impl.cpp
|
||||
|
||||
MAXOPTIMIZATION = -Os
|
||||
|
||||
@@ -37,27 +37,8 @@
|
||||
* PX4 Middleware Wrapper Nodehandle
|
||||
*/
|
||||
#include <px4.h>
|
||||
#include <platforms/px4_nodehandle.h>
|
||||
|
||||
namespace px4
|
||||
{
|
||||
bool task_should_exit = false;
|
||||
|
||||
|
||||
void NodeHandle::spinOnce() {
|
||||
/* Loop through subscriptions, call callback for updated subscriptions */
|
||||
uORB::SubscriptionNode *sub = _subs.getHead();
|
||||
int count = 0;
|
||||
|
||||
while (sub != nullptr) {
|
||||
if (count++ > kMaxSubscriptions) {
|
||||
PX4_WARN("exceeded max subscriptions");
|
||||
break;
|
||||
}
|
||||
|
||||
sub->update();
|
||||
sub = sub->getSibling();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -54,9 +54,4 @@ uint64_t get_time_micros()
|
||||
return hrt_absolute_time();
|
||||
}
|
||||
|
||||
bool ok()
|
||||
{
|
||||
return !task_should_exit;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user