mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-18 04:03:35 +08:00
systemcmds: convert c -> c++
This commit is contained in:
@@ -37,5 +37,5 @@ px4_add_module(
|
||||
COMPILE_FLAGS
|
||||
-Wno-cast-align # TODO: fix and enable
|
||||
SRCS
|
||||
bl_update.c
|
||||
bl_update.cpp
|
||||
)
|
||||
|
||||
@@ -66,8 +66,6 @@
|
||||
# define STM_RAM_BASE STM32_SRAM_BASE
|
||||
#endif
|
||||
|
||||
__EXPORT int bl_update_main(int argc, char *argv[]);
|
||||
|
||||
#if defined (CONFIG_STM32_STM32F4XXX) || defined (CONFIG_ARCH_CHIP_STM32F7) || \
|
||||
defined (CONFIG_ARCH_CHIP_STM32H7)
|
||||
|
||||
@@ -90,8 +88,7 @@ static void print_usage(const char *reason)
|
||||
#endif // defined (CONFIG_STM32_STM32F4XXX) || defined (CONFIG_ARCH_CHIP_STM32F7)
|
||||
|
||||
|
||||
int
|
||||
bl_update_main(int argc, char *argv[])
|
||||
extern "C" __EXPORT int bl_update_main(int argc, char *argv[])
|
||||
{
|
||||
#if !(defined (CONFIG_STM32_STM32F4XXX) || defined (CONFIG_ARCH_CHIP_STM32F7) \
|
||||
|| defined (CONFIG_ARCH_CHIP_STM32H7))
|
||||
@@ -144,9 +141,9 @@ bl_update_main(int argc, char *argv[])
|
||||
image_size = (file_size + page_size) & ~page_size;
|
||||
#endif
|
||||
|
||||
uint8_t *buf = malloc(image_size);
|
||||
uint8_t *buf = (uint8_t *)malloc(image_size);
|
||||
|
||||
if (buf == NULL)
|
||||
if (buf == nullptr)
|
||||
{
|
||||
PX4_ERR("failed to allocate %jd bytes for firmware buffer", (intmax_t) file_size);
|
||||
close(fd);
|
||||
@@ -36,7 +36,7 @@ px4_add_module(
|
||||
STACK_MAIN 4096
|
||||
COMPILE_FLAGS
|
||||
SRCS
|
||||
dumpfile.c
|
||||
dumpfile.cpp
|
||||
DEPENDS
|
||||
)
|
||||
|
||||
|
||||
@@ -49,19 +49,15 @@
|
||||
|
||||
#include <systemlib/err.h>
|
||||
|
||||
__EXPORT int dumpfile_main(int argc, char *argv[]);
|
||||
|
||||
static void print_usage(void)
|
||||
static void print_usage()
|
||||
{
|
||||
PRINT_MODULE_DESCRIPTION("Dump file utility. Prints file size and contents in binary mode (don't replace LF with CR LF) to stdout.");
|
||||
|
||||
PRINT_MODULE_USAGE_NAME_SIMPLE("dumpfile", "command");
|
||||
PRINT_MODULE_USAGE_ARG("<file>", "File to dump", false);
|
||||
|
||||
}
|
||||
|
||||
int
|
||||
dumpfile_main(int argc, char *argv[])
|
||||
extern "C" __EXPORT int dumpfile_main(int argc, char *argv[])
|
||||
{
|
||||
if (argc < 2) {
|
||||
print_usage();
|
||||
@@ -72,7 +68,7 @@ dumpfile_main(int argc, char *argv[])
|
||||
FILE *f;
|
||||
f = fopen(argv[1], "r");
|
||||
|
||||
if (f == NULL) {
|
||||
if (f == nullptr) {
|
||||
PX4_ERR("Failed to open file (%i)", errno);
|
||||
return 1;
|
||||
}
|
||||
@@ -36,7 +36,7 @@ px4_add_module(
|
||||
STACK_MAIN 4096
|
||||
COMPILE_FLAGS
|
||||
SRCS
|
||||
esc_calib.c
|
||||
esc_calib.cpp
|
||||
DEPENDS
|
||||
)
|
||||
|
||||
|
||||
@@ -53,19 +53,13 @@
|
||||
#include <sys/ioctl.h>
|
||||
#include <sys/stat.h>
|
||||
|
||||
|
||||
|
||||
#include "drivers/drv_pwm_output.h"
|
||||
|
||||
#include <uORB/topics/actuator_controls.h>
|
||||
|
||||
static void usage(const char *reason);
|
||||
__EXPORT int esc_calib_main(int argc, char *argv[]);
|
||||
|
||||
static void
|
||||
usage(const char *reason)
|
||||
static void usage(const char *reason)
|
||||
{
|
||||
if (reason != NULL) {
|
||||
if (reason != nullptr) {
|
||||
PX4_ERR("%s", reason);
|
||||
}
|
||||
|
||||
@@ -82,14 +76,13 @@ usage(const char *reason)
|
||||
PRINT_MODULE_USAGE_PARAM_STRING('d', "/dev/pwm_output0", "<file:dev>", "Select PWM output device", true);
|
||||
PRINT_MODULE_USAGE_PARAM_INT('l', 1000, 0, 3000, "Low PWM value in us", true);
|
||||
PRINT_MODULE_USAGE_PARAM_INT('h', 2000, 0, 3000, "High PWM value in us", true);
|
||||
PRINT_MODULE_USAGE_PARAM_STRING('c', NULL, NULL, "select channels in the form: 1234 (1 digit per channel, 1=first)",
|
||||
true);
|
||||
PRINT_MODULE_USAGE_PARAM_STRING('c', nullptr, nullptr,
|
||||
"select channels in the form: 1234 (1 digit per channel, 1=first)", true);
|
||||
PRINT_MODULE_USAGE_PARAM_INT('m', -1, 0, 4096, "Select channels via bitmask (eg. 0xF, 3)", true);
|
||||
PRINT_MODULE_USAGE_PARAM_FLAG('a', "Select all channels", true);
|
||||
}
|
||||
|
||||
int
|
||||
esc_calib_main(int argc, char *argv[])
|
||||
extern "C" __EXPORT int esc_calib_main(int argc, char *argv[])
|
||||
{
|
||||
const char *dev = PWM_OUTPUT0_DEVICE_PATH;
|
||||
char *ep;
|
||||
@@ -116,7 +109,7 @@ esc_calib_main(int argc, char *argv[])
|
||||
}
|
||||
|
||||
int myoptind = 1;
|
||||
const char *myoptarg = NULL;
|
||||
const char *myoptarg = nullptr;
|
||||
|
||||
while ((ch = px4_getopt(argc, argv, "d:c:m:al:h:", &myoptind, &myoptarg)) != EOF) {
|
||||
switch (ch) {
|
||||
@@ -184,7 +177,7 @@ esc_calib_main(int argc, char *argv[])
|
||||
break;
|
||||
|
||||
default:
|
||||
usage(NULL);
|
||||
usage(nullptr);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
@@ -201,10 +194,10 @@ esc_calib_main(int argc, char *argv[])
|
||||
|
||||
/* make sure no other source is publishing control values now */
|
||||
struct actuator_controls_s actuators;
|
||||
int act_sub = orb_subscribe(ORB_ID_VEHICLE_ATTITUDE_CONTROLS);
|
||||
int act_sub = orb_subscribe(ORB_ID(actuator_controls_0));
|
||||
|
||||
/* clear changed flag */
|
||||
orb_copy(ORB_ID_VEHICLE_ATTITUDE_CONTROLS, act_sub, &actuators);
|
||||
orb_copy(ORB_ID(actuator_controls_0), act_sub, &actuators);
|
||||
|
||||
/* wait 50 ms */
|
||||
px4_usleep(50000);
|
||||
@@ -71,14 +71,12 @@
|
||||
|
||||
#include <board_config.h>
|
||||
|
||||
extern "C" __EXPORT int mft_main(int argc, char *argv[]);
|
||||
|
||||
static int mft_status(void)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void print_usage(void)
|
||||
static void print_usage()
|
||||
{
|
||||
PRINT_MODULE_DESCRIPTION("Utility interact with the manifest");
|
||||
|
||||
@@ -86,9 +84,7 @@ static void print_usage(void)
|
||||
PRINT_MODULE_USAGE_COMMAND_DESCR("query", "Returns true if not existed");
|
||||
}
|
||||
|
||||
|
||||
|
||||
int mft_main(int argc, char *argv[])
|
||||
extern "C" __EXPORT int mft_main(int argc, char *argv[])
|
||||
{
|
||||
static const char *keys[] = PX4_MFT_STR_TYPES;
|
||||
static const px4_manifest_types_e types[] = PX4_MFT_TYPES;
|
||||
|
||||
@@ -69,7 +69,7 @@ const struct {
|
||||
{"microbench_matrix", test_microbench_matrix, 0},
|
||||
{"microbench_uorb", test_microbench_uorb, 0},
|
||||
|
||||
{NULL, NULL, 0}
|
||||
{nullptr, nullptr, 0}
|
||||
};
|
||||
|
||||
#define NMICROBENCHMARKS (sizeof(microbenchmarks) / sizeof(microbenchmarks[0]))
|
||||
@@ -93,7 +93,7 @@ static int microbench_all(int argc, char *argv[])
|
||||
static int microbench_runner(unsigned option)
|
||||
{
|
||||
size_t i;
|
||||
char *args[2] = {"all", NULL};
|
||||
char *args[2] = {"all", nullptr};
|
||||
unsigned int failcount = 0;
|
||||
unsigned int testcount = 0;
|
||||
unsigned int passed[NMICROBENCHMARKS];
|
||||
|
||||
@@ -313,10 +313,10 @@ int prepare(int fd, unsigned long *max_channels)
|
||||
{
|
||||
/* make sure no other source is publishing control values now */
|
||||
struct actuator_controls_s actuators;
|
||||
int act_sub = orb_subscribe(ORB_ID_VEHICLE_ATTITUDE_CONTROLS);
|
||||
int act_sub = orb_subscribe(ORB_ID(actuator_controls_0));
|
||||
|
||||
/* clear changed flag */
|
||||
orb_copy(ORB_ID_VEHICLE_ATTITUDE_CONTROLS, act_sub, &actuators);
|
||||
orb_copy(ORB_ID(actuator_controls_0), act_sub, &actuators);
|
||||
|
||||
/* wait 50 ms */
|
||||
px4_usleep(50000);
|
||||
|
||||
@@ -135,7 +135,7 @@ static int mtd_status(void)
|
||||
return ret;
|
||||
}
|
||||
|
||||
static void print_usage(void)
|
||||
static void print_usage()
|
||||
{
|
||||
#if !defined(CONSTRAINED_FLASH)
|
||||
|
||||
@@ -304,7 +304,7 @@ int mtd_rwtest(const mtd_instance_s &instance)
|
||||
int mtd_main(int argc, char *argv[])
|
||||
{
|
||||
int myoptind = 1;
|
||||
const char *myoptarg = NULL;
|
||||
const char *myoptarg = nullptr;
|
||||
int ch;
|
||||
int instance = 0;
|
||||
|
||||
|
||||
@@ -36,7 +36,7 @@ px4_add_module(
|
||||
PRIORITY "SCHED_PRIORITY_DEFAULT-30"
|
||||
COMPILE_FLAGS
|
||||
SRCS
|
||||
nshterm.c
|
||||
nshterm.cpp
|
||||
DEPENDS
|
||||
)
|
||||
|
||||
|
||||
@@ -50,9 +50,7 @@
|
||||
#include <systemlib/err.h>
|
||||
#include <drivers/drv_hrt.h>
|
||||
|
||||
__EXPORT int nshterm_main(int argc, char *argv[]);
|
||||
|
||||
static void print_usage(void)
|
||||
static void print_usage()
|
||||
{
|
||||
PRINT_MODULE_DESCRIPTION("Start an NSH shell on a given port.\n"
|
||||
"\n"
|
||||
@@ -64,7 +62,7 @@ static void print_usage(void)
|
||||
PRINT_MODULE_USAGE_ARG("<file:dev>", "Device on which to start the shell (eg. /dev/ttyACM0)", false);
|
||||
}
|
||||
|
||||
int nshterm_main(int argc, char *argv[])
|
||||
extern "C" __EXPORT int nshterm_main(int argc, char *argv[])
|
||||
{
|
||||
if (argc < 2) {
|
||||
print_usage();
|
||||
@@ -102,7 +100,7 @@ int nshterm_main(int argc, char *argv[])
|
||||
dup2(fd, 1);
|
||||
dup2(fd, 2);
|
||||
|
||||
nsh_consolemain(0, NULL);
|
||||
nsh_consolemain(0, nullptr);
|
||||
|
||||
close(fd);
|
||||
|
||||
@@ -35,7 +35,7 @@ px4_add_module(
|
||||
MAIN perf
|
||||
COMPILE_FLAGS
|
||||
SRCS
|
||||
perf.c
|
||||
perf.cpp
|
||||
DEPENDS
|
||||
perf
|
||||
)
|
||||
|
||||
@@ -39,12 +39,9 @@
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <perf/perf_counter.h>
|
||||
#include <lib/perf/perf_counter.h>
|
||||
|
||||
__EXPORT int perf_main(int argc, char *argv[]);
|
||||
|
||||
|
||||
static void print_usage(void)
|
||||
static void print_usage()
|
||||
{
|
||||
PRINT_MODULE_DESCRIPTION("Tool to print performance counters");
|
||||
|
||||
@@ -55,8 +52,7 @@ static void print_usage(void)
|
||||
PRINT_MODULE_USAGE_PARAM_COMMENT("Prints all performance counters if no arguments given");
|
||||
}
|
||||
|
||||
|
||||
int perf_main(int argc, char *argv[])
|
||||
extern "C" __EXPORT int perf_main(int argc, char *argv[])
|
||||
{
|
||||
if (argc > 1) {
|
||||
if (strcmp(argv[1], "reset") == 0) {
|
||||
@@ -77,5 +73,3 @@ int perf_main(int argc, char *argv[])
|
||||
fflush(stdout);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -35,7 +35,7 @@ px4_add_module(
|
||||
MAIN sd_bench
|
||||
COMPILE_FLAGS
|
||||
SRCS
|
||||
sd_bench.c
|
||||
sd_bench.cpp
|
||||
DEPENDS
|
||||
)
|
||||
|
||||
|
||||
@@ -58,8 +58,6 @@ typedef struct sdb_config {
|
||||
unsigned int total_blocks_written;
|
||||
} sdb_config_t;
|
||||
|
||||
static void usage(void);
|
||||
|
||||
/** sequential write speed test */
|
||||
static void write_test(int fd, sdb_config_t *cfg, uint8_t *block, int block_size);
|
||||
/** sequential read speed test */
|
||||
@@ -72,12 +70,9 @@ static int read_test(int fd, sdb_config_t *cfg, uint8_t *block, int block_size);
|
||||
*/
|
||||
static inline unsigned int time_fsync(int fd);
|
||||
|
||||
__EXPORT int sd_bench_main(int argc, char *argv[]);
|
||||
|
||||
static const char *BENCHMARK_FILE = PX4_STORAGEDIR"/benchmark.tmp";
|
||||
|
||||
static void
|
||||
usage()
|
||||
static void usage()
|
||||
{
|
||||
PRINT_MODULE_DESCRIPTION("Test the speed of an SD Card");
|
||||
|
||||
@@ -91,34 +86,33 @@ usage()
|
||||
PRINT_MODULE_USAGE_PARAM_FLAG('v', "Verify data and block number", true);
|
||||
}
|
||||
|
||||
int
|
||||
sd_bench_main(int argc, char *argv[])
|
||||
extern "C" __EXPORT int sd_bench_main(int argc, char *argv[])
|
||||
{
|
||||
int block_size = 4096;
|
||||
bool verify = false;
|
||||
bool keep = false;
|
||||
int myoptind = 1;
|
||||
int ch;
|
||||
const char *myoptarg = NULL;
|
||||
const char *myoptarg = nullptr;
|
||||
sdb_config_t cfg;
|
||||
cfg.synchronized = false;
|
||||
cfg.num_runs = 5;
|
||||
cfg.run_duration = 2000;
|
||||
cfg.aligned = true;
|
||||
uint8_t *block = NULL;
|
||||
uint8_t *block = nullptr;
|
||||
|
||||
while ((ch = px4_getopt(argc, argv, "b:r:d:ksuv", &myoptind, &myoptarg)) != EOF) {
|
||||
switch (ch) {
|
||||
case 'b':
|
||||
block_size = strtol(myoptarg, NULL, 0);
|
||||
block_size = strtol(myoptarg, nullptr, 0);
|
||||
break;
|
||||
|
||||
case 'r':
|
||||
cfg.num_runs = strtol(myoptarg, NULL, 0);
|
||||
cfg.num_runs = strtol(myoptarg, nullptr, 0);
|
||||
break;
|
||||
|
||||
case 'd':
|
||||
cfg.run_duration = strtol(myoptarg, NULL, 0);
|
||||
cfg.run_duration = strtol(myoptarg, nullptr, 0);
|
||||
break;
|
||||
|
||||
case 'k':
|
||||
@@ -259,7 +253,7 @@ void write_test(int fd, sdb_config_t *cfg, uint8_t *block, int block_size)
|
||||
|
||||
int read_test(int fd, sdb_config_t *cfg, uint8_t *block, int block_size)
|
||||
{
|
||||
uint8_t *read_block = NULL;
|
||||
uint8_t *read_block = nullptr;
|
||||
|
||||
PX4_INFO("");
|
||||
PX4_INFO("Testing Sequential Read Speed of %d blocks", cfg->total_blocks_written);
|
||||
@@ -35,6 +35,6 @@ px4_add_module(
|
||||
MAIN sd_stress
|
||||
COMPILE_FLAGS
|
||||
SRCS
|
||||
sd_stress.c
|
||||
sd_stress.cpp
|
||||
DEPENDS
|
||||
)
|
||||
|
||||
@@ -49,16 +49,13 @@
|
||||
|
||||
#include <drivers/drv_hrt.h>
|
||||
|
||||
|
||||
static const unsigned MAX_PATH_LEN = 52;
|
||||
|
||||
static const char *TEMPDIR = PX4_STORAGEDIR"/stress";
|
||||
static const char *TEMPDIR2 = PX4_STORAGEDIR"/moved";
|
||||
static const char *TEMPFILE = "tmp";
|
||||
|
||||
|
||||
static void
|
||||
usage(void)
|
||||
static void usage()
|
||||
{
|
||||
PRINT_MODULE_DESCRIPTION("Test operations on an SD Card");
|
||||
|
||||
@@ -175,23 +172,22 @@ static bool rename_dir(const char *old_dir, const char *new_dir)
|
||||
return true;
|
||||
}
|
||||
|
||||
int
|
||||
sd_stress_main(int argc, char *argv[])
|
||||
extern "C" __EXPORT int sd_stress_main(int argc, char *argv[])
|
||||
{
|
||||
int myoptind = 1;
|
||||
int ch;
|
||||
const char *myoptarg = NULL;
|
||||
const char *myoptarg = nullptr;
|
||||
unsigned num_runs = 5;
|
||||
unsigned num_bytes = 100;
|
||||
|
||||
while ((ch = px4_getopt(argc, argv, "r:b:", &myoptind, &myoptarg)) != EOF) {
|
||||
switch (ch) {
|
||||
case 'r':
|
||||
num_runs = strtol(myoptarg, NULL, 0);
|
||||
num_runs = strtol(myoptarg, nullptr, 0);
|
||||
break;
|
||||
|
||||
case 'b':
|
||||
num_bytes = strtol(myoptarg, NULL, 0);
|
||||
num_bytes = strtol(myoptarg, nullptr, 0);
|
||||
break;
|
||||
|
||||
default:
|
||||
@@ -55,8 +55,8 @@ set(srcs
|
||||
test_parameters.cpp
|
||||
test_perf.c
|
||||
test_ppm.cpp
|
||||
test_ppm_loopback.c
|
||||
test_rc.c
|
||||
test_ppm_loopback.cpp
|
||||
test_rc.cpp
|
||||
test_search_min.cpp
|
||||
test_sleep.c
|
||||
test_uart_baudchange.c
|
||||
|
||||
@@ -80,7 +80,7 @@ int test_mount(int argc, char *argv[])
|
||||
|
||||
if (d) {
|
||||
|
||||
while ((dir = readdir(d)) != NULL) {
|
||||
while ((dir = readdir(d)) != nullptr) {
|
||||
//printf("%s\n", dir->d_name);
|
||||
}
|
||||
|
||||
|
||||
+2
-2
@@ -32,7 +32,7 @@
|
||||
****************************************************************************/
|
||||
|
||||
/**
|
||||
* @file test_ppm_loopback.c
|
||||
* @file test_ppm_loopback.cpp
|
||||
* Tests the PWM outputs and PPM input
|
||||
*/
|
||||
|
||||
@@ -120,7 +120,7 @@ int test_ppm_loopback(int argc, char *argv[])
|
||||
|
||||
warnx("servo count: %d", servo_count);
|
||||
|
||||
struct pwm_output_values pwm_out = {.values = {0}, .channel_count = 0};
|
||||
pwm_output_values pwm_out{};
|
||||
|
||||
for (unsigned i = 0; (i < servo_count) && (i < sizeof(pwm_values) / sizeof(pwm_values[0])); i++) {
|
||||
pwm_out.values[i] = pwm_values[i];
|
||||
@@ -32,7 +32,7 @@
|
||||
****************************************************************************/
|
||||
|
||||
/**
|
||||
* @file test_rc.c
|
||||
* @file test_rc.cpp
|
||||
* Tests RC input.
|
||||
*/
|
||||
|
||||
@@ -52,7 +52,7 @@
|
||||
#include <drivers/drv_hrt.h>
|
||||
#include <px4_platform_common/module.h>
|
||||
|
||||
static void print_usage(void)
|
||||
static void print_usage()
|
||||
{
|
||||
PRINT_MODULE_DESCRIPTION("Monitor running processes and their CPU, stack usage, priority and state");
|
||||
|
||||
|
||||
@@ -35,7 +35,7 @@ px4_add_module(
|
||||
MAIN usb_connected
|
||||
COMPILE_FLAGS
|
||||
SRCS
|
||||
usb_connected.c
|
||||
usb_connected.cpp
|
||||
DEPENDS
|
||||
)
|
||||
|
||||
|
||||
+3
-7
@@ -32,7 +32,7 @@
|
||||
****************************************************************************/
|
||||
|
||||
/**
|
||||
* @file usb_connected.c
|
||||
* @file usb_connected.cpp
|
||||
*
|
||||
* @author Andrew Tridgell
|
||||
*/
|
||||
@@ -45,11 +45,8 @@
|
||||
|
||||
#include <board_config.h>
|
||||
|
||||
__EXPORT int usb_connected_main(int argc, char *argv[]);
|
||||
|
||||
static void print_usage(void)
|
||||
static void print_usage()
|
||||
{
|
||||
|
||||
PRINT_MODULE_DESCRIPTION("Utility to check if USB is connected. Was previously used in startup scripts.\n"
|
||||
"A return value of 0 means USB is connected, 1 otherwise."
|
||||
);
|
||||
@@ -57,8 +54,7 @@ static void print_usage(void)
|
||||
PRINT_MODULE_USAGE_NAME_SIMPLE("usb_connected", "command");
|
||||
}
|
||||
|
||||
int
|
||||
usb_connected_main(int argc, char *argv[])
|
||||
extern "C" __EXPORT int usb_connected_main(int argc, char *argv[])
|
||||
{
|
||||
if (argc > 1) {
|
||||
print_usage();
|
||||
@@ -35,7 +35,7 @@ px4_add_module(
|
||||
MAIN ver
|
||||
COMPILE_FLAGS
|
||||
SRCS
|
||||
ver.c
|
||||
ver.cpp
|
||||
DEPENDS
|
||||
version
|
||||
)
|
||||
|
||||
@@ -61,7 +61,7 @@ static const char px4_guid_str[] = "px4guid";
|
||||
|
||||
static void usage(const char *reason)
|
||||
{
|
||||
if (reason != NULL) {
|
||||
if (reason != nullptr) {
|
||||
printf("%s\n\n", reason);
|
||||
}
|
||||
|
||||
@@ -86,19 +86,17 @@ static void usage(const char *reason)
|
||||
"Hardware type to compare against (eg. V2). An OR comparison is used if multiple are specified", false);
|
||||
}
|
||||
|
||||
__EXPORT int ver_main(int argc, char *argv[]);
|
||||
|
||||
int ver_main(int argc, char *argv[])
|
||||
extern "C" __EXPORT int ver_main(int argc, char *argv[])
|
||||
{
|
||||
/* defaults to an error */
|
||||
int ret = 1;
|
||||
|
||||
/* first check if there are at least 2 params */
|
||||
if (argc >= 2) {
|
||||
if (argv[1] != NULL) {
|
||||
if (argv[1] != nullptr) {
|
||||
|
||||
if (!strncmp(argv[1], sz_ver_hwcmp_str, sizeof(sz_ver_hwcmp_str))) {
|
||||
if (argc >= 3 && argv[2] != NULL) {
|
||||
if (argc >= 3 && argv[2] != nullptr) {
|
||||
const char *board_name = px4_board_name();
|
||||
|
||||
for (int i = 2; i < argc; ++i) {
|
||||
@@ -115,7 +113,7 @@ int ver_main(int argc, char *argv[])
|
||||
}
|
||||
|
||||
if (!strncmp(argv[1], sz_ver_hwtypecmp_str, sizeof(sz_ver_hwtypecmp_str))) {
|
||||
if (argc >= 3 && argv[2] != NULL) {
|
||||
if (argc >= 3 && argv[2] != nullptr) {
|
||||
const char *board_type = px4_board_sub_type();
|
||||
|
||||
for (int i = 2; i < argc; ++i) {
|
||||
@@ -238,8 +236,8 @@ int ver_main(int argc, char *argv[])
|
||||
if (show_all || !strncmp(argv[1], mcu_ver_str, sizeof(mcu_ver_str))) {
|
||||
|
||||
char rev = ' ';
|
||||
const char *revstr = NULL;
|
||||
const char *errata = NULL;
|
||||
const char *revstr = nullptr;
|
||||
const char *errata = nullptr;
|
||||
|
||||
int chip_version = board_mcu_version(&rev, &revstr, &errata);
|
||||
|
||||
@@ -249,7 +247,7 @@ int ver_main(int argc, char *argv[])
|
||||
} else {
|
||||
printf("MCU: %s, rev. %c\n", revstr, rev);
|
||||
|
||||
if (errata != NULL) {
|
||||
if (errata != nullptr) {
|
||||
printf("\nWARNING WARNING WARNING!\n"
|
||||
"Revision %c has a silicon errata:\n"
|
||||
"%s"
|
||||
Reference in New Issue
Block a user