From 45a53726d6594f6285243c1f1198fa431958e1c5 Mon Sep 17 00:00:00 2001 From: Matthias Grob Date: Mon, 14 Oct 2019 18:49:37 +0200 Subject: [PATCH] LandDetector: switch to uORB::Publication --- src/modules/land_detector/LandDetector.cpp | 5 +---- src/modules/land_detector/LandDetector.h | 3 ++- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/src/modules/land_detector/LandDetector.cpp b/src/modules/land_detector/LandDetector.cpp index 2235aeb615..b9fd50c9a4 100644 --- a/src/modules/land_detector/LandDetector.cpp +++ b/src/modules/land_detector/LandDetector.cpp @@ -81,7 +81,6 @@ void LandDetector::Run() // publish at 1 Hz, very first time, or when the result has changed if ((hrt_elapsed_time(&_land_detected.timestamp) >= 1_s) || - (_land_detected_pub == nullptr) || (_land_detected.landed != landDetected) || (_land_detected.freefall != freefallDetected) || (_land_detected.maybe_landed != maybe_landedDetected) || @@ -102,9 +101,7 @@ void LandDetector::Run() _land_detected.alt_max = alt_max; _land_detected.in_ground_effect = in_ground_effect; - int instance; - orb_publish_auto(ORB_ID(vehicle_land_detected), &_land_detected_pub, &_land_detected, - &instance, ORB_PRIO_DEFAULT); + _vehicle_land_detected_pub.publish(_land_detected); } // set the flight time when disarming (not necessarily when landed, because all param changes should diff --git a/src/modules/land_detector/LandDetector.h b/src/modules/land_detector/LandDetector.h index 2a6958db10..b4a84fcb79 100644 --- a/src/modules/land_detector/LandDetector.h +++ b/src/modules/land_detector/LandDetector.h @@ -54,6 +54,7 @@ #include #include #include +#include #include #include #include @@ -157,7 +158,7 @@ protected: }; vehicle_local_position_s _vehicle_local_position{}; - orb_advert_t _land_detected_pub{nullptr}; + uORB::Publication _vehicle_land_detected_pub{ORB_ID(vehicle_land_detected)}; uORB::Subscription _actuator_armed_sub{ORB_ID(actuator_armed)}; uORB::Subscription _vehicle_acceleration_sub{ORB_ID(vehicle_acceleration)};