Skip to content
This repository was archived by the owner on Oct 1, 2021. It is now read-only.

Commit 131037d

Browse files
author
Andrew Tridgell
committed
px4flow: try a 22 byte transfer in probe()
this allows us to distinguish between a ll40ls and px4flow on I2C address 0x42
1 parent ee3c020 commit 131037d

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

src/drivers/px4flow/px4flow.cpp

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -249,6 +249,17 @@ PX4FLOW::init()
249249
int
250250
PX4FLOW::probe()
251251
{
252+
uint8_t val[22];
253+
254+
// to be sure this is not a ll40ls Lidar (which can also be on
255+
// 0x42) we check if a 22 byte transfer works from address
256+
// 0. The ll40ls gives an error for that, whereas the flow
257+
// happily returns some data
258+
if (transfer(nullptr, 0, &val[0], 22) != OK) {
259+
return -EIO;
260+
}
261+
262+
// that worked, so start a measurement cycle
252263
return measure();
253264
}
254265

0 commit comments

Comments
 (0)