mirror of
https://github.com/PX4/PX4-Autopilot.git
synced 2026-05-31 18:47:21 +08:00
motor_test: Use 1-based motor indexing.
Motors in Px4 ecosystem are indexed using 1-based indexing (Airframe reference, dshot command, etc.) motor_test command is 0-based. This PR changes motor_test to use 1-based indexing. This PR refers to Github issue #15721.
This commit is contained in:
@@ -68,7 +68,8 @@ void motor_test(unsigned channel, float value, uint8_t driver_instance, int time
|
|||||||
PX4_INFO("motors stop command sent");
|
PX4_INFO("motors stop command sent");
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
PX4_INFO("motor %d set to %.2f", channel, (double)value);
|
/* Adjust for 1-based motor indexing */
|
||||||
|
PX4_INFO("motor %d set to %.2f", channel + 1, (double)value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -87,7 +88,7 @@ WARNING: remove all props before using this command.
|
|||||||
|
|
||||||
PRINT_MODULE_USAGE_NAME("motor_test", "command");
|
PRINT_MODULE_USAGE_NAME("motor_test", "command");
|
||||||
PRINT_MODULE_USAGE_COMMAND_DESCR("test", "Set motor(s) to a specific output value");
|
PRINT_MODULE_USAGE_COMMAND_DESCR("test", "Set motor(s) to a specific output value");
|
||||||
PRINT_MODULE_USAGE_PARAM_INT('m', -1, 0, 7, "Motor to test (0...7, all if not specified)", true);
|
PRINT_MODULE_USAGE_PARAM_INT('m', -1, 1, 8, "Motor to test (1...8, all if not specified)", true);
|
||||||
PRINT_MODULE_USAGE_PARAM_INT('p', 0, 0, 100, "Power (0...100)", true);
|
PRINT_MODULE_USAGE_PARAM_INT('p', 0, 0, 100, "Power (0...100)", true);
|
||||||
PRINT_MODULE_USAGE_PARAM_INT('t', 0, 0, 100, "Timeout in seconds (default=no timeout)", true);
|
PRINT_MODULE_USAGE_PARAM_INT('t', 0, 0, 100, "Timeout in seconds (default=no timeout)", true);
|
||||||
PRINT_MODULE_USAGE_PARAM_INT('i', 0, 0, 4, "driver instance", true);
|
PRINT_MODULE_USAGE_PARAM_INT('i', 0, 0, 4, "driver instance", true);
|
||||||
@@ -116,8 +117,8 @@ int motor_test_main(int argc, char *argv[])
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case 'm':
|
case 'm':
|
||||||
/* Read in motor number */
|
/* Read in motor number and adjust for 1-based indexing */
|
||||||
channel = (int)strtol(myoptarg, nullptr, 0);
|
channel = (int)strtol(myoptarg, nullptr, 0) - 1;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'p':
|
case 'p':
|
||||||
|
|||||||
Reference in New Issue
Block a user