Skip to content

Commit

Permalink
Fixed CI broken build. Made TELEM2 default port.
Browse files Browse the repository at this point in the history
Device port can be set via SENS_EN_CM8JL65 parameter:
SENS_EN_CM8JL65 = 0 -> Disabled
SENS_EN_CM8JL65 = 1 -> Enabled on TELEM2
SENS_EN_CM8JL65 = 2 -> Enabled on TELEM1

Signed-off-by: Claudio Micheli <[email protected]>
  • Loading branch information
cmic0 authored and bkueng committed Jan 15, 2019
1 parent e4381bf commit 7124cbf
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 7 deletions.
11 changes: 9 additions & 2 deletions ROMFS/px4fmu_common/init.d/rc.sensors
Original file line number Diff line number Diff line change
Expand Up @@ -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


Expand Down
4 changes: 2 additions & 2 deletions src/drivers/distance_sensor/cm8jl65/cm8jl65.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand Down
2 changes: 1 addition & 1 deletion src/drivers/distance_sensor/cm8jl65/cm8jl65_parser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
5 changes: 3 additions & 2 deletions src/drivers/distance_sensor/cm8jl65/parameters.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);

0 comments on commit 7124cbf

Please sign in to comment.