diff --git a/ROMFS/px4fmu_common/init.d/rc.sensors b/ROMFS/px4fmu_common/init.d/rc.sensors index 2a08f07c1b39..c966a73c8835 100644 --- a/ROMFS/px4fmu_common/init.d/rc.sensors +++ b/ROMFS/px4fmu_common/init.d/rc.sensors @@ -94,9 +94,16 @@ then fi # Lanbao PSK-CM8JL65-CC5 distance sensor -if param compare SENS_EN_CM8JL65 1 +if param greater SENS_EN_CM8JL65 0 then - cm8jl65 start + if param compare SENS_EN_CM8JL65 1 + then + cm8jl65 start + fi + if param compare SENS_EN_CM8JL65 2 + then + cm8jl65 start -d "/dev/ttyS1" + fi fi diff --git a/src/drivers/distance_sensor/cm8jl65/cm8jl65.cpp b/src/drivers/distance_sensor/cm8jl65/cm8jl65.cpp index edf00679b967..c08aada21752 100644 --- a/src/drivers/distance_sensor/cm8jl65/cm8jl65.cpp +++ b/src/drivers/distance_sensor/cm8jl65/cm8jl65.cpp @@ -75,8 +75,8 @@ #define CM8JL65_TAKE_RANGE_REG 'd' -// designated serial port on Pixhawk (TELEM1) -#define CM8JL65_DEFAULT_PORT "/dev/ttyS1" // Its baudrate is 115200 +// designated serial port on Pixhawk (TELEM2) +#define CM8JL65_DEFAULT_PORT "/dev/ttyS2" // Its baudrate is 115200 // normal conversion wait time #define CM8JL65_CONVERSION_INTERVAL 50*1000UL/* 50ms */ diff --git a/src/drivers/distance_sensor/cm8jl65/cm8jl65_parser.cpp b/src/drivers/distance_sensor/cm8jl65/cm8jl65_parser.cpp index f691271e146e..b437972d4e5d 100644 --- a/src/drivers/distance_sensor/cm8jl65/cm8jl65_parser.cpp +++ b/src/drivers/distance_sensor/cm8jl65/cm8jl65_parser.cpp @@ -177,7 +177,7 @@ int cm8jl65_parser(uint8_t c, uint8_t *parserbuf, CM8JL65_PARSE_STATE *state, ui if (c == (*crc16 & 0xFF)) { // printf("Checksum verified \n"); *dist = (parserbuf[DISTANCE_MSB_POS] << 8) | parserbuf[DISTANCE_LSB_POS]; - return OK; + return 0; } /*else { //printf("Checksum invalidon low byte: 0x%02X, calculated: 0x%04X \n",c, *crc16); diff --git a/src/drivers/distance_sensor/cm8jl65/parameters.c b/src/drivers/distance_sensor/cm8jl65/parameters.c index 05c292f1baac..7324b1703163 100644 --- a/src/drivers/distance_sensor/cm8jl65/parameters.c +++ b/src/drivers/distance_sensor/cm8jl65/parameters.c @@ -36,9 +36,10 @@ * * @reboot_required true * @min 0 - * @max 1 + * @max 2 * @group Sensors * @value 0 Disabled - * @value 1 Enabled + * @value 1 Enabled on TELEM2 + * @value 2 Enabled on TELEM1 */ PARAM_DEFINE_INT32(SENS_EN_CM8JL65, 0);