diff --git a/src/drivers/distance_sensor/cm8jl65/cm8jl65.cpp b/src/drivers/distance_sensor/cm8jl65/cm8jl65.cpp index dc5411367f..07aa1c2866 100644 --- a/src/drivers/distance_sensor/cm8jl65/cm8jl65.cpp +++ b/src/drivers/distance_sensor/cm8jl65/cm8jl65.cpp @@ -42,6 +42,7 @@ */ #include +#include #include #include #include @@ -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); - break; + 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; diff --git a/src/drivers/distance_sensor/cm8jl65/module.yaml b/src/drivers/distance_sensor/cm8jl65/module.yaml index a1984001cd..f8242c54fa 100644 --- a/src/drivers/distance_sensor/cm8jl65/module.yaml +++ b/src/drivers/distance_sensor/cm8jl65/module.yaml @@ -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