mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-22 12:03:33 +08:00
land_detector: use user-defined literals for time constants
This commit is contained in:
@@ -47,6 +47,8 @@
|
||||
#include <drivers/drv_hrt.h>
|
||||
#include "uORB/topics/parameter_update.h"
|
||||
|
||||
using namespace time_literals;
|
||||
|
||||
namespace land_detector
|
||||
{
|
||||
|
||||
@@ -112,7 +114,7 @@ void LandDetector::_cycle()
|
||||
const hrt_abstime now = hrt_absolute_time();
|
||||
|
||||
// publish at 1 Hz, very first time, or when the result has changed
|
||||
if ((hrt_elapsed_time(&_landDetected.timestamp) >= 1000000) ||
|
||||
if ((hrt_elapsed_time(&_landDetected.timestamp) >= 1_s) ||
|
||||
(_landDetectedPub == nullptr) ||
|
||||
(_landDetected.landed != landDetected) ||
|
||||
(_landDetected.freefall != freefallDetected) ||
|
||||
@@ -156,7 +158,7 @@ void LandDetector::_cycle()
|
||||
|
||||
// Schedule next cycle.
|
||||
work_queue(HPWORK, &_work, (worker_t)&LandDetector::_cycle_trampoline, this,
|
||||
USEC2TICK(1000000 / LAND_DETECTOR_UPDATE_RATE_HZ));
|
||||
USEC2TICK(1_s / LAND_DETECTOR_UPDATE_RATE_HZ));
|
||||
|
||||
} else {
|
||||
exit_and_cleanup();
|
||||
|
||||
Reference in New Issue
Block a user