mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-17 19:23:34 +08:00
WIP, c++11 style callbacks for px4
This commit is contained in:
@@ -36,9 +36,28 @@
|
||||
*
|
||||
* 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();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -59,16 +59,4 @@ bool ok()
|
||||
return !task_should_exit;
|
||||
}
|
||||
|
||||
void spin_once()
|
||||
{
|
||||
// XXX check linked list of topics with orb_check() here
|
||||
|
||||
}
|
||||
|
||||
void spin()
|
||||
{
|
||||
// XXX block waiting for updated topics here
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user