uORB: Block on simulation delay for orb_check() calls as well

This commit is contained in:
Lorenz Meier 2016-02-05 16:36:43 +01:00
parent 39ee36a8ea
commit 15e7b19991
3 changed files with 11 additions and 0 deletions

View File

@ -422,6 +422,11 @@ extern "C" {
sim_delay = false;
}
bool px4_sim_delay_enabled()
{
return sim_delay;
}
const char *px4_get_device_names(unsigned int *handle)
{
return VDev::devList(handle);

View File

@ -384,6 +384,11 @@ uORB::DeviceNode::poll_notify_one(px4_pollfd_struct_t *fds, pollevent_t events)
bool
uORB::DeviceNode::appears_updated(SubscriberData *sd)
{
/* block if in simulation mode */
while (px4_sim_delay_enabled()) {
usleep(100);
}
//warnx("uORB::DeviceNode::appears_updated sd = %p", sd);
/* assume it doesn't look updated */
bool ret = false;

View File

@ -149,6 +149,7 @@ __EXPORT unsigned long px4_getpid(void);
__EXPORT void px4_enable_sim_lockstep(void);
__EXPORT void px4_sim_start_delay(void);
__EXPORT void px4_sim_stop_delay(void);
__EXPORT bool px4_sim_delay_enabled(void);
__END_DECLS
#else