mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-16 22:53:34 +08:00
Replace sleep with px4_sleep
This is another step to isolate time from the system.
This commit is contained in:
@@ -752,7 +752,7 @@ err_out_no_test:
|
||||
fds.events = POLLIN;
|
||||
|
||||
PX4_WARN("Running 5 steps. WARNING! Motors will be live in 5 seconds\nPress any key to abort now.");
|
||||
sleep(5);
|
||||
px4_sleep(5);
|
||||
|
||||
if (::ioctl(fd, PWM_SERVO_SET_MODE, PWM_SERVO_ENTER_TEST_MODE) < 0) {
|
||||
PX4_ERR("Failed to Enter pwm test mode");
|
||||
|
||||
@@ -76,7 +76,7 @@ int HRTTest::main()
|
||||
PX4_INFO("Start time %llu\n", (unsigned long long)t);
|
||||
|
||||
t = hrt_absolute_time();
|
||||
sleep(1);
|
||||
px4_sleep(1);
|
||||
elt = hrt_elapsed_time(&t);
|
||||
PX4_INFO("Elapsed time %llu in 1 sec (sleep)\n", (unsigned long long)elt);
|
||||
PX4_INFO("Start time %llu\n", (unsigned long long)t);
|
||||
@@ -86,7 +86,7 @@ int HRTTest::main()
|
||||
PX4_INFO("HRT_CALL %d\n", hrt_called(&t1));
|
||||
|
||||
hrt_call_after(&t1, update_interval, timer_expired, (void *)nullptr);
|
||||
sleep(2);
|
||||
px4_sleep(2);
|
||||
PX4_INFO("HRT_CALL - %d\n", hrt_called(&t1));
|
||||
hrt_cancel(&t1);
|
||||
PX4_INFO("HRT_CALL + %d\n", hrt_called(&t1));
|
||||
|
||||
@@ -94,7 +94,7 @@ int test_uart_console(int argc, char *argv[])
|
||||
write(uart_usb, sample_uart_usb, sizeof(sample_uart_usb));
|
||||
printf(".");
|
||||
fflush(stdout);
|
||||
sleep(1);
|
||||
px4_sleep(1);
|
||||
}
|
||||
|
||||
// uint64_t start_time = hrt_absolute_time();
|
||||
|
||||
@@ -80,7 +80,7 @@ top_main(int argc, char *argv[])
|
||||
if (argc > 1) {
|
||||
if (!strcmp(argv[1], "once")) {
|
||||
print_load(curr_time, 1, &load);
|
||||
sleep(1);
|
||||
px4_sleep(1);
|
||||
print_load(hrt_absolute_time(), 1, &load);
|
||||
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user