Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Drivers: Add TeraRanger Evo 600Hz support #9169

Merged
merged 3 commits into from
Apr 4, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/drivers/distance_sensor/teraranger/parameters.c
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
* @value 0 Disabled
* @value 1 Autodetect
* @value 2 TROne
* @value 3 TREvo
* @value 3 TREvo60m
* @value 4 TREvo600Hz
*/
PARAM_DEFINE_INT32(SENS_EN_TRANGER, 0);
28 changes: 21 additions & 7 deletions src/drivers/distance_sensor/teraranger/teraranger.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,10 @@
/* Device limits */
#define TRONE_MIN_DISTANCE (0.20f)
#define TRONE_MAX_DISTANCE (14.00f)
#define TREVO_MIN_DISTANCE (0.50f)
#define TREVO_MAX_DISTANCE (60.0f)
#define TREVO_60M_MIN_DISTANCE (0.50f)
#define TREVO_60M_MAX_DISTANCE (60.0f)
#define TREVO_600HZ_MIN_DISTANCE (0.75f)
#define TREVO_600HZ_MAX_DISTANCE (8.0f)

#define TERARANGER_CONVERSION_INTERVAL 50000 /* 50ms */

Expand Down Expand Up @@ -295,8 +297,8 @@ TERARANGER::init()
goto out;

} else {
_min_distance = TREVO_MIN_DISTANCE;
_max_distance = TREVO_MAX_DISTANCE;
_min_distance = TREVO_60M_MIN_DISTANCE;
_max_distance = TREVO_60M_MAX_DISTANCE;
}

} else {
Expand All @@ -317,16 +319,28 @@ TERARANGER::init()
_max_distance = TRONE_MAX_DISTANCE;
break;

case 3: /* TREvo */
case 3: /* TREvo60m */
set_device_address(TREVO_BASEADDR);

/* do I2C init (and probe) first */
if (I2C::init() != OK) {
goto out;
}

_min_distance = TREVO_MIN_DISTANCE;
_max_distance = TREVO_MAX_DISTANCE;
_min_distance = TREVO_60M_MIN_DISTANCE;
_max_distance = TREVO_60M_MAX_DISTANCE;
break;

case 4: /* TREvo600Hz */
set_device_address(TREVO_BASEADDR);

/* do I2C init (and probe) first */
if (I2C::init() != OK) {
goto out;
}

_min_distance = TREVO_600HZ_MIN_DISTANCE;
_max_distance = TREVO_600HZ_MAX_DISTANCE;
break;

default:
Expand Down