mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-27 05:23:34 +08:00
uORB: Block on simulation delay for orb_check() calls as well
This commit is contained in:
@@ -422,6 +422,11 @@ extern "C" {
|
|||||||
sim_delay = false;
|
sim_delay = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool px4_sim_delay_enabled()
|
||||||
|
{
|
||||||
|
return sim_delay;
|
||||||
|
}
|
||||||
|
|
||||||
const char *px4_get_device_names(unsigned int *handle)
|
const char *px4_get_device_names(unsigned int *handle)
|
||||||
{
|
{
|
||||||
return VDev::devList(handle);
|
return VDev::devList(handle);
|
||||||
|
|||||||
@@ -384,6 +384,11 @@ uORB::DeviceNode::poll_notify_one(px4_pollfd_struct_t *fds, pollevent_t events)
|
|||||||
bool
|
bool
|
||||||
uORB::DeviceNode::appears_updated(SubscriberData *sd)
|
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);
|
//warnx("uORB::DeviceNode::appears_updated sd = %p", sd);
|
||||||
/* assume it doesn't look updated */
|
/* assume it doesn't look updated */
|
||||||
bool ret = false;
|
bool ret = false;
|
||||||
|
|||||||
@@ -149,6 +149,7 @@ __EXPORT unsigned long px4_getpid(void);
|
|||||||
__EXPORT void px4_enable_sim_lockstep(void);
|
__EXPORT void px4_enable_sim_lockstep(void);
|
||||||
__EXPORT void px4_sim_start_delay(void);
|
__EXPORT void px4_sim_start_delay(void);
|
||||||
__EXPORT void px4_sim_stop_delay(void);
|
__EXPORT void px4_sim_stop_delay(void);
|
||||||
|
__EXPORT bool px4_sim_delay_enabled(void);
|
||||||
|
|
||||||
__END_DECLS
|
__END_DECLS
|
||||||
#else
|
#else
|
||||||
|
|||||||
Reference in New Issue
Block a user