From 7527026b8934505633a495a31d6d899a4e05d867 Mon Sep 17 00:00:00 2001 From: Daniel Agar Date: Sat, 5 Sep 2015 12:21:11 -0400 Subject: [PATCH] format src/systemcmds/motor_test --- src/systemcmds/motor_test/motor_test.c | 29 ++++++++++++++------------ 1 file changed, 16 insertions(+), 13 deletions(-) diff --git a/src/systemcmds/motor_test/motor_test.c b/src/systemcmds/motor_test/motor_test.c index 2108b2004e..3581c2004b 100644 --- a/src/systemcmds/motor_test/motor_test.c +++ b/src/systemcmds/motor_test/motor_test.c @@ -69,13 +69,14 @@ void motor_test(unsigned channel, float value) _test_motor.timestamp = hrt_absolute_time(); _test_motor.value = value; - if (_test_motor_pub != nullptr) { - /* 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); - } + if (_test_motor_pub != nullptr) { + /* 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) @@ -85,10 +86,10 @@ static void usage(const char *reason) } errx(1, - "usage:\n" - "motor_test\n" - " -m Motor to test (0..7)\n" - " -p Power (0..100)\n"); + "usage:\n" + "motor_test\n" + " -m Motor to test (0..7)\n" + " -p Power (0..100)\n"); } int motor_test_main(int argc, char *argv[]) @@ -114,11 +115,13 @@ int motor_test_main(int argc, char *argv[]) /* Read in power value */ lval = strtoul(optarg, NULL, 0); - if (lval > 100) + if (lval > 100) { usage("value invalid"); + } - value = ((float)lval)/100.f; + value = ((float)lval) / 100.f; break; + default: usage(NULL); }