mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-04-14 10:07:39 +08:00
uORB: Block on simulation delay for orb_check() calls as well
This commit is contained in:
parent
39ee36a8ea
commit
15e7b19991
@ -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);
|
||||
|
||||
@ -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;
|
||||
|
||||
@ -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
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user