diff --git a/src/systemcmds/actuator_test/actuator_test.cpp b/src/systemcmds/actuator_test/actuator_test.cpp index 97d39c72fb23..7a4693139c79 100644 --- a/src/systemcmds/actuator_test/actuator_test.cpp +++ b/src/systemcmds/actuator_test/actuator_test.cpp @@ -70,11 +70,9 @@ static void usage(const char *reason) } PRINT_MODULE_DESCRIPTION( - R"DESCR_STR( -Utility to test actuators. - -WARNING: remove all props before using this command. -)DESCR_STR"); + "Utility to test actuators.\n" + "\n" + "WARNING: remove all props before using this command.\n"); PRINT_MODULE_USAGE_NAME("actuator_test", "command"); PRINT_MODULE_USAGE_COMMAND_DESCR("set", "Set an actuator to a specific output value"); @@ -122,6 +120,7 @@ int actuator_test_main(int argc, char *argv[]) usage("value invalid"); return 1; } + break; case 't': @@ -162,27 +161,33 @@ int actuator_test_main(int argc, char *argv[]) } actuator_test(function, NAN, 0, true); + } else { actuator_test(function, value, timeout_ms, false); } + return 0; } else if (strcmp("iterate-motors", argv[myoptind]) == 0) { value = 0.15f; + for (int i = 0; i < actuator_test_s::MAX_NUM_MOTORS; ++i) { - PX4_INFO("Motor %i (%.0f%%)", i, (double)(value*100.f)); - actuator_test(actuator_test_s::FUNCTION_MOTOR1+i, value, 400, false); + PX4_INFO("Motor %i (%.0f%%)", i, (double)(value * 100.f)); + actuator_test(actuator_test_s::FUNCTION_MOTOR1 + i, value, 400, false); px4_usleep(600000); } + return 0; } else if (strcmp("iterate-servos", argv[myoptind]) == 0) { value = 0.3f; + for (int i = 0; i < actuator_test_s::MAX_NUM_SERVOS; ++i) { - PX4_INFO("Servo %i (%.0f%%)", i, (double)(value*100.f)); - actuator_test(actuator_test_s::FUNCTION_SERVO1+i, value, 800, false); + PX4_INFO("Servo %i (%.0f%%)", i, (double)(value * 100.f)); + actuator_test(actuator_test_s::FUNCTION_SERVO1 + i, value, 800, false); px4_usleep(1000000); } + return 0; } } diff --git a/src/systemcmds/failure/failure.cpp b/src/systemcmds/failure/failure.cpp index 2b28aefde879..7116542ae8fd 100644 --- a/src/systemcmds/failure/failure.cpp +++ b/src/systemcmds/failure/failure.cpp @@ -88,18 +88,16 @@ static constexpr FailureType failure_types[] = { static void print_usage() { PRINT_MODULE_DESCRIPTION( - R"DESCR_STR( -### Description -Inject failures into system. - -### Implementation -This system command sends a vehicle command over uORB to trigger failure. - -### Examples -Test the GPS failsafe by stopping GPS: - -failure gps off -)DESCR_STR"); + "### Description\n" + "Inject failures into system.\n" + "\n" + "### Implementation\n" + "This system command sends a vehicle command over uORB to trigger failure.\n" + "\n" + "### Examples\n" + "Test the GPS failsafe by stopping GPS:\n" + "\n" + "failure gps off"); PRINT_MODULE_USAGE_NAME_SIMPLE("failure", "command"); PRINT_MODULE_USAGE_COMMAND_DESCR("help", "Show this help text"); @@ -108,19 +106,22 @@ failure gps off PRINT_MODULE_USAGE_PARAM_INT('i', 0, 0, 4, "sensor instance (0=all)", true); PX4_INFO_RAW("\nComponents:\n"); + for (const auto &failure_unit : failure_units) { PX4_INFO_RAW("- %s\n", failure_unit.key); } PX4_INFO_RAW("\nFailure types:\n"); + for (const auto &failure_type : failure_types) { PX4_INFO_RAW("- %s\n", failure_type.key); } } -int inject_failure(const FailureUnit& unit, const FailureType& type, uint8_t instance) +int inject_failure(const FailureUnit &unit, const FailureType &type, uint8_t instance) { - PX4_WARN("inject failure unit: %s (%d), type: %s (%d), instance: %d", unit.key, unit.value, type.key, type.value, instance); + PX4_WARN("inject failure unit: %s (%d), type: %s (%d), instance: %d", unit.key, unit.value, type.key, type.value, + instance); uORB::Subscription command_ack_sub{ORB_ID(vehicle_command_ack)}; diff --git a/src/systemcmds/i2c_launcher/i2c_launcher.cpp b/src/systemcmds/i2c_launcher/i2c_launcher.cpp index db8b52213218..d71e4811d81b 100644 --- a/src/systemcmds/i2c_launcher/i2c_launcher.cpp +++ b/src/systemcmds/i2c_launcher/i2c_launcher.cpp @@ -195,11 +195,9 @@ int I2CLauncher::print_usage(const char *reason) } PRINT_MODULE_DESCRIPTION( - R"DESCR_STR( -### Description -Daemon that starts drivers based on found I2C devices. - -)DESCR_STR"); + "### Description\n" + "Daemon that starts drivers based on found I2C devices.\n" + "\n"); PRINT_MODULE_USAGE_NAME("i2c_launcher", "system"); PRINT_MODULE_USAGE_COMMAND("start"); @@ -213,7 +211,7 @@ extern "C" __EXPORT int i2c_launcher_main(int argc, char *argv[]) { using ThisDriver = I2CLauncher; - static I2CLauncher* instances[I2C_BUS_MAX_BUS_ITEMS]; + static I2CLauncher *instances[I2C_BUS_MAX_BUS_ITEMS]; int bus = -1; int myoptind = 1; int ch;