cm8jl65: use paramter to set sensor orientation

This commit is contained in:
Martina Rivizzigno 2019-06-04 21:39:04 +02:00 committed by Beat Küng
parent 6a0ed6af93
commit d216b45202
2 changed files with 34 additions and 4 deletions

View File

@ -42,6 +42,7 @@
*/
#include <poll.h>
#include <px4_cli.h>
#include <px4_config.h>
#include <px4_getopt.h>
#include <px4_work_queue/ScheduledWorkItem.hpp>
@ -685,9 +686,17 @@ extern "C" __EXPORT int cm8jl65_main(int argc, char *argv[])
while ((ch = px4_getopt(argc, argv, "R:d:", &myoptind, &myoptarg)) != EOF) {
switch (ch) {
case 'R':
rotation = (uint8_t)atoi(myoptarg);
case 'R': {
int rot = -1;
if (px4_get_parameter_value(myoptarg, rot) != 0) {
PX4_ERR("rotation parsing failed");
return -1;
}
rotation = (uint8_t)rot;
break;
}
case 'd':
device_path = myoptarg;

View File

@ -1,6 +1,27 @@
module_name: Lanbao PSK-CM8JL65-CC5
serial_config:
- command: cm8jl65 start -d ${SERIAL_DEV}
- command: cm8jl65 start -d ${SERIAL_DEV} -R p:SENS_CM8JL65_R_0
port_config_param:
name: SENS_CM8JL65_CFG
group: Sensors
parameters:
- group: Sensors
definitions:
SENS_CM8JL65_R_0:
description:
short: Distance Sensor Rotation
long: |
Distance Sensor Rotation as MAV_SENSOR_ORIENTATION enum
type: enum
values:
25: ROTATION_DOWNWARD_FACING
24: ROTATION_UPWARD_FACING
12: ROTATION_BACKWARD_FACING
0: ROTATION_FORWARD_FACING
6: ROTATION_LEFT_FACING
2: ROTATION_RIGHT_FACING
100: ROTATION_CUSTOM
reboot_required: true
default: 25