land_detector: use user-defined literals for time constants

This commit is contained in:
Beat Küng
2018-04-14 13:45:57 +02:00
committed by Lorenz Meier
parent e98919cf3c
commit 123f11fcdd
4 changed files with 22 additions and 15 deletions
+4 -2
View File
@@ -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();