multi diff pres sensor publication and logging

This commit is contained in:
Daniel Agar
2017-08-19 22:49:29 +02:00
committed by Lorenz Meier
parent 8db2883d84
commit b2a81ed35b
9 changed files with 45 additions and 14 deletions
+10 -13
View File
@@ -36,7 +36,6 @@
* @author Simon Wilks <simon@px4.io>
* @author Lorenz Meier <lorenz@px4.io>
*
* Driver for the Eagle Tree Airspeed V3 connected via I2C.
*/
#include <px4_config.h>
@@ -86,6 +85,7 @@ Airspeed::Airspeed(int bus, int address, unsigned conversion_interval, const cha
_collect_phase(false),
_diff_pres_offset(0.0f),
_airspeed_pub(nullptr),
_airspeed_orb_class_instance(-1),
_subsys_pub(nullptr),
_class_instance(-1),
_conversion_interval(conversion_interval),
@@ -138,20 +138,17 @@ Airspeed::init()
/* register alternate interfaces if we have to */
_class_instance = register_class_devname(AIRSPEED_BASE_DEVICE_PATH);
/* publication init */
if (_class_instance == CLASS_DEVICE_PRIMARY) {
/* advertise sensor topic, measure manually to initialize valid report */
measure();
differential_pressure_s arp;
_reports->get(&arp);
/* advertise sensor topic, measure manually to initialize valid report */
struct differential_pressure_s arp;
measure();
_reports->get(&arp);
/* measurement will have generated a report, publish */
_airspeed_pub = orb_advertise_multi(ORB_ID(differential_pressure), &arp, &_airspeed_orb_class_instance,
ORB_PRIO_HIGH - _class_instance);
/* measurement will have generated a report, publish */
_airspeed_pub = orb_advertise(ORB_ID(differential_pressure), &arp);
if (_airspeed_pub == nullptr) {
PX4_WARN("uORB started?");
}
if (_airspeed_pub == nullptr) {
PX4_WARN("uORB started?");
}
ret = OK;
+2
View File
@@ -134,6 +134,8 @@ protected:
float _diff_pres_offset;
orb_advert_t _airspeed_pub;
int _airspeed_orb_class_instance;
orb_advert_t _subsys_pub;
int _class_instance;