mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-19 09:53:33 +08:00
Replacing usleep with px4_usleep
This is a step towards isolating time from the system.
This commit is contained in:
@@ -206,7 +206,7 @@ BottleDrop::~BottleDrop()
|
||||
|
||||
do {
|
||||
/* wait 20ms */
|
||||
usleep(20000);
|
||||
px4_usleep(20000);
|
||||
|
||||
/* if we have given up, kill it */
|
||||
if (++i > 50) {
|
||||
@@ -261,7 +261,7 @@ BottleDrop::open_bay()
|
||||
|
||||
actuators_publish();
|
||||
|
||||
usleep(500 * 1000);
|
||||
px4_usleep(500 * 1000);
|
||||
}
|
||||
|
||||
void
|
||||
@@ -276,7 +276,7 @@ BottleDrop::close_bay()
|
||||
actuators_publish();
|
||||
|
||||
// delay until the bay is closed
|
||||
usleep(500 * 1000);
|
||||
px4_usleep(500 * 1000);
|
||||
}
|
||||
|
||||
void
|
||||
@@ -292,7 +292,7 @@ BottleDrop::drop()
|
||||
}
|
||||
|
||||
while (hrt_elapsed_time(&_doors_opened) < 500 * 1000 && hrt_elapsed_time(&starttime) < 2000000) {
|
||||
usleep(50000);
|
||||
px4_usleep(50000);
|
||||
warnx("delayed by door!");
|
||||
}
|
||||
|
||||
@@ -304,7 +304,7 @@ BottleDrop::drop()
|
||||
warnx("dropping now");
|
||||
|
||||
// Give it time to drop
|
||||
usleep(1000 * 1000);
|
||||
px4_usleep(1000 * 1000);
|
||||
}
|
||||
|
||||
void
|
||||
@@ -728,7 +728,7 @@ BottleDrop::task_main()
|
||||
// update_actuators();
|
||||
|
||||
// run at roughly 100 Hz
|
||||
usleep(sleeptime_us);
|
||||
px4_usleep(sleeptime_us);
|
||||
|
||||
dt_runs = hrt_elapsed_time(&last_run) / 1e6f;
|
||||
last_run = hrt_absolute_time();
|
||||
|
||||
@@ -118,7 +118,7 @@ int px4_mavlink_debug_main(int argc, char *argv[])
|
||||
warnx("sent one more value..");
|
||||
|
||||
value_counter++;
|
||||
usleep(500000);
|
||||
px4_usleep(500000);
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
||||
Reference in New Issue
Block a user