mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-22 21:43:33 +08:00
sf0x.cpp: change baudrate to 115200 for SF11/C
This commit is contained in:
@@ -590,7 +590,19 @@ SF0X::cycle()
|
|||||||
/* no parity, one stop bit */
|
/* no parity, one stop bit */
|
||||||
uart_config.c_cflag &= ~(CSTOPB | PARENB);
|
uart_config.c_cflag &= ~(CSTOPB | PARENB);
|
||||||
|
|
||||||
unsigned speed = B9600;
|
/* if distance sensor model is SF11/C, then set baudrate 115200, else 9600 */
|
||||||
|
int hw_model;
|
||||||
|
|
||||||
|
param_get(param_find("SENS_EN_SF0X"), &hw_model);
|
||||||
|
|
||||||
|
unsigned speed;
|
||||||
|
|
||||||
|
if (hw_model == 5) {
|
||||||
|
speed = B115200;
|
||||||
|
|
||||||
|
} else {
|
||||||
|
speed = B9600;
|
||||||
|
}
|
||||||
|
|
||||||
/* set baud rate */
|
/* set baud rate */
|
||||||
if ((termios_state = cfsetispeed(&uart_config, speed)) < 0) {
|
if ((termios_state = cfsetispeed(&uart_config, speed)) < 0) {
|
||||||
|
|||||||
Reference in New Issue
Block a user