From 2b1229786e749caa1eea2b79d9b3c342e0630d2d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roman=20Dvo=C5=99=C3=A1k?= Date: Thu, 27 Jan 2022 11:52:07 +0100 Subject: [PATCH] Multi instance SHT3x driver support --- ROMFS/px4fmu_common/init.d/rc.sensors | 6 ++---- src/drivers/hygrometer/sht3x/sht3x.h | 4 ++-- src/modules/logger/logged_topics.cpp | 2 +- 3 files changed, 5 insertions(+), 7 deletions(-) diff --git a/ROMFS/px4fmu_common/init.d/rc.sensors b/ROMFS/px4fmu_common/init.d/rc.sensors index e8ea172b75..1402ba3e1e 100644 --- a/ROMFS/px4fmu_common/init.d/rc.sensors +++ b/ROMFS/px4fmu_common/init.d/rc.sensors @@ -133,10 +133,8 @@ fi # SHT3x temperature and hygrometer sensor, external I2C if param compare -s SENS_EN_SHT3X 1 then - if ! sht3x start -X - then - sht3x start -X -a 0x45 - fi + sht3x start -X + sht3x start -X -a 0x45 fi # TE MS4525 differential pressure sensor external I2C diff --git a/src/drivers/hygrometer/sht3x/sht3x.h b/src/drivers/hygrometer/sht3x/sht3x.h index 8f2bbc1548..ff698446f0 100644 --- a/src/drivers/hygrometer/sht3x/sht3x.h +++ b/src/drivers/hygrometer/sht3x/sht3x.h @@ -48,7 +48,7 @@ #include #include #include -#include +#include #include #define SHT3X_CMD_READ_STATUS 0xF32D @@ -114,7 +114,7 @@ private: int _last_state = sht3x_state::INIT; uint32_t _time_in_state = hrt_absolute_time(); uint16_t _last_command = 0; - uORB::Publication _sensor_hygrometer_pub{ORB_ID(sensor_hygrometer)}; + uORB::PublicationMulti _sensor_hygrometer_pub{ORB_ID(sensor_hygrometer)}; DEFINE_PARAMETERS( (ParamInt) _param_sens_en_sht3x diff --git a/src/modules/logger/logged_topics.cpp b/src/modules/logger/logged_topics.cpp index 6107edece6..a5e5570363 100644 --- a/src/modules/logger/logged_topics.cpp +++ b/src/modules/logger/logged_topics.cpp @@ -87,7 +87,6 @@ void LoggedTopics::add_default_topics() add_topic("rtl_time_estimate", 1000); add_topic("safety"); add_topic("sensor_combined"); - add_topic("sensor_hygrometer", 500); add_optional_topic("sensor_correction"); add_optional_topic("sensor_gyro_fft", 50); add_topic("sensor_selection"); @@ -123,6 +122,7 @@ void LoggedTopics::add_default_topics() add_topic_multi("airspeed_wind", 1000, 4); add_topic_multi("control_allocator_status", 200, 2); add_optional_topic_multi("rate_ctrl_status", 200, 2); + add_topic_multi("sensor_hygrometer", 500, 4); add_optional_topic_multi("telemetry_status", 1000, 4); // EKF multi topics (currently max 9 estimators)