aboutsummaryrefslogtreecommitdiff
path: root/src/drivers
diff options
context:
space:
mode:
authorLorenz Meier <lm@inf.ethz.ch>2014-10-28 13:22:25 +0100
committerLorenz Meier <lm@inf.ethz.ch>2014-10-28 13:22:25 +0100
commit774ff3db31309c2f2aeb235d751cbdfc9e20baf8 (patch)
treee491e4dfc77943e5568929c6d114d55b4a4a2652 /src/drivers
parent16f33ee6b5b92e244bb413bad5530882fac6644d (diff)
downloadpx4-firmware-774ff3db31309c2f2aeb235d751cbdfc9e20baf8.tar.gz
px4-firmware-774ff3db31309c2f2aeb235d751cbdfc9e20baf8.tar.bz2
px4-firmware-774ff3db31309c2f2aeb235d751cbdfc9e20baf8.zip
Scan both buses
Diffstat (limited to 'src/drivers')
-rw-r--r--src/drivers/px4flow/px4flow.cpp18
1 files changed, 13 insertions, 5 deletions
diff --git a/src/drivers/px4flow/px4flow.cpp b/src/drivers/px4flow/px4flow.cpp
index 818b34a5e..ed788a46e 100644
--- a/src/drivers/px4flow/px4flow.cpp
+++ b/src/drivers/px4flow/px4flow.cpp
@@ -73,13 +73,11 @@
#include <board_config.h>
/* Configuration Constants */
-#define PX4FLOW_BUS PX4_I2C_BUS_ESC//PX4_I2C_BUS_EXPANSION
#define I2C_FLOW_ADDRESS 0x42 //* 7-bit address. 8-bit address is 0x84
//range 0x42 - 0x49
/* PX4FLOW Registers addresses */
-//#define PX4FLOW_REG 0x00 /* Measure Register 0*/
-#define PX4FLOW_REG 0x16 /* Measure Register 22*/
+#define PX4FLOW_REG 0x16 /* Measure Register 22*/
#define PX4FLOW_CONVERSION_INTERVAL 20000 //in microseconds! 20000 = 50 Hz 100000 = 10Hz
/* oddly, ERROR is not defined for c++ */
@@ -664,14 +662,24 @@ start()
}
/* create the driver */
- g_dev = new PX4FLOW(PX4FLOW_BUS);
+ g_dev = new PX4FLOW(PX4_I2C_BUS_EXPANSION);
if (g_dev == nullptr) {
goto fail;
}
if (OK != g_dev->init()) {
- goto fail;
+ delete g_dev;
+ /* try 2nd bus */
+ g_dev = new PX4FLOW(PX4_I2C_BUS_ESC);
+
+ if (g_dev == nullptr) {
+ goto fail;
+ }
+
+ if (OK != g_dev->init()) {
+ goto fail;
+ }
}
/* set the poll rate to default, starts automatic data collection */