mirror of
https://github.com/ArduPilot/ardupilot
synced 2025-01-11 10:28:29 -04:00
AP_RangeFinder: Benewake driver discards distances over 327m
This commit is contained in:
parent
46b035419e
commit
b579a36d8d
@ -23,6 +23,7 @@ extern const AP_HAL::HAL& hal;
|
|||||||
|
|
||||||
#define BENEWAKE_FRAME_HEADER 0x59
|
#define BENEWAKE_FRAME_HEADER 0x59
|
||||||
#define BENEWAKE_FRAME_LENGTH 9
|
#define BENEWAKE_FRAME_LENGTH 9
|
||||||
|
#define BENEWAKE_DIST_MAX_CM 32768
|
||||||
|
|
||||||
// format of serial packets received from benewake lidar
|
// format of serial packets received from benewake lidar
|
||||||
//
|
//
|
||||||
@ -112,7 +113,7 @@ bool AP_RangeFinder_Benewake::get_reading(uint16_t &reading_cm, bool &signal_ok)
|
|||||||
signal_ok = true;
|
signal_ok = true;
|
||||||
// calculate distance and add to sum
|
// calculate distance and add to sum
|
||||||
uint16_t dist = ((uint16_t)linebuf[3] << 8) | linebuf[2];
|
uint16_t dist = ((uint16_t)linebuf[3] << 8) | linebuf[2];
|
||||||
if (dist != 0xFFFF) {
|
if (dist < BENEWAKE_DIST_MAX_CM) {
|
||||||
// TFmini has short distance mode (mm)
|
// TFmini has short distance mode (mm)
|
||||||
if (model_type == BENEWAKE_TFmini) {
|
if (model_type == BENEWAKE_TFmini) {
|
||||||
if (linebuf[6] == 0x02) {
|
if (linebuf[6] == 0x02) {
|
||||||
|
Loading…
Reference in New Issue
Block a user