mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-04-14 10:07:39 +08:00
drivers/distance_sensor/lightware_laser_serial: add LW20/C support
This commit is contained in:
parent
47dc2ae5a5
commit
fd39d5b9a1
@ -127,6 +127,13 @@ LightwareLaserSerial::init()
|
||||
_simple_serial = true;
|
||||
break;
|
||||
|
||||
case 8:
|
||||
/* LW20/c (100M 20Hz) */
|
||||
_px4_rangefinder.set_min_distance(0.2f);
|
||||
_px4_rangefinder.set_max_distance(100.0f);
|
||||
_interval = 50000;
|
||||
break;
|
||||
|
||||
default:
|
||||
PX4_ERR("invalid HW model %" PRIi32 ".", hw_model);
|
||||
return -1;
|
||||
@ -297,6 +304,12 @@ void LightwareLaserSerial::Run()
|
||||
if ((termios_state = tcsetattr(_fd, TCSANOW, &uart_config)) < 0) {
|
||||
PX4_ERR("baud %d ATTR", termios_state);
|
||||
}
|
||||
|
||||
// LW20: Enable serial mode by sending some characters
|
||||
if (hw_model == 8) {
|
||||
const char *data = "www\r\n";
|
||||
(void)!::write(_fd, &data, strlen(data));
|
||||
}
|
||||
}
|
||||
|
||||
/* collection phase? */
|
||||
|
||||
@ -41,5 +41,8 @@
|
||||
* @value 3 SF10/b
|
||||
* @value 4 SF10/c
|
||||
* @value 5 SF11/c
|
||||
* @value 6 SF30/b
|
||||
* @value 7 SF30/c
|
||||
* @value 8 LW20/c
|
||||
*/
|
||||
PARAM_DEFINE_INT32(SENS_EN_SF0X, 1);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user