diff options
author | Lorenz Meier <lm@qgroundcontrol.org> | 2014-11-13 10:24:26 +0100 |
---|---|---|
committer | Lorenz Meier <lm@qgroundcontrol.org> | 2014-11-13 10:24:26 +0100 |
commit | df40637987e0434d7a03d9bc9e9803776cb81785 (patch) | |
tree | 0a54d0d4d2050fe872f9d6e0cc911778e6cd54c1 /src/systemcmds | |
parent | 2f3ffdd50847a6f7b1796e54c9588dd596e55f2f (diff) | |
parent | a18460183cdfa590af29c2299acb30206b418cb1 (diff) | |
download | px4-firmware-df40637987e0434d7a03d9bc9e9803776cb81785.tar.gz px4-firmware-df40637987e0434d7a03d9bc9e9803776cb81785.tar.bz2 px4-firmware-df40637987e0434d7a03d9bc9e9803776cb81785.zip |
Merge pull request #1427 from hsteinhaus/drive_testing
motor_test: cleanup
Diffstat (limited to 'src/systemcmds')
-rw-r--r-- | src/systemcmds/motor_test/motor_test.c | 23 |
1 files changed, 12 insertions, 11 deletions
diff --git a/src/systemcmds/motor_test/motor_test.c b/src/systemcmds/motor_test/motor_test.c index 079f99674..a73f46626 100644 --- a/src/systemcmds/motor_test/motor_test.c +++ b/src/systemcmds/motor_test/motor_test.c @@ -54,7 +54,8 @@ #include "systemlib/err.h" -__EXPORT int motor_test_main(int argc, char *argv[]); +__EXPORT int motor_test_main(int argc, char *argv[]); + static void motor_test(unsigned channel, float value); static void usage(const char *reason); @@ -67,13 +68,13 @@ void motor_test(unsigned channel, float value) _test_motor.timestamp = hrt_absolute_time(); _test_motor.value = value; - if (_test_motor_pub > 0) { - /* publish armed state */ - orb_publish(ORB_ID(test_motor), _test_motor_pub, &_test_motor); - } else { - /* advertise and publish */ - _test_motor_pub = orb_advertise(ORB_ID(test_motor), &_test_motor); - } + if (_test_motor_pub > 0) { + /* publish test state */ + orb_publish(ORB_ID(test_motor), _test_motor_pub, &_test_motor); + } else { + /* advertise and publish */ + _test_motor_pub = orb_advertise(ORB_ID(test_motor), &_test_motor); + } } static void usage(const char *reason) @@ -102,18 +103,18 @@ int motor_test_main(int argc, char *argv[]) switch (ch) { case 'm': - /* Read in channels supplied as one int and convert to mask: 1234 -> 0xF */ + /* Read in motor number */ channel = strtoul(optarg, NULL, 0); break; case 'p': - /* Read in custom low value */ + /* Read in power value */ lval = strtoul(optarg, NULL, 0); if (lval > 100) usage("value invalid"); - value = (float)lval/100.f; + value = ((float)lval)/100.f; break; default: usage(NULL); |