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

Commit

Permalink
px4flow: try a 22 byte transfer in probe()
Browse files Browse the repository at this point in the history
this allows us to distinguish between a ll40ls and px4flow on I2C
address 0x42
  • Loading branch information
Andrew Tridgell committed Oct 24, 2014
1 parent ee3c020 commit 131037d
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/drivers/px4flow/px4flow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -249,6 +249,17 @@ PX4FLOW::init()
int
PX4FLOW::probe()
{
uint8_t val[22];

// to be sure this is not a ll40ls Lidar (which can also be on
// 0x42) we check if a 22 byte transfer works from address
// 0. The ll40ls gives an error for that, whereas the flow
// happily returns some data
if (transfer(nullptr, 0, &val[0], 22) != OK) {
return -EIO;
}

// that worked, so start a measurement cycle
return measure();
}

Expand Down

0 comments on commit 131037d

Please sign in to comment.