From 84dd8839a2ea2bf0019792e60a197d4f7c5f68eb Mon Sep 17 00:00:00 2001 From: David Sidrane Date: Tue, 20 Apr 2021 10:47:11 -0700 Subject: [PATCH] i2c_spi_buses:Track NuttX change to getopts avoid name collision NuttX #defined optarg and getopt to move to TLS. This fixes the name collision. --- platforms/common/i2c_spi_buses.cpp | 8 ++-- .../px4_platform_common/i2c_spi_buses.h | 4 +- src/drivers/adc/ads1115/ads1115_main.cpp | 8 ++-- src/drivers/barometer/ms5611/ms5611_main.cpp | 8 ++-- .../ms4525/ms4525_airspeed.cpp | 8 ++-- .../distance_sensor/gy_us42/GY_US42_main.cpp | 6 +-- .../lightware_laser_i2c.cpp | 8 ++-- src/drivers/distance_sensor/ll40ls/ll40ls.cpp | 6 +-- .../distance_sensor/srf02/srf02_main.cpp | 8 ++-- .../teraranger/teraranger_main.cpp | 8 ++-- .../distance_sensor/vl53l0x/VL53L0X.cpp | 6 +-- .../distance_sensor/vl53l1x/vl53l1x.cpp | 6 +-- src/drivers/imu/adis16477/adis16477_main.cpp | 8 ++-- src/drivers/imu/adis16497/adis16497_main.cpp | 8 ++-- .../adis16448/adis16448_main.cpp | 6 +-- .../adis16470/adis16470_main.cpp | 6 +-- src/drivers/imu/bosch/bmi055/bmi055_main.cpp | 8 ++-- .../bmi088/bmi088_i2c/bmi088_i2c_main.cpp | 8 ++-- src/drivers/imu/bosch/bmi088/bmi088_main.cpp | 8 ++-- .../imu/fxas21002c/fxas21002c_main.cpp | 8 ++-- .../imu/fxos8701cq/fxos8701cq_main.cpp | 8 ++-- .../imu/invensense/icm20602/icm20602_main.cpp | 8 ++-- .../invensense/icm20608g/icm20608g_main.cpp | 8 ++-- .../imu/invensense/icm20649/icm20649_main.cpp | 8 ++-- .../imu/invensense/icm20689/icm20689_main.cpp | 8 ++-- .../imu/invensense/icm20948/icm20948_main.cpp | 8 ++-- .../invensense/icm40609d/icm40609d_main.cpp | 8 ++-- .../imu/invensense/icm42605/icm42605_main.cpp | 8 ++-- .../invensense/icm42688p/icm42688p_main.cpp | 8 ++-- .../imu/invensense/mpu6000/mpu6000_main.cpp | 8 ++-- .../imu/invensense/mpu6500/mpu6500_main.cpp | 8 ++-- .../invensense/mpu9250/mpu9250_i2c_main.cpp | 8 ++-- .../imu/invensense/mpu9250/mpu9250_main.cpp | 8 ++-- src/drivers/imu/l3gd20/l3gd20_main.cpp | 8 ++-- src/drivers/imu/lsm303d/lsm303d_main.cpp | 8 ++-- src/drivers/imu/st/lsm9ds1/lsm9ds1_main.cpp | 8 ++-- .../magnetometer/akm/ak09916/ak09916_main.cpp | 8 ++-- .../magnetometer/akm/ak8963/ak8963_main.cpp | 8 ++-- .../magnetometer/bosch/bmm150/bmm150_main.cpp | 8 ++-- .../magnetometer/hmc5883/hmc5883_main.cpp | 8 ++-- .../isentek/ist8308/ist8308_main.cpp | 8 ++-- .../isentek/ist8310/ist8310_main.cpp | 8 ++-- .../magnetometer/lis2mdl/lis2mdl_main.cpp | 8 ++-- .../magnetometer/lis3mdl/lis3mdl_main.cpp | 8 ++-- .../magnetometer/lsm303agr/lsm303agr_main.cpp | 8 ++-- .../lsm9ds1_mag/lsm9ds1_mag_main.cpp | 6 +-- .../magnetometer/qmc5883l/qmc5883l_main.cpp | 8 ++-- .../magnetometer/rm3100/rm3100_main.cpp | 8 ++-- .../vtrantech/vcm1193l/vcm1193l_main.cpp | 6 +-- .../optical_flow/paw3902/paw3902_main.cpp | 8 ++-- .../optical_flow/pmw3901/pmw3901_main.cpp | 8 ++-- src/drivers/optical_flow/px4flow/px4flow.cpp | 8 ++-- .../power_monitor/ina226/ina226_main.cpp | 39 +++++++++++++++++-- .../power_monitor/voxlpm/voxlpm_main.cpp | 12 +++--- src/systemcmds/tests/test_i2c_spi_cli.cpp | 12 +++--- 55 files changed, 245 insertions(+), 214 deletions(-) diff --git a/platforms/common/i2c_spi_buses.cpp b/platforms/common/i2c_spi_buses.cpp index 189efaa14d..466928de3f 100644 --- a/platforms/common/i2c_spi_buses.cpp +++ b/platforms/common/i2c_spi_buses.cpp @@ -1,6 +1,6 @@ /**************************************************************************** * - * Copyright (C) 2020 PX4 Development Team. All rights reserved. + * Copyright (C) 2020, 2021 PX4 Development Team. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -51,15 +51,15 @@ static pthread_mutex_t i2c_spi_module_instances_mutex = PTHREAD_MUTEX_INITIALIZE const char *BusCLIArguments::parseDefaultArguments(int argc, char *argv[]) { - if (getopt(argc, argv, "") == EOF) { - return optarg(); + if (getOpt(argc, argv, "") == EOF) { + return optArg(); } // unexpected arguments return nullptr; } -int BusCLIArguments::getopt(int argc, char *argv[], const char *options) +int BusCLIArguments::getOpt(int argc, char *argv[], const char *options) { if (_options[0] == 0) { // need to initialize if (!validateConfiguration()) { diff --git a/platforms/common/include/px4_platform_common/i2c_spi_buses.h b/platforms/common/include/px4_platform_common/i2c_spi_buses.h index b3a6f7c72e..29ad8318b9 100644 --- a/platforms/common/include/px4_platform_common/i2c_spi_buses.h +++ b/platforms/common/include/px4_platform_common/i2c_spi_buses.h @@ -92,13 +92,13 @@ public: /** * Like px4_getopt(), but adds and handles i2c/spi driver-specific arguments */ - int getopt(int argc, char *argv[], const char *options); + int getOpt(int argc, char *argv[], const char *options); /** * returns the current optional argument (for options like 'T:'), or the command (e.g. "start") * @return nullptr or argument/command */ - const char *optarg() const { return _optarg; } + const char *optArg() const { return _optarg; } I2CSPIBusOption bus_option{I2CSPIBusOption::All}; diff --git a/src/drivers/adc/ads1115/ads1115_main.cpp b/src/drivers/adc/ads1115/ads1115_main.cpp index 9d09f09e95..7e312bf993 100644 --- a/src/drivers/adc/ads1115/ads1115_main.cpp +++ b/src/drivers/adc/ads1115/ads1115_main.cpp @@ -1,6 +1,6 @@ /**************************************************************************** * - * Copyright (C) 2020 PX4 Development Team. All rights reserved. + * Copyright (C) 2020, 2021 PX4 Development Team. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -182,11 +182,11 @@ extern "C" int ads1115_main(int argc, char *argv[]) cli.default_i2c_frequency = 400000; cli.i2c_address = 0x48; - while ((ch = cli.getopt(argc, argv, "")) != EOF) { + while ((ch = cli.getOpt(argc, argv, "")) != EOF) { } - const char *verb = cli.optarg(); + const char *verb = cli.optArg(); if (!verb) { ThisDriver::print_usage(); @@ -209,4 +209,4 @@ extern "C" int ads1115_main(int argc, char *argv[]) ThisDriver::print_usage(); return -1; -} \ No newline at end of file +} diff --git a/src/drivers/barometer/ms5611/ms5611_main.cpp b/src/drivers/barometer/ms5611/ms5611_main.cpp index 986c0fe3e1..c04bcd0545 100644 --- a/src/drivers/barometer/ms5611/ms5611_main.cpp +++ b/src/drivers/barometer/ms5611/ms5611_main.cpp @@ -1,6 +1,6 @@ /**************************************************************************** * - * Copyright (c) 2012-2019 PX4 Development Team. All rights reserved. + * Copyright (c) 2012-2019, 2021 PX4 Development Team. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -100,10 +100,10 @@ extern "C" int ms5611_main(int argc, char *argv[]) cli.default_spi_frequency = 20 * 1000 * 1000; uint16_t dev_type_driver = DRV_BARO_DEVTYPE_MS5611; - while ((ch = cli.getopt(argc, argv, "T:")) != EOF) { + while ((ch = cli.getOpt(argc, argv, "T:")) != EOF) { switch (ch) { case 'T': { - int val = atoi(cli.optarg()); + int val = atoi(cli.optArg()); if (val == 5611) { cli.type = MS5611_DEVICE; @@ -118,7 +118,7 @@ extern "C" int ms5611_main(int argc, char *argv[]) } } - const char *verb = cli.optarg(); + const char *verb = cli.optArg(); if (!verb) { ThisDriver::print_usage(); diff --git a/src/drivers/differential_pressure/ms4525/ms4525_airspeed.cpp b/src/drivers/differential_pressure/ms4525/ms4525_airspeed.cpp index f4c221d2b0..3481dc5e4f 100644 --- a/src/drivers/differential_pressure/ms4525/ms4525_airspeed.cpp +++ b/src/drivers/differential_pressure/ms4525/ms4525_airspeed.cpp @@ -1,6 +1,6 @@ /**************************************************************************** * - * Copyright (c) 2013, 2014 PX4 Development Team. All rights reserved. + * Copyright (c) 2013, 2014, 2021 PX4 Development Team. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -307,15 +307,15 @@ ms4525_airspeed_main(int argc, char *argv[]) cli.default_i2c_frequency = 100000; int device_type = DEVICE_TYPE_MS4525; - while ((ch = cli.getopt(argc, argv, "T:")) != EOF) { + while ((ch = cli.getOpt(argc, argv, "T:")) != EOF) { switch (ch) { case 'T': - device_type = atoi(cli.optarg()); + device_type = atoi(cli.optArg()); break; } } - const char *verb = cli.optarg(); + const char *verb = cli.optArg(); if (!verb) { ThisDriver::print_usage(); diff --git a/src/drivers/distance_sensor/gy_us42/GY_US42_main.cpp b/src/drivers/distance_sensor/gy_us42/GY_US42_main.cpp index 8392912846..857254b696 100644 --- a/src/drivers/distance_sensor/gy_us42/GY_US42_main.cpp +++ b/src/drivers/distance_sensor/gy_us42/GY_US42_main.cpp @@ -73,15 +73,15 @@ extern "C" __EXPORT int gy_us42_main(int argc, char *argv[]) cli.orientation = distance_sensor_s::ROTATION_DOWNWARD_FACING; cli.default_i2c_frequency = 100000; - while ((ch = cli.getopt(argc, argv, "R:")) != EOF) { + while ((ch = cli.getOpt(argc, argv, "R:")) != EOF) { switch (ch) { case 'R': - cli.orientation = atoi(cli.optarg()); + cli.orientation = atoi(cli.optArg()); break; } } - const char *verb = cli.optarg(); + const char *verb = cli.optArg(); if (!verb) { ThisDriver::print_usage(); diff --git a/src/drivers/distance_sensor/lightware_laser_i2c/lightware_laser_i2c.cpp b/src/drivers/distance_sensor/lightware_laser_i2c/lightware_laser_i2c.cpp index 57b720ec6d..0ed849188e 100644 --- a/src/drivers/distance_sensor/lightware_laser_i2c/lightware_laser_i2c.cpp +++ b/src/drivers/distance_sensor/lightware_laser_i2c/lightware_laser_i2c.cpp @@ -1,6 +1,6 @@ /**************************************************************************** * - * Copyright (c) 2013-2016 PX4 Development Team. All rights reserved. + * Copyright (c) 2013-2016, 2021 PX4 Development Team. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -453,15 +453,15 @@ extern "C" __EXPORT int lightware_laser_i2c_main(int argc, char *argv[]) cli.orientation = distance_sensor_s::ROTATION_DOWNWARD_FACING; cli.default_i2c_frequency = 400000; - while ((ch = cli.getopt(argc, argv, "R:")) != EOF) { + while ((ch = cli.getOpt(argc, argv, "R:")) != EOF) { switch (ch) { case 'R': - cli.orientation = atoi(cli.optarg()); + cli.orientation = atoi(cli.optArg()); break; } } - const char *verb = cli.optarg(); + const char *verb = cli.optArg(); if (!verb) { ThisDriver::print_usage(); diff --git a/src/drivers/distance_sensor/ll40ls/ll40ls.cpp b/src/drivers/distance_sensor/ll40ls/ll40ls.cpp index 2cc80fa0fe..3b44f22a04 100644 --- a/src/drivers/distance_sensor/ll40ls/ll40ls.cpp +++ b/src/drivers/distance_sensor/ll40ls/ll40ls.cpp @@ -102,15 +102,15 @@ extern "C" __EXPORT int ll40ls_main(int argc, char *argv[]) cli.orientation = distance_sensor_s::ROTATION_DOWNWARD_FACING; cli.default_i2c_frequency = 100000; - while ((ch = cli.getopt(argc, argv, "R:")) != EOF) { + while ((ch = cli.getOpt(argc, argv, "R:")) != EOF) { switch (ch) { case 'R': - cli.orientation = (enum Rotation)atoi(cli.optarg()); + cli.orientation = (enum Rotation)atoi(cli.optArg()); break; } } - const char *verb = cli.optarg(); + const char *verb = cli.optArg(); if (!verb) { ThisDriver::print_usage(); diff --git a/src/drivers/distance_sensor/srf02/srf02_main.cpp b/src/drivers/distance_sensor/srf02/srf02_main.cpp index 30d558a55d..72c11d6561 100644 --- a/src/drivers/distance_sensor/srf02/srf02_main.cpp +++ b/src/drivers/distance_sensor/srf02/srf02_main.cpp @@ -1,6 +1,6 @@ /**************************************************************************** * - * Copyright (c) 2013-2020 PX4 Development Team. All rights reserved. + * Copyright (c) 2013-2020, 2021 PX4 Development Team. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -74,15 +74,15 @@ extern "C" __EXPORT int srf02_main(int argc, char *argv[]) cli.orientation = distance_sensor_s::ROTATION_DOWNWARD_FACING; cli.default_i2c_frequency = 100000; - while ((ch = cli.getopt(argc, argv, "R:")) != EOF) { + while ((ch = cli.getOpt(argc, argv, "R:")) != EOF) { switch (ch) { case 'R': - cli.orientation = atoi(cli.optarg()); + cli.orientation = atoi(cli.optArg()); break; } } - const char *verb = cli.optarg(); + const char *verb = cli.optArg(); if (!verb) { ThisDriver::print_usage(); diff --git a/src/drivers/distance_sensor/teraranger/teraranger_main.cpp b/src/drivers/distance_sensor/teraranger/teraranger_main.cpp index 55582a27ee..cbb3b71a72 100644 --- a/src/drivers/distance_sensor/teraranger/teraranger_main.cpp +++ b/src/drivers/distance_sensor/teraranger/teraranger_main.cpp @@ -1,6 +1,6 @@ /**************************************************************************** * - * Copyright (c) 2013-2020 PX4 Development Team. All rights reserved. + * Copyright (c) 2013-2020, 2021 PX4 Development Team. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -84,15 +84,15 @@ extern "C" __EXPORT int teraranger_main(int argc, char *argv[]) cli.orientation = distance_sensor_s::ROTATION_DOWNWARD_FACING; cli.default_i2c_frequency = 100000; - while ((ch = cli.getopt(argc, argv, "R:")) != EOF) { + while ((ch = cli.getOpt(argc, argv, "R:")) != EOF) { switch (ch) { case 'R': - cli.orientation = atoi(cli.optarg()); + cli.orientation = atoi(cli.optArg()); break; } } - const char *verb = cli.optarg(); + const char *verb = cli.optArg(); if (!verb) { ThisDriver::print_usage(); diff --git a/src/drivers/distance_sensor/vl53l0x/VL53L0X.cpp b/src/drivers/distance_sensor/vl53l0x/VL53L0X.cpp index f15b2dc629..3bc5214a20 100644 --- a/src/drivers/distance_sensor/vl53l0x/VL53L0X.cpp +++ b/src/drivers/distance_sensor/vl53l0x/VL53L0X.cpp @@ -568,15 +568,15 @@ extern "C" __EXPORT int vl53l0x_main(int argc, char *argv[]) cli.default_i2c_frequency = 400000; cli.orientation = distance_sensor_s::ROTATION_DOWNWARD_FACING; - while ((ch = cli.getopt(argc, argv, "R:")) != EOF) { + while ((ch = cli.getOpt(argc, argv, "R:")) != EOF) { switch (ch) { case 'R': - cli.orientation = atoi(cli.optarg()); + cli.orientation = atoi(cli.optArg()); break; } } - const char *verb = cli.optarg(); + const char *verb = cli.optArg(); if (!verb) { ThisDriver::print_usage(); diff --git a/src/drivers/distance_sensor/vl53l1x/vl53l1x.cpp b/src/drivers/distance_sensor/vl53l1x/vl53l1x.cpp index 28418a0ee2..c91a8e8ea2 100644 --- a/src/drivers/distance_sensor/vl53l1x/vl53l1x.cpp +++ b/src/drivers/distance_sensor/vl53l1x/vl53l1x.cpp @@ -685,15 +685,15 @@ extern "C" __EXPORT int vl53l1x_main(int argc, char *argv[]) cli.default_i2c_frequency = 400000; cli.orientation = distance_sensor_s::ROTATION_DOWNWARD_FACING; - while ((ch = cli.getopt(argc, argv, "R:")) != EOF) { + while ((ch = cli.getOpt(argc, argv, "R:")) != EOF) { switch (ch) { case 'R': - cli.orientation = atoi(cli.optarg()); + cli.orientation = atoi(cli.optArg()); break; } } - const char *verb = cli.optarg(); + const char *verb = cli.optArg(); if (!verb) { ThisDriver::print_usage(); diff --git a/src/drivers/imu/adis16477/adis16477_main.cpp b/src/drivers/imu/adis16477/adis16477_main.cpp index 3b5b94a863..1f42c34caf 100644 --- a/src/drivers/imu/adis16477/adis16477_main.cpp +++ b/src/drivers/imu/adis16477/adis16477_main.cpp @@ -1,6 +1,6 @@ /**************************************************************************** * - * Copyright (c) 2018-2019 PX4 Development Team. All rights reserved. + * Copyright (c) 2018-2019, 2021 PX4 Development Team. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -73,15 +73,15 @@ extern "C" int adis16477_main(int argc, char *argv[]) BusCLIArguments cli{false, true}; cli.default_spi_frequency = 1000000; - while ((ch = cli.getopt(argc, argv, "R:")) != EOF) { + while ((ch = cli.getOpt(argc, argv, "R:")) != EOF) { switch (ch) { case 'R': - cli.rotation = (enum Rotation)atoi(cli.optarg()); + cli.rotation = (enum Rotation)atoi(cli.optArg()); break; } } - const char *verb = cli.optarg(); + const char *verb = cli.optArg(); if (!verb) { ThisDriver::print_usage(); diff --git a/src/drivers/imu/adis16497/adis16497_main.cpp b/src/drivers/imu/adis16497/adis16497_main.cpp index 7f993fa912..63219bb777 100644 --- a/src/drivers/imu/adis16497/adis16497_main.cpp +++ b/src/drivers/imu/adis16497/adis16497_main.cpp @@ -1,6 +1,6 @@ /**************************************************************************** * - * Copyright (c) 2018-2019 PX4 Development Team. All rights reserved. + * Copyright (c) 2018-2019, 2021 PX4 Development Team. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -73,15 +73,15 @@ extern "C" int adis16497_main(int argc, char *argv[]) BusCLIArguments cli{false, true}; cli.default_spi_frequency = 5000000; - while ((ch = cli.getopt(argc, argv, "R:")) != EOF) { + while ((ch = cli.getOpt(argc, argv, "R:")) != EOF) { switch (ch) { case 'R': - cli.rotation = (enum Rotation)atoi(cli.optarg()); + cli.rotation = (enum Rotation)atoi(cli.optArg()); break; } } - const char *verb = cli.optarg(); + const char *verb = cli.optArg(); if (!verb) { ThisDriver::print_usage(); diff --git a/src/drivers/imu/analog_devices/adis16448/adis16448_main.cpp b/src/drivers/imu/analog_devices/adis16448/adis16448_main.cpp index b04c9d6403..3068d19821 100644 --- a/src/drivers/imu/analog_devices/adis16448/adis16448_main.cpp +++ b/src/drivers/imu/analog_devices/adis16448/adis16448_main.cpp @@ -72,15 +72,15 @@ extern "C" int adis16448_main(int argc, char *argv[]) BusCLIArguments cli{false, true}; cli.default_spi_frequency = SPI_SPEED; - while ((ch = cli.getopt(argc, argv, "R:")) != EOF) { + while ((ch = cli.getOpt(argc, argv, "R:")) != EOF) { switch (ch) { case 'R': - cli.rotation = (enum Rotation)atoi(cli.optarg()); + cli.rotation = (enum Rotation)atoi(cli.optArg()); break; } } - const char *verb = cli.optarg(); + const char *verb = cli.optArg(); if (!verb) { ThisDriver::print_usage(); diff --git a/src/drivers/imu/analog_devices/adis16470/adis16470_main.cpp b/src/drivers/imu/analog_devices/adis16470/adis16470_main.cpp index ba12fdf947..dd80dfcb75 100644 --- a/src/drivers/imu/analog_devices/adis16470/adis16470_main.cpp +++ b/src/drivers/imu/analog_devices/adis16470/adis16470_main.cpp @@ -72,15 +72,15 @@ extern "C" int adis16470_main(int argc, char *argv[]) BusCLIArguments cli{false, true}; cli.default_spi_frequency = SPI_SPEED; - while ((ch = cli.getopt(argc, argv, "R:")) != EOF) { + while ((ch = cli.getOpt(argc, argv, "R:")) != EOF) { switch (ch) { case 'R': - cli.rotation = (enum Rotation)atoi(cli.optarg()); + cli.rotation = (enum Rotation)atoi(cli.optArg()); break; } } - const char *verb = cli.optarg(); + const char *verb = cli.optArg(); if (!verb) { ThisDriver::print_usage(); diff --git a/src/drivers/imu/bosch/bmi055/bmi055_main.cpp b/src/drivers/imu/bosch/bmi055/bmi055_main.cpp index 3a664e5d7d..293e620bde 100644 --- a/src/drivers/imu/bosch/bmi055/bmi055_main.cpp +++ b/src/drivers/imu/bosch/bmi055/bmi055_main.cpp @@ -1,6 +1,6 @@ /**************************************************************************** * - * Copyright (c) 2020 PX4 Development Team. All rights reserved. + * Copyright (c) 2020, 2021 PX4 Development Team. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -56,7 +56,7 @@ extern "C" int bmi055_main(int argc, char *argv[]) cli.type = 0; cli.default_spi_frequency = 10000000; - while ((ch = cli.getopt(argc, argv, "AGR:")) != EOF) { + while ((ch = cli.getOpt(argc, argv, "AGR:")) != EOF) { switch (ch) { case 'A': cli.type = DRV_ACC_DEVTYPE_BMI055; @@ -67,12 +67,12 @@ extern "C" int bmi055_main(int argc, char *argv[]) break; case 'R': - cli.rotation = (enum Rotation)atoi(cli.optarg()); + cli.rotation = (enum Rotation)atoi(cli.optArg()); break; } } - const char *verb = cli.optarg(); + const char *verb = cli.optArg(); if (!verb) { ThisDriver::print_usage(); diff --git a/src/drivers/imu/bosch/bmi088/bmi088_i2c/bmi088_i2c_main.cpp b/src/drivers/imu/bosch/bmi088/bmi088_i2c/bmi088_i2c_main.cpp index b7a27490e0..e5d7f0b414 100644 --- a/src/drivers/imu/bosch/bmi088/bmi088_i2c/bmi088_i2c_main.cpp +++ b/src/drivers/imu/bosch/bmi088/bmi088_i2c/bmi088_i2c_main.cpp @@ -1,6 +1,6 @@ /**************************************************************************** * - * Copyright (c) 2020 PX4 Development Team. All rights reserved. + * Copyright (c) 2020, 2021 PX4 Development Team. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -60,7 +60,7 @@ extern "C" int bmi088_i2c_main(int argc, char *argv[]) cli.default_spi_frequency = 400 * 1000; - while ((ch = cli.getopt(argc, argv, "AGR:")) != EOF) { + while ((ch = cli.getOpt(argc, argv, "AGR:")) != EOF) { switch (ch) { case 'A': cli.type = DRV_ACC_DEVTYPE_BMI088; @@ -73,12 +73,12 @@ extern "C" int bmi088_i2c_main(int argc, char *argv[]) break; case 'R': - cli.rotation = (enum Rotation)atoi(cli.optarg()); + cli.rotation = (enum Rotation)atoi(cli.optArg()); break; } } - const char *verb = cli.optarg(); + const char *verb = cli.optArg(); if (!verb) { ThisDriver::print_usage(); diff --git a/src/drivers/imu/bosch/bmi088/bmi088_main.cpp b/src/drivers/imu/bosch/bmi088/bmi088_main.cpp index e6949e4cf6..348e3705c0 100644 --- a/src/drivers/imu/bosch/bmi088/bmi088_main.cpp +++ b/src/drivers/imu/bosch/bmi088/bmi088_main.cpp @@ -1,6 +1,6 @@ /**************************************************************************** * - * Copyright (c) 2020 PX4 Development Team. All rights reserved. + * Copyright (c) 2020, 2021 PX4 Development Team. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -56,7 +56,7 @@ extern "C" int bmi088_main(int argc, char *argv[]) cli.type = 0; cli.default_spi_frequency = 10000000; - while ((ch = cli.getopt(argc, argv, "AGR:")) != EOF) { + while ((ch = cli.getOpt(argc, argv, "AGR:")) != EOF) { switch (ch) { case 'A': cli.type = DRV_ACC_DEVTYPE_BMI088; @@ -67,12 +67,12 @@ extern "C" int bmi088_main(int argc, char *argv[]) break; case 'R': - cli.rotation = (enum Rotation)atoi(cli.optarg()); + cli.rotation = (enum Rotation)atoi(cli.optArg()); break; } } - const char *verb = cli.optarg(); + const char *verb = cli.optArg(); if (!verb) { ThisDriver::print_usage(); diff --git a/src/drivers/imu/fxas21002c/fxas21002c_main.cpp b/src/drivers/imu/fxas21002c/fxas21002c_main.cpp index 854641b066..991f089766 100644 --- a/src/drivers/imu/fxas21002c/fxas21002c_main.cpp +++ b/src/drivers/imu/fxas21002c/fxas21002c_main.cpp @@ -1,6 +1,6 @@ /**************************************************************************** * - * Copyright (c) 2017-2019 PX4 Development Team. All rights reserved. + * Copyright (c) 2017-2019, 2021 PX4 Development Team. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -103,15 +103,15 @@ extern "C" int fxas21002c_main(int argc, char *argv[]) cli.spi_mode = SPIDEV_MODE0; cli.i2c_address = 0x20; - while ((ch = cli.getopt(argc, argv, "R:")) != EOF) { + while ((ch = cli.getOpt(argc, argv, "R:")) != EOF) { switch (ch) { case 'R': - cli.rotation = (enum Rotation)atoi(cli.optarg()); + cli.rotation = (enum Rotation)atoi(cli.optArg()); break; } } - const char *verb = cli.optarg(); + const char *verb = cli.optArg(); if (!verb) { ThisDriver::print_usage(); diff --git a/src/drivers/imu/fxos8701cq/fxos8701cq_main.cpp b/src/drivers/imu/fxos8701cq/fxos8701cq_main.cpp index 50866f8b23..0341c6fc51 100644 --- a/src/drivers/imu/fxos8701cq/fxos8701cq_main.cpp +++ b/src/drivers/imu/fxos8701cq/fxos8701cq_main.cpp @@ -1,6 +1,6 @@ /**************************************************************************** * - * Copyright (c) 2017-2019 PX4 Development Team. All rights reserved. + * Copyright (c) 2017-2019, 2021 PX4 Development Team. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -109,15 +109,15 @@ extern "C" int fxos8701cq_main(int argc, char *argv[]) cli.spi_mode = SPIDEV_MODE0; cli.i2c_address = 0x1E; - while ((ch = cli.getopt(argc, argv, "R:")) != EOF) { + while ((ch = cli.getOpt(argc, argv, "R:")) != EOF) { switch (ch) { case 'R': - cli.rotation = (enum Rotation)atoi(cli.optarg()); + cli.rotation = (enum Rotation)atoi(cli.optArg()); break; } } - const char *verb = cli.optarg(); + const char *verb = cli.optArg(); if (!verb) { ThisDriver::print_usage(); diff --git a/src/drivers/imu/invensense/icm20602/icm20602_main.cpp b/src/drivers/imu/invensense/icm20602/icm20602_main.cpp index 7a48d456b6..1c670d32c4 100644 --- a/src/drivers/imu/invensense/icm20602/icm20602_main.cpp +++ b/src/drivers/imu/invensense/icm20602/icm20602_main.cpp @@ -1,6 +1,6 @@ /**************************************************************************** * - * Copyright (c) 2019 PX4 Development Team. All rights reserved. + * Copyright (c) 2019, 2021 PX4 Development Team. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -72,15 +72,15 @@ extern "C" int icm20602_main(int argc, char *argv[]) BusCLIArguments cli{false, true}; cli.default_spi_frequency = SPI_SPEED; - while ((ch = cli.getopt(argc, argv, "R:")) != EOF) { + while ((ch = cli.getOpt(argc, argv, "R:")) != EOF) { switch (ch) { case 'R': - cli.rotation = (enum Rotation)atoi(cli.optarg()); + cli.rotation = (enum Rotation)atoi(cli.optArg()); break; } } - const char *verb = cli.optarg(); + const char *verb = cli.optArg(); if (!verb) { ThisDriver::print_usage(); diff --git a/src/drivers/imu/invensense/icm20608g/icm20608g_main.cpp b/src/drivers/imu/invensense/icm20608g/icm20608g_main.cpp index 038bf728dd..6104f62ee3 100644 --- a/src/drivers/imu/invensense/icm20608g/icm20608g_main.cpp +++ b/src/drivers/imu/invensense/icm20608g/icm20608g_main.cpp @@ -1,6 +1,6 @@ /**************************************************************************** * - * Copyright (c) 2019 PX4 Development Team. All rights reserved. + * Copyright (c) 2019, 2021 PX4 Development Team. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -72,15 +72,15 @@ extern "C" int icm20608g_main(int argc, char *argv[]) BusCLIArguments cli{false, true}; cli.default_spi_frequency = SPI_SPEED; - while ((ch = cli.getopt(argc, argv, "R:")) != EOF) { + while ((ch = cli.getOpt(argc, argv, "R:")) != EOF) { switch (ch) { case 'R': - cli.rotation = (enum Rotation)atoi(cli.optarg()); + cli.rotation = (enum Rotation)atoi(cli.optArg()); break; } } - const char *verb = cli.optarg(); + const char *verb = cli.optArg(); if (!verb) { ThisDriver::print_usage(); diff --git a/src/drivers/imu/invensense/icm20649/icm20649_main.cpp b/src/drivers/imu/invensense/icm20649/icm20649_main.cpp index ce91fffec0..853c95a142 100644 --- a/src/drivers/imu/invensense/icm20649/icm20649_main.cpp +++ b/src/drivers/imu/invensense/icm20649/icm20649_main.cpp @@ -1,6 +1,6 @@ /**************************************************************************** * - * Copyright (c) 2020 PX4 Development Team. All rights reserved. + * Copyright (c) 2020, 2021 PX4 Development Team. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -72,15 +72,15 @@ extern "C" int icm20649_main(int argc, char *argv[]) BusCLIArguments cli{false, true}; cli.default_spi_frequency = SPI_SPEED; - while ((ch = cli.getopt(argc, argv, "R:")) != EOF) { + while ((ch = cli.getOpt(argc, argv, "R:")) != EOF) { switch (ch) { case 'R': - cli.rotation = (enum Rotation)atoi(cli.optarg()); + cli.rotation = (enum Rotation)atoi(cli.optArg()); break; } } - const char *verb = cli.optarg(); + const char *verb = cli.optArg(); if (!verb) { ThisDriver::print_usage(); diff --git a/src/drivers/imu/invensense/icm20689/icm20689_main.cpp b/src/drivers/imu/invensense/icm20689/icm20689_main.cpp index 1e0a351523..b5ec5f556f 100644 --- a/src/drivers/imu/invensense/icm20689/icm20689_main.cpp +++ b/src/drivers/imu/invensense/icm20689/icm20689_main.cpp @@ -1,6 +1,6 @@ /**************************************************************************** * - * Copyright (c) 2020 PX4 Development Team. All rights reserved. + * Copyright (c) 2020, 2021 PX4 Development Team. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -72,15 +72,15 @@ extern "C" int icm20689_main(int argc, char *argv[]) BusCLIArguments cli{false, true}; cli.default_spi_frequency = SPI_SPEED; - while ((ch = cli.getopt(argc, argv, "R:")) != EOF) { + while ((ch = cli.getOpt(argc, argv, "R:")) != EOF) { switch (ch) { case 'R': - cli.rotation = (enum Rotation)atoi(cli.optarg()); + cli.rotation = (enum Rotation)atoi(cli.optArg()); break; } } - const char *verb = cli.optarg(); + const char *verb = cli.optArg(); if (!verb) { ThisDriver::print_usage(); diff --git a/src/drivers/imu/invensense/icm20948/icm20948_main.cpp b/src/drivers/imu/invensense/icm20948/icm20948_main.cpp index c81ecfc087..2fed4115e5 100644 --- a/src/drivers/imu/invensense/icm20948/icm20948_main.cpp +++ b/src/drivers/imu/invensense/icm20948/icm20948_main.cpp @@ -1,6 +1,6 @@ /**************************************************************************** * - * Copyright (c) 2020 PX4 Development Team. All rights reserved. + * Copyright (c) 2020, 2021 PX4 Development Team. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -74,19 +74,19 @@ extern "C" int icm20948_main(int argc, char *argv[]) BusCLIArguments cli{false, true}; cli.default_spi_frequency = SPI_SPEED; - while ((ch = cli.getopt(argc, argv, "MR:")) != EOF) { + while ((ch = cli.getOpt(argc, argv, "MR:")) != EOF) { switch (ch) { case 'M': cli.custom1 = 1; break; case 'R': - cli.rotation = (enum Rotation)atoi(cli.optarg()); + cli.rotation = (enum Rotation)atoi(cli.optArg()); break; } } - const char *verb = cli.optarg(); + const char *verb = cli.optArg(); if (!verb) { ThisDriver::print_usage(); diff --git a/src/drivers/imu/invensense/icm40609d/icm40609d_main.cpp b/src/drivers/imu/invensense/icm40609d/icm40609d_main.cpp index a366698fc0..f007df8585 100644 --- a/src/drivers/imu/invensense/icm40609d/icm40609d_main.cpp +++ b/src/drivers/imu/invensense/icm40609d/icm40609d_main.cpp @@ -1,6 +1,6 @@ /**************************************************************************** * - * Copyright (c) 2020 PX4 Development Team. All rights reserved. + * Copyright (c) 2020, 2021 PX4 Development Team. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -72,15 +72,15 @@ extern "C" int icm40609d_main(int argc, char *argv[]) BusCLIArguments cli{false, true}; cli.default_spi_frequency = SPI_SPEED; - while ((ch = cli.getopt(argc, argv, "R:")) != EOF) { + while ((ch = cli.getOpt(argc, argv, "R:")) != EOF) { switch (ch) { case 'R': - cli.rotation = (enum Rotation)atoi(cli.optarg()); + cli.rotation = (enum Rotation)atoi(cli.optArg()); break; } } - const char *verb = cli.optarg(); + const char *verb = cli.optArg(); if (!verb) { ThisDriver::print_usage(); diff --git a/src/drivers/imu/invensense/icm42605/icm42605_main.cpp b/src/drivers/imu/invensense/icm42605/icm42605_main.cpp index f8c870ab1b..f07fd19224 100644 --- a/src/drivers/imu/invensense/icm42605/icm42605_main.cpp +++ b/src/drivers/imu/invensense/icm42605/icm42605_main.cpp @@ -1,6 +1,6 @@ /**************************************************************************** * - * Copyright (c) 2020 PX4 Development Team. All rights reserved. + * Copyright (c) 2020, 2021 PX4 Development Team. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -72,15 +72,15 @@ extern "C" int icm42605_main(int argc, char *argv[]) BusCLIArguments cli{false, true}; cli.default_spi_frequency = SPI_SPEED; - while ((ch = cli.getopt(argc, argv, "R:")) != EOF) { + while ((ch = cli.getOpt(argc, argv, "R:")) != EOF) { switch (ch) { case 'R': - cli.rotation = (enum Rotation)atoi(cli.optarg()); + cli.rotation = (enum Rotation)atoi(cli.optArg()); break; } } - const char *verb = cli.optarg(); + const char *verb = cli.optArg(); if (!verb) { ThisDriver::print_usage(); diff --git a/src/drivers/imu/invensense/icm42688p/icm42688p_main.cpp b/src/drivers/imu/invensense/icm42688p/icm42688p_main.cpp index 42d90df8bf..262028e016 100644 --- a/src/drivers/imu/invensense/icm42688p/icm42688p_main.cpp +++ b/src/drivers/imu/invensense/icm42688p/icm42688p_main.cpp @@ -1,6 +1,6 @@ /**************************************************************************** * - * Copyright (c) 2020 PX4 Development Team. All rights reserved. + * Copyright (c) 2020, 2021 PX4 Development Team. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -72,15 +72,15 @@ extern "C" int icm42688p_main(int argc, char *argv[]) BusCLIArguments cli{false, true}; cli.default_spi_frequency = SPI_SPEED; - while ((ch = cli.getopt(argc, argv, "R:")) != EOF) { + while ((ch = cli.getOpt(argc, argv, "R:")) != EOF) { switch (ch) { case 'R': - cli.rotation = (enum Rotation)atoi(cli.optarg()); + cli.rotation = (enum Rotation)atoi(cli.optArg()); break; } } - const char *verb = cli.optarg(); + const char *verb = cli.optArg(); if (!verb) { ThisDriver::print_usage(); diff --git a/src/drivers/imu/invensense/mpu6000/mpu6000_main.cpp b/src/drivers/imu/invensense/mpu6000/mpu6000_main.cpp index da095ee0f2..9d2cc3fa9f 100644 --- a/src/drivers/imu/invensense/mpu6000/mpu6000_main.cpp +++ b/src/drivers/imu/invensense/mpu6000/mpu6000_main.cpp @@ -1,6 +1,6 @@ /**************************************************************************** * - * Copyright (c) 2020 PX4 Development Team. All rights reserved. + * Copyright (c) 2020, 2021 PX4 Development Team. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -72,15 +72,15 @@ extern "C" int mpu6000_main(int argc, char *argv[]) BusCLIArguments cli{false, true}; cli.default_spi_frequency = SPI_SPEED; - while ((ch = cli.getopt(argc, argv, "R:")) != EOF) { + while ((ch = cli.getOpt(argc, argv, "R:")) != EOF) { switch (ch) { case 'R': - cli.rotation = (enum Rotation)atoi(cli.optarg()); + cli.rotation = (enum Rotation)atoi(cli.optArg()); break; } } - const char *verb = cli.optarg(); + const char *verb = cli.optArg(); if (!verb) { ThisDriver::print_usage(); diff --git a/src/drivers/imu/invensense/mpu6500/mpu6500_main.cpp b/src/drivers/imu/invensense/mpu6500/mpu6500_main.cpp index 82f39b005c..ddb024873d 100644 --- a/src/drivers/imu/invensense/mpu6500/mpu6500_main.cpp +++ b/src/drivers/imu/invensense/mpu6500/mpu6500_main.cpp @@ -1,6 +1,6 @@ /**************************************************************************** * - * Copyright (c) 2020 PX4 Development Team. All rights reserved. + * Copyright (c) 2020, 2021 PX4 Development Team. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -72,15 +72,15 @@ extern "C" int mpu6500_main(int argc, char *argv[]) BusCLIArguments cli{false, true}; cli.default_spi_frequency = SPI_SPEED; - while ((ch = cli.getopt(argc, argv, "R:")) != EOF) { + while ((ch = cli.getOpt(argc, argv, "R:")) != EOF) { switch (ch) { case 'R': - cli.rotation = (enum Rotation)atoi(cli.optarg()); + cli.rotation = (enum Rotation)atoi(cli.optArg()); break; } } - const char *verb = cli.optarg(); + const char *verb = cli.optArg(); if (!verb) { ThisDriver::print_usage(); diff --git a/src/drivers/imu/invensense/mpu9250/mpu9250_i2c_main.cpp b/src/drivers/imu/invensense/mpu9250/mpu9250_i2c_main.cpp index ddaec82dff..c0af7e6b9c 100644 --- a/src/drivers/imu/invensense/mpu9250/mpu9250_i2c_main.cpp +++ b/src/drivers/imu/invensense/mpu9250/mpu9250_i2c_main.cpp @@ -1,6 +1,6 @@ /**************************************************************************** * - * Copyright (c) 2020 PX4 Development Team. All rights reserved. + * Copyright (c) 2020, 2021 PX4 Development Team. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -74,15 +74,15 @@ extern "C" int mpu9250_i2c_main(int argc, char *argv[]) cli.default_i2c_frequency = I2C_SPEED; cli.i2c_address = I2C_ADDRESS_DEFAULT; - while ((ch = cli.getopt(argc, argv, "R:")) != EOF) { + while ((ch = cli.getOpt(argc, argv, "R:")) != EOF) { switch (ch) { case 'R': - cli.rotation = (enum Rotation)atoi(cli.optarg()); + cli.rotation = (enum Rotation)atoi(cli.optArg()); break; } } - const char *verb = cli.optarg(); + const char *verb = cli.optArg(); if (!verb) { ThisDriver::print_usage(); diff --git a/src/drivers/imu/invensense/mpu9250/mpu9250_main.cpp b/src/drivers/imu/invensense/mpu9250/mpu9250_main.cpp index 8c9636dad6..84b52ee1e0 100644 --- a/src/drivers/imu/invensense/mpu9250/mpu9250_main.cpp +++ b/src/drivers/imu/invensense/mpu9250/mpu9250_main.cpp @@ -1,6 +1,6 @@ /**************************************************************************** * - * Copyright (c) 2020 PX4 Development Team. All rights reserved. + * Copyright (c) 2020, 2021 PX4 Development Team. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -74,19 +74,19 @@ extern "C" int mpu9250_main(int argc, char *argv[]) BusCLIArguments cli{false, true}; cli.default_spi_frequency = SPI_SPEED; - while ((ch = cli.getopt(argc, argv, "MR:")) != EOF) { + while ((ch = cli.getOpt(argc, argv, "MR:")) != EOF) { switch (ch) { case 'M': cli.custom1 = 1; break; case 'R': - cli.rotation = (enum Rotation)atoi(cli.optarg()); + cli.rotation = (enum Rotation)atoi(cli.optArg()); break; } } - const char *verb = cli.optarg(); + const char *verb = cli.optArg(); if (!verb) { ThisDriver::print_usage(); diff --git a/src/drivers/imu/l3gd20/l3gd20_main.cpp b/src/drivers/imu/l3gd20/l3gd20_main.cpp index 91e805724e..e6312858db 100644 --- a/src/drivers/imu/l3gd20/l3gd20_main.cpp +++ b/src/drivers/imu/l3gd20/l3gd20_main.cpp @@ -1,6 +1,6 @@ /**************************************************************************** * - * Copyright (c) 2012-2019 PX4 Development Team. All rights reserved. + * Copyright (c) 2012-2019, 2021 PX4 Development Team. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -84,15 +84,15 @@ extern "C" int l3gd20_main(int argc, char *argv[]) BusCLIArguments cli{false, true}; cli.default_spi_frequency = 11 * 1000 * 1000; - while ((ch = cli.getopt(argc, argv, "R:")) != EOF) { + while ((ch = cli.getOpt(argc, argv, "R:")) != EOF) { switch (ch) { case 'R': - cli.rotation = (enum Rotation)atoi(cli.optarg()); + cli.rotation = (enum Rotation)atoi(cli.optArg()); break; } } - const char *verb = cli.optarg(); + const char *verb = cli.optArg(); if (!verb) { ThisDriver::print_usage(); diff --git a/src/drivers/imu/lsm303d/lsm303d_main.cpp b/src/drivers/imu/lsm303d/lsm303d_main.cpp index b80868c574..148099eb2c 100644 --- a/src/drivers/imu/lsm303d/lsm303d_main.cpp +++ b/src/drivers/imu/lsm303d/lsm303d_main.cpp @@ -1,6 +1,6 @@ /**************************************************************************** * - * Copyright (c) 2013-2019 PX4 Development Team. All rights reserved. + * Copyright (c) 2013-2019, 2021 PX4 Development Team. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -78,15 +78,15 @@ extern "C" int lsm303d_main(int argc, char *argv[]) BusCLIArguments cli{false, true}; cli.default_spi_frequency = 11 * 1000 * 1000; - while ((ch = cli.getopt(argc, argv, "R:")) != EOF) { + while ((ch = cli.getOpt(argc, argv, "R:")) != EOF) { switch (ch) { case 'R': - cli.rotation = (enum Rotation)atoi(cli.optarg()); + cli.rotation = (enum Rotation)atoi(cli.optArg()); break; } } - const char *verb = cli.optarg(); + const char *verb = cli.optArg(); if (!verb) { ThisDriver::print_usage(); diff --git a/src/drivers/imu/st/lsm9ds1/lsm9ds1_main.cpp b/src/drivers/imu/st/lsm9ds1/lsm9ds1_main.cpp index 24dbc8d331..2cb0bc9660 100644 --- a/src/drivers/imu/st/lsm9ds1/lsm9ds1_main.cpp +++ b/src/drivers/imu/st/lsm9ds1/lsm9ds1_main.cpp @@ -1,6 +1,6 @@ /**************************************************************************** * - * Copyright (c) 2020 PX4 Development Team. All rights reserved. + * Copyright (c) 2020, 2021 PX4 Development Team. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -72,15 +72,15 @@ extern "C" int lsm9ds1_main(int argc, char *argv[]) BusCLIArguments cli{false, true}; cli.default_spi_frequency = SPI_SPEED; - while ((ch = cli.getopt(argc, argv, "R:")) != EOF) { + while ((ch = cli.getOpt(argc, argv, "R:")) != EOF) { switch (ch) { case 'R': - cli.rotation = (enum Rotation)atoi(cli.optarg()); + cli.rotation = (enum Rotation)atoi(cli.optArg()); break; } } - const char *verb = cli.optarg(); + const char *verb = cli.optArg(); if (!verb) { ThisDriver::print_usage(); diff --git a/src/drivers/magnetometer/akm/ak09916/ak09916_main.cpp b/src/drivers/magnetometer/akm/ak09916/ak09916_main.cpp index 47704d754b..5a93294353 100644 --- a/src/drivers/magnetometer/akm/ak09916/ak09916_main.cpp +++ b/src/drivers/magnetometer/akm/ak09916/ak09916_main.cpp @@ -1,6 +1,6 @@ /**************************************************************************** * - * Copyright (c) 2020 PX4 Development Team. All rights reserved. + * Copyright (c) 2020, 2021 PX4 Development Team. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -72,15 +72,15 @@ extern "C" __EXPORT int ak09916_main(int argc, char *argv[]) BusCLIArguments cli{true, false}; cli.default_i2c_frequency = I2C_SPEED; - while ((ch = cli.getopt(argc, argv, "R:")) != EOF) { + while ((ch = cli.getOpt(argc, argv, "R:")) != EOF) { switch (ch) { case 'R': - cli.rotation = (enum Rotation)atoi(cli.optarg()); + cli.rotation = (enum Rotation)atoi(cli.optArg()); break; } } - const char *verb = cli.optarg(); + const char *verb = cli.optArg(); if (!verb) { ThisDriver::print_usage(); diff --git a/src/drivers/magnetometer/akm/ak8963/ak8963_main.cpp b/src/drivers/magnetometer/akm/ak8963/ak8963_main.cpp index 6251986932..0bdb0e46b0 100644 --- a/src/drivers/magnetometer/akm/ak8963/ak8963_main.cpp +++ b/src/drivers/magnetometer/akm/ak8963/ak8963_main.cpp @@ -1,6 +1,6 @@ /**************************************************************************** * - * Copyright (c) 2020 PX4 Development Team. All rights reserved. + * Copyright (c) 2020, 2021 PX4 Development Team. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -72,15 +72,15 @@ extern "C" __EXPORT int ak8963_main(int argc, char *argv[]) BusCLIArguments cli{true, false}; cli.default_i2c_frequency = I2C_SPEED; - while ((ch = cli.getopt(argc, argv, "R:")) != EOF) { + while ((ch = cli.getOpt(argc, argv, "R:")) != EOF) { switch (ch) { case 'R': - cli.rotation = (enum Rotation)atoi(cli.optarg()); + cli.rotation = (enum Rotation)atoi(cli.optArg()); break; } } - const char *verb = cli.optarg(); + const char *verb = cli.optArg(); if (!verb) { ThisDriver::print_usage(); diff --git a/src/drivers/magnetometer/bosch/bmm150/bmm150_main.cpp b/src/drivers/magnetometer/bosch/bmm150/bmm150_main.cpp index 00050213b4..246ccc9293 100644 --- a/src/drivers/magnetometer/bosch/bmm150/bmm150_main.cpp +++ b/src/drivers/magnetometer/bosch/bmm150/bmm150_main.cpp @@ -1,6 +1,6 @@ /**************************************************************************** * - * Copyright (c) 2020 PX4 Development Team. All rights reserved. + * Copyright (c) 2020, 2021 PX4 Development Team. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -72,15 +72,15 @@ extern "C" int bmm150_main(int argc, char *argv[]) BusCLIArguments cli{true, false}; cli.default_i2c_frequency = I2C_SPEED; - while ((ch = cli.getopt(argc, argv, "R:")) != EOF) { + while ((ch = cli.getOpt(argc, argv, "R:")) != EOF) { switch (ch) { case 'R': - cli.rotation = (enum Rotation)atoi(cli.optarg()); + cli.rotation = (enum Rotation)atoi(cli.optArg()); break; } } - const char *verb = cli.optarg(); + const char *verb = cli.optArg(); if (!verb) { ThisDriver::print_usage(); diff --git a/src/drivers/magnetometer/hmc5883/hmc5883_main.cpp b/src/drivers/magnetometer/hmc5883/hmc5883_main.cpp index 52b30a523e..08896d08b5 100644 --- a/src/drivers/magnetometer/hmc5883/hmc5883_main.cpp +++ b/src/drivers/magnetometer/hmc5883/hmc5883_main.cpp @@ -1,6 +1,6 @@ /**************************************************************************** * - * Copyright (c) 2012-2015 PX4 Development Team. All rights reserved. + * Copyright (c) 2012-2015, 2021 PX4 Development Team. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -108,10 +108,10 @@ extern "C" int hmc5883_main(int argc, char *argv[]) cli.default_i2c_frequency = 400000; cli.default_spi_frequency = 11 * 1000 * 1000; - while ((ch = cli.getopt(argc, argv, "R:T")) != EOF) { + while ((ch = cli.getOpt(argc, argv, "R:T")) != EOF) { switch (ch) { case 'R': - cli.rotation = (enum Rotation)atoi(cli.optarg()); + cli.rotation = (enum Rotation)atoi(cli.optArg()); break; case 'T': @@ -120,7 +120,7 @@ extern "C" int hmc5883_main(int argc, char *argv[]) } } - const char *verb = cli.optarg(); + const char *verb = cli.optArg(); if (!verb) { ThisDriver::print_usage(); diff --git a/src/drivers/magnetometer/isentek/ist8308/ist8308_main.cpp b/src/drivers/magnetometer/isentek/ist8308/ist8308_main.cpp index 839d1f303b..7963b86453 100644 --- a/src/drivers/magnetometer/isentek/ist8308/ist8308_main.cpp +++ b/src/drivers/magnetometer/isentek/ist8308/ist8308_main.cpp @@ -1,6 +1,6 @@ /**************************************************************************** * - * Copyright (c) 2020 PX4 Development Team. All rights reserved. + * Copyright (c) 2020, 2021 PX4 Development Team. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -72,15 +72,15 @@ extern "C" int ist8308_main(int argc, char *argv[]) BusCLIArguments cli{true, false}; cli.default_i2c_frequency = I2C_SPEED; - while ((ch = cli.getopt(argc, argv, "R:")) != EOF) { + while ((ch = cli.getOpt(argc, argv, "R:")) != EOF) { switch (ch) { case 'R': - cli.rotation = (enum Rotation)atoi(cli.optarg()); + cli.rotation = (enum Rotation)atoi(cli.optArg()); break; } } - const char *verb = cli.optarg(); + const char *verb = cli.optArg(); if (!verb) { ThisDriver::print_usage(); diff --git a/src/drivers/magnetometer/isentek/ist8310/ist8310_main.cpp b/src/drivers/magnetometer/isentek/ist8310/ist8310_main.cpp index 1f3beb9e42..72499133ac 100644 --- a/src/drivers/magnetometer/isentek/ist8310/ist8310_main.cpp +++ b/src/drivers/magnetometer/isentek/ist8310/ist8310_main.cpp @@ -1,6 +1,6 @@ /**************************************************************************** * - * Copyright (c) 2020 PX4 Development Team. All rights reserved. + * Copyright (c) 2020, 2021 PX4 Development Team. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -75,15 +75,15 @@ extern "C" int ist8310_main(int argc, char *argv[]) cli.i2c_address = I2C_ADDRESS_DEFAULT; cli.default_i2c_frequency = I2C_SPEED; - while ((ch = cli.getopt(argc, argv, "R:")) != EOF) { + while ((ch = cli.getOpt(argc, argv, "R:")) != EOF) { switch (ch) { case 'R': - cli.rotation = (enum Rotation)atoi(cli.optarg()); + cli.rotation = (enum Rotation)atoi(cli.optArg()); break; } } - const char *verb = cli.optarg(); + const char *verb = cli.optArg(); if (!verb) { ThisDriver::print_usage(); diff --git a/src/drivers/magnetometer/lis2mdl/lis2mdl_main.cpp b/src/drivers/magnetometer/lis2mdl/lis2mdl_main.cpp index f8a05eb8b7..0a06f1434e 100644 --- a/src/drivers/magnetometer/lis2mdl/lis2mdl_main.cpp +++ b/src/drivers/magnetometer/lis2mdl/lis2mdl_main.cpp @@ -1,6 +1,6 @@ /**************************************************************************** * - * Copyright (c) 2020 PX4 Development Team. All rights reserved. + * Copyright (c) 2020, 2021 PX4 Development Team. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -97,15 +97,15 @@ extern "C" int lis2mdl_main(int argc, char *argv[]) cli.default_i2c_frequency = 400000; cli.default_spi_frequency = 11 * 1000 * 1000; - while ((ch = cli.getopt(argc, argv, "R:")) != EOF) { + while ((ch = cli.getOpt(argc, argv, "R:")) != EOF) { switch (ch) { case 'R': - cli.rotation = (enum Rotation)atoi(cli.optarg()); + cli.rotation = (enum Rotation)atoi(cli.optArg()); break; } } - const char *verb = cli.optarg(); + const char *verb = cli.optArg(); if (!verb) { ThisDriver::print_usage(); diff --git a/src/drivers/magnetometer/lis3mdl/lis3mdl_main.cpp b/src/drivers/magnetometer/lis3mdl/lis3mdl_main.cpp index 6c220ebc09..0c2784cacf 100644 --- a/src/drivers/magnetometer/lis3mdl/lis3mdl_main.cpp +++ b/src/drivers/magnetometer/lis3mdl/lis3mdl_main.cpp @@ -1,6 +1,6 @@ /**************************************************************************** * - * Copyright (c) 2012-2015 PX4 Development Team. All rights reserved. + * Copyright (c) 2012-2015, 2021 PX4 Development Team. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -104,15 +104,15 @@ extern "C" int lis3mdl_main(int argc, char *argv[]) cli.default_i2c_frequency = 400000; cli.default_spi_frequency = 11 * 1000 * 1000; - while ((ch = cli.getopt(argc, argv, "R:")) != EOF) { + while ((ch = cli.getOpt(argc, argv, "R:")) != EOF) { switch (ch) { case 'R': - cli.rotation = (enum Rotation)atoi(cli.optarg()); + cli.rotation = (enum Rotation)atoi(cli.optArg()); break; } } - const char *verb = cli.optarg(); + const char *verb = cli.optArg(); if (!verb) { ThisDriver::print_usage(); diff --git a/src/drivers/magnetometer/lsm303agr/lsm303agr_main.cpp b/src/drivers/magnetometer/lsm303agr/lsm303agr_main.cpp index ca99918702..df45f051d9 100644 --- a/src/drivers/magnetometer/lsm303agr/lsm303agr_main.cpp +++ b/src/drivers/magnetometer/lsm303agr/lsm303agr_main.cpp @@ -1,6 +1,6 @@ /**************************************************************************** * - * Copyright (c) 2018 PX4 Development Team. All rights reserved. + * Copyright (c) 2018, 2021 PX4 Development Team. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -72,15 +72,15 @@ extern "C" int lsm303agr_main(int argc, char *argv[]) BusCLIArguments cli{false, true}; cli.default_spi_frequency = 8 * 1000 * 1000; - while ((ch = cli.getopt(argc, argv, "R:")) != EOF) { + while ((ch = cli.getOpt(argc, argv, "R:")) != EOF) { switch (ch) { case 'R': - cli.rotation = (enum Rotation)atoi(cli.optarg()); + cli.rotation = (enum Rotation)atoi(cli.optArg()); break; } } - const char *verb = cli.optarg(); + const char *verb = cli.optArg(); if (!verb) { ThisDriver::print_usage(); diff --git a/src/drivers/magnetometer/lsm9ds1_mag/lsm9ds1_mag_main.cpp b/src/drivers/magnetometer/lsm9ds1_mag/lsm9ds1_mag_main.cpp index 19811bd4a4..4c9b7b9dbc 100644 --- a/src/drivers/magnetometer/lsm9ds1_mag/lsm9ds1_mag_main.cpp +++ b/src/drivers/magnetometer/lsm9ds1_mag/lsm9ds1_mag_main.cpp @@ -73,15 +73,15 @@ extern "C" __EXPORT int lsm9ds1_mag_main(int argc, char *argv[]) BusCLIArguments cli{false, true}; cli.default_spi_frequency = SPI_SPEED; - while ((ch = cli.getopt(argc, argv, "R:")) != EOF) { + while ((ch = cli.getOpt(argc, argv, "R:")) != EOF) { switch (ch) { case 'R': - cli.rotation = (enum Rotation)atoi(cli.optarg()); + cli.rotation = (enum Rotation)atoi(cli.optArg()); break; } } - const char *verb = cli.optarg(); + const char *verb = cli.optArg(); if (!verb) { ThisDriver::print_usage(); diff --git a/src/drivers/magnetometer/qmc5883l/qmc5883l_main.cpp b/src/drivers/magnetometer/qmc5883l/qmc5883l_main.cpp index 183c07c7ff..6d9190bbae 100644 --- a/src/drivers/magnetometer/qmc5883l/qmc5883l_main.cpp +++ b/src/drivers/magnetometer/qmc5883l/qmc5883l_main.cpp @@ -1,6 +1,6 @@ /**************************************************************************** * - * Copyright (c) 2020 PX4 Development Team. All rights reserved. + * Copyright (c) 2020, 2021 PX4 Development Team. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -72,15 +72,15 @@ extern "C" int qmc5883l_main(int argc, char *argv[]) BusCLIArguments cli{true, false}; cli.default_i2c_frequency = I2C_SPEED; - while ((ch = cli.getopt(argc, argv, "R:")) != EOF) { + while ((ch = cli.getOpt(argc, argv, "R:")) != EOF) { switch (ch) { case 'R': - cli.rotation = (enum Rotation)atoi(cli.optarg()); + cli.rotation = (enum Rotation)atoi(cli.optArg()); break; } } - const char *verb = cli.optarg(); + const char *verb = cli.optArg(); if (!verb) { ThisDriver::print_usage(); diff --git a/src/drivers/magnetometer/rm3100/rm3100_main.cpp b/src/drivers/magnetometer/rm3100/rm3100_main.cpp index 05e2e61a5a..884d19d732 100644 --- a/src/drivers/magnetometer/rm3100/rm3100_main.cpp +++ b/src/drivers/magnetometer/rm3100/rm3100_main.cpp @@ -1,6 +1,6 @@ /**************************************************************************** * - * Copyright (c) 2018 PX4 Development Team. All rights reserved. + * Copyright (c) 2018, 2021 PX4 Development Team. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -104,15 +104,15 @@ extern "C" int rm3100_main(int argc, char *argv[]) cli.default_i2c_frequency = 400000; cli.default_spi_frequency = 1 * 1000 * 1000; - while ((ch = cli.getopt(argc, argv, "R:")) != EOF) { + while ((ch = cli.getOpt(argc, argv, "R:")) != EOF) { switch (ch) { case 'R': - cli.rotation = (enum Rotation)atoi(cli.optarg()); + cli.rotation = (enum Rotation)atoi(cli.optArg()); break; } } - const char *verb = cli.optarg(); + const char *verb = cli.optArg(); if (!verb) { ThisDriver::print_usage(); diff --git a/src/drivers/magnetometer/vtrantech/vcm1193l/vcm1193l_main.cpp b/src/drivers/magnetometer/vtrantech/vcm1193l/vcm1193l_main.cpp index 71e1ada2c9..d99cbc8f72 100644 --- a/src/drivers/magnetometer/vtrantech/vcm1193l/vcm1193l_main.cpp +++ b/src/drivers/magnetometer/vtrantech/vcm1193l/vcm1193l_main.cpp @@ -71,15 +71,15 @@ extern "C" int vcm1193l_main(int argc, char *argv[]) BusCLIArguments cli{true, false}; cli.default_i2c_frequency = I2C_SPEED; - while ((ch = cli.getopt(argc, argv, "R:")) != EOF) { + while ((ch = cli.getOpt(argc, argv, "R:")) != EOF) { switch (ch) { case 'R': - cli.rotation = (enum Rotation)atoi(cli.optarg()); + cli.rotation = (enum Rotation)atoi(cli.optArg()); break; } } - const char *verb = cli.optarg(); + const char *verb = cli.optArg(); if (!verb) { ThisDriver::print_usage(); diff --git a/src/drivers/optical_flow/paw3902/paw3902_main.cpp b/src/drivers/optical_flow/paw3902/paw3902_main.cpp index 2500435624..0090ae4746 100644 --- a/src/drivers/optical_flow/paw3902/paw3902_main.cpp +++ b/src/drivers/optical_flow/paw3902/paw3902_main.cpp @@ -1,6 +1,6 @@ /**************************************************************************** * - * Copyright (c) 2019-2020 PX4 Development Team. All rights reserved. + * Copyright (c) 2019-2020, 2021 PX4 Development Team. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -77,15 +77,15 @@ extern "C" __EXPORT int paw3902_main(int argc, char *argv[]) cli.spi_mode = SPIDEV_MODE0; cli.default_spi_frequency = SPI_SPEED; - while ((ch = cli.getopt(argc, argv, "Y:")) != EOF) { + while ((ch = cli.getOpt(argc, argv, "Y:")) != EOF) { switch (ch) { case 'Y': - cli.custom1 = atoi(cli.optarg()); + cli.custom1 = atoi(cli.optArg()); break; } } - const char *verb = cli.optarg(); + const char *verb = cli.optArg(); if (!verb) { ThisDriver::print_usage(); diff --git a/src/drivers/optical_flow/pmw3901/pmw3901_main.cpp b/src/drivers/optical_flow/pmw3901/pmw3901_main.cpp index bc74095028..740781d02f 100644 --- a/src/drivers/optical_flow/pmw3901/pmw3901_main.cpp +++ b/src/drivers/optical_flow/pmw3901/pmw3901_main.cpp @@ -1,6 +1,6 @@ /**************************************************************************** * - * Copyright (c) 2018 PX4 Development Team. All rights reserved. + * Copyright (c) 2018, 2021 PX4 Development Team. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -74,15 +74,15 @@ pmw3901_main(int argc, char *argv[]) cli.spi_mode = SPIDEV_MODE0; cli.default_spi_frequency = PMW3901_SPI_BUS_SPEED; - while ((ch = cli.getopt(argc, argv, "R:")) != EOF) { + while ((ch = cli.getOpt(argc, argv, "R:")) != EOF) { switch (ch) { case 'R': - cli.rotation = (enum Rotation)atoi(cli.optarg()); + cli.rotation = (enum Rotation)atoi(cli.optArg()); break; } } - const char *verb = cli.optarg(); + const char *verb = cli.optArg(); if (!verb) { ThisDriver::print_usage(); diff --git a/src/drivers/optical_flow/px4flow/px4flow.cpp b/src/drivers/optical_flow/px4flow/px4flow.cpp index c1f9758edf..27ba1bdd9e 100644 --- a/src/drivers/optical_flow/px4flow/px4flow.cpp +++ b/src/drivers/optical_flow/px4flow/px4flow.cpp @@ -1,6 +1,6 @@ /**************************************************************************** * - * Copyright (c) 2013-2019 PX4 Development Team. All rights reserved. + * Copyright (c) 2013-2019, 2021 PX4 Development Team. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -411,15 +411,15 @@ px4flow_main(int argc, char *argv[]) cli.orientation = distance_sensor_s::ROTATION_DOWNWARD_FACING; cli.i2c_address = I2C_FLOW_ADDRESS_DEFAULT; - while ((ch = cli.getopt(argc, argv, "R:")) != EOF) { + while ((ch = cli.getOpt(argc, argv, "R:")) != EOF) { switch (ch) { case 'R': - cli.orientation = atoi(cli.optarg()); + cli.orientation = atoi(cli.optArg()); break; } } - const char *verb = cli.optarg(); + const char *verb = cli.optArg(); if (!verb) { ThisDriver::print_usage(); diff --git a/src/drivers/power_monitor/ina226/ina226_main.cpp b/src/drivers/power_monitor/ina226/ina226_main.cpp index 045a2568f5..69ea5f3836 100644 --- a/src/drivers/power_monitor/ina226/ina226_main.cpp +++ b/src/drivers/power_monitor/ina226/ina226_main.cpp @@ -1,4 +1,35 @@ - +/**************************************************************************** + * + * Copyright (C) 2021 PX4 Development Team. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * 3. Neither the name PX4 nor the names of its contributors may be + * used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + ****************************************************************************/ #include #include @@ -68,15 +99,15 @@ ina226_main(int argc, char *argv[]) cli.support_keep_running = true; cli.custom2 = 1; - while ((ch = cli.getopt(argc, argv, "t:")) != EOF) { + while ((ch = cli.getOpt(argc, argv, "t:")) != EOF) { switch (ch) { case 't': // battery index - cli.custom2 = (int)strtol(cli.optarg(), NULL, 0); + cli.custom2 = (int)strtol(cli.optArg(), NULL, 0); break; } } - const char *verb = cli.optarg(); + const char *verb = cli.optArg(); if (!verb) { ThisDriver::print_usage(); return -1; diff --git a/src/drivers/power_monitor/voxlpm/voxlpm_main.cpp b/src/drivers/power_monitor/voxlpm/voxlpm_main.cpp index 1d26cc2e62..f84cbb483f 100644 --- a/src/drivers/power_monitor/voxlpm/voxlpm_main.cpp +++ b/src/drivers/power_monitor/voxlpm/voxlpm_main.cpp @@ -1,6 +1,6 @@ /**************************************************************************** * - * Copyright (c) 2019 PX4 Development Team. All rights reserved. + * Copyright (c) 2019, 2021 PX4 Development Team. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -83,16 +83,16 @@ voxlpm_main(int argc, char *argv[]) cli.type = VOXLPM_CH_TYPE_VBATT; cli.support_keep_running = true; - while ((ch = cli.getopt(argc, argv, "T:")) != EOF) { + while ((ch = cli.getOpt(argc, argv, "T:")) != EOF) { switch (ch) { case 'T': - if (strcmp(cli.optarg(), "VBATT") == 0) { + if (strcmp(cli.optArg(), "VBATT") == 0) { cli.type = VOXLPM_CH_TYPE_VBATT; - } else if (strcmp(cli.optarg(), "P5VDC") == 0) { + } else if (strcmp(cli.optArg(), "P5VDC") == 0) { cli.type = VOXLPM_CH_TYPE_P5VDC; - } else if (strcmp(cli.optarg(), "P12VDC") == 0) { + } else if (strcmp(cli.optArg(), "P12VDC") == 0) { cli.type = VOXLPM_CH_TYPE_P12VDC; // same as P5VDC } else { @@ -104,7 +104,7 @@ voxlpm_main(int argc, char *argv[]) } } - const char *verb = cli.optarg(); + const char *verb = cli.optArg(); if (!verb) { ThisDriver::print_usage(); diff --git a/src/systemcmds/tests/test_i2c_spi_cli.cpp b/src/systemcmds/tests/test_i2c_spi_cli.cpp index 16199d0950..3e8d7e5c81 100644 --- a/src/systemcmds/tests/test_i2c_spi_cli.cpp +++ b/src/systemcmds/tests/test_i2c_spi_cli.cpp @@ -196,17 +196,17 @@ bool I2CSPICLITest::test_custom() int T = 0; int a = 0; - while ((ch = cli.getopt(cli_args.argc, cli_args.argv, "T:a:")) != EOF) { + while ((ch = cli.getOpt(cli_args.argc, cli_args.argv, "T:a:")) != EOF) { switch (ch) { - case 'T': T = atoi(cli.optarg()); + case 'T': T = atoi(cli.optArg()); break; - case 'a': a = atoi(cli.optarg()); + case 'a': a = atoi(cli.optArg()); break; } } - const char *verb = cli.optarg(); + const char *verb = cli.optArg(); ut_assert_true(verb != nullptr); ut_assert_true(strcmp(verb, "start") == 0); ut_assert_true(T == 432); @@ -222,14 +222,14 @@ bool I2CSPICLITest::test_custom() CLIArgsHelper cli_args(argv, 1); int ch; - while ((ch = cli.getopt(cli_args.argc, cli_args.argv, "I:")) != EOF) { + while ((ch = cli.getOpt(cli_args.argc, cli_args.argv, "I:")) != EOF) { switch (ch) { case 'I': ut_assert_true(false); // must not get here, because 'I' is already used break; } } - const char *verb = cli.optarg(); + const char *verb = cli.optArg(); ut_assert_true(verb == nullptr); } return true;