aboutsummaryrefslogtreecommitdiff
path: root/src/systemcmds
diff options
context:
space:
mode:
authorHolger Steinhaus <holger@steinhaus-home.de>2014-11-12 09:52:35 +0100
committerHolger Steinhaus <holger@steinhaus-home.de>2014-11-12 10:10:37 +0100
commit7bc9a6257731a741ff309f060f6cf87c33c4a266 (patch)
tree19227893b21942457baedf18b898d6b43cfed0ca /src/systemcmds
parent0800fa4715994921b6a0d15cd2c44b9e51417117 (diff)
downloadpx4-firmware-7bc9a6257731a741ff309f060f6cf87c33c4a266.tar.gz
px4-firmware-7bc9a6257731a741ff309f060f6cf87c33c4a266.tar.bz2
px4-firmware-7bc9a6257731a741ff309f060f6cf87c33c4a266.zip
code style, warnings
Diffstat (limited to 'src/systemcmds')
-rw-r--r--src/systemcmds/motor_test/motor_test.c19
1 files changed, 8 insertions, 11 deletions
diff --git a/src/systemcmds/motor_test/motor_test.c b/src/systemcmds/motor_test/motor_test.c
index 079f99674..087699b05 100644
--- a/src/systemcmds/motor_test/motor_test.c
+++ b/src/systemcmds/motor_test/motor_test.c
@@ -67,19 +67,15 @@ 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);
- }
+ _test_motor_pub = orb_advertise(ORB_ID(test_motor), &_test_motor);
+ orb_publish(ORB_ID(test_motor), _test_motor_pub, &_test_motor);
}
static void usage(const char *reason)
{
- if (reason != NULL)
+ if (reason != NULL) {
warnx("%s", reason);
+ }
errx(1,
"usage:\n"
@@ -90,8 +86,9 @@ static void usage(const char *reason)
int motor_test_main(int argc, char *argv[])
{
- unsigned long channel, lval;
- float value;
+ unsigned long channel = 0;
+ unsigned long lval;
+ float value = 0.0f;
int ch;
if (argc != 5) {
@@ -122,7 +119,7 @@ int motor_test_main(int argc, char *argv[])
motor_test(channel, value);
- printf("motor %d set to %.2f\n", channel, value);
+ printf("motor %d set to %.2f\n", channel, (double)value);
exit(0);
}