mirror of
https://github.com/PX4/PX4-Autopilot.git
synced 2026-06-01 11:06:04 +08:00
ll40ls: fix rotation -> orientation
This commit is contained in:
@@ -41,11 +41,11 @@
|
|||||||
|
|
||||||
#include "LidarLiteI2C.h"
|
#include "LidarLiteI2C.h"
|
||||||
|
|
||||||
LidarLiteI2C::LidarLiteI2C(I2CSPIBusOption bus_option, const int bus, const uint8_t rotation, int bus_frequency,
|
LidarLiteI2C::LidarLiteI2C(I2CSPIBusOption bus_option, const int bus, const uint8_t orientation, int bus_frequency,
|
||||||
const int address) :
|
const int address) :
|
||||||
I2C(DRV_RNG_DEVTYPE_LL40LS, MODULE_NAME, bus, address, bus_frequency),
|
I2C(DRV_RNG_DEVTYPE_LL40LS, MODULE_NAME, bus, address, bus_frequency),
|
||||||
I2CSPIDriver(MODULE_NAME, px4::device_bus_to_wq(get_device_id()), bus_option, bus),
|
I2CSPIDriver(MODULE_NAME, px4::device_bus_to_wq(get_device_id()), bus_option, bus),
|
||||||
_px4_rangefinder(get_device_id(), ORB_PRIO_DEFAULT, rotation)
|
_px4_rangefinder(get_device_id(), ORB_PRIO_DEFAULT, orientation)
|
||||||
{
|
{
|
||||||
_px4_rangefinder.set_min_distance(LL40LS_MIN_DISTANCE);
|
_px4_rangefinder.set_min_distance(LL40LS_MIN_DISTANCE);
|
||||||
_px4_rangefinder.set_max_distance(LL40LS_MAX_DISTANCE);
|
_px4_rangefinder.set_max_distance(LL40LS_MAX_DISTANCE);
|
||||||
|
|||||||
@@ -94,7 +94,7 @@ static constexpr uint32_t LL40LS_CONVERSION_TIMEOUT{100_ms};
|
|||||||
class LidarLiteI2C : public device::I2C, public I2CSPIDriver<LidarLiteI2C>
|
class LidarLiteI2C : public device::I2C, public I2CSPIDriver<LidarLiteI2C>
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
LidarLiteI2C(I2CSPIBusOption bus_option, const int bus, const uint8_t rotation, int bus_frequency,
|
LidarLiteI2C(I2CSPIBusOption bus_option, const int bus, const uint8_t orientation, int bus_frequency,
|
||||||
const int address = LL40LS_BASEADDR);
|
const int address = LL40LS_BASEADDR);
|
||||||
virtual ~LidarLiteI2C();
|
virtual ~LidarLiteI2C();
|
||||||
|
|
||||||
|
|||||||
@@ -72,7 +72,7 @@ Setup/usage information: https://docs.px4.io/master/en/sensor/lidar_lite.html
|
|||||||
I2CSPIDriverBase *LidarLiteI2C::instantiate(const BusCLIArguments &cli, const BusInstanceIterator &iterator,
|
I2CSPIDriverBase *LidarLiteI2C::instantiate(const BusCLIArguments &cli, const BusInstanceIterator &iterator,
|
||||||
int runtime_instance)
|
int runtime_instance)
|
||||||
{
|
{
|
||||||
LidarLiteI2C* instance = new LidarLiteI2C(iterator.configuredBusOption(), iterator.bus(), cli.rotation, cli.bus_frequency);
|
LidarLiteI2C* instance = new LidarLiteI2C(iterator.configuredBusOption(), iterator.bus(), cli.orientation, cli.bus_frequency);
|
||||||
|
|
||||||
if (instance == nullptr) {
|
if (instance == nullptr) {
|
||||||
PX4_ERR("alloc failed");
|
PX4_ERR("alloc failed");
|
||||||
@@ -105,7 +105,7 @@ extern "C" __EXPORT int ll40ls_main(int argc, char *argv[])
|
|||||||
while ((ch = cli.getopt(argc, argv, "R:")) != EOF) {
|
while ((ch = cli.getopt(argc, argv, "R:")) != EOF) {
|
||||||
switch (ch) {
|
switch (ch) {
|
||||||
case 'R':
|
case 'R':
|
||||||
cli.rotation = (enum Rotation)atoi(cli.optarg());
|
cli.orientation = (enum Rotation)atoi(cli.optarg());
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user