aboutsummaryrefslogtreecommitdiff
path: root/src/systemcmds
diff options
context:
space:
mode:
authorpx4dev <px4@purgatory.org>2013-05-19 21:51:35 +0200
committerpx4dev <px4@purgatory.org>2013-05-19 21:51:35 +0200
commitb7d430e3c06c10411419bfc8bfb30574f7a9cb56 (patch)
tree994a105907415d5b6d877c436126410b25562aa4 /src/systemcmds
parentc6b7eb1224426d9ec2e6d59a3df4c7443449109a (diff)
parent504b6d12561d68874ded4c1f747c21926a065045 (diff)
downloadpx4-firmware-b7d430e3c06c10411419bfc8bfb30574f7a9cb56.tar.gz
px4-firmware-b7d430e3c06c10411419bfc8bfb30574f7a9cb56.tar.bz2
px4-firmware-b7d430e3c06c10411419bfc8bfb30574f7a9cb56.zip
Merge branch 'master' of https://github.com/PX4/Firmware into fmuv2_bringup
Fix px4iov2 build issue by selecting the correct NuttX config.
Diffstat (limited to 'src/systemcmds')
-rw-r--r--src/systemcmds/param/param.c20
-rw-r--r--src/systemcmds/pwm/pwm.c19
2 files changed, 27 insertions, 12 deletions
diff --git a/src/systemcmds/param/param.c b/src/systemcmds/param/param.c
index 56f5317e3..60e61d07b 100644
--- a/src/systemcmds/param/param.c
+++ b/src/systemcmds/param/param.c
@@ -1,6 +1,6 @@
/****************************************************************************
*
- * Copyright (C) 2012 PX4 Development Team. All rights reserved.
+ * Copyright (c) 2012, 2013 PX4 Development Team. All rights reserved.
* Author: Lorenz Meier <lm@inf.ethz.ch>
*
* Redistribution and use in source and binary forms, with or without
@@ -34,6 +34,7 @@
/**
* @file param.c
+ * @author Lorenz Meier <lm@inf.ethz.ch>
*
* Parameter tool.
*/
@@ -262,7 +263,7 @@ do_set(const char* name, const char* val)
switch (param_type(param)) {
case PARAM_TYPE_INT32:
if (!param_get(param, &i)) {
- printf("old: %d", i);
+ printf("curr: %d", i);
/* convert string */
char* end;
@@ -276,14 +277,13 @@ do_set(const char* name, const char* val)
case PARAM_TYPE_FLOAT:
if (!param_get(param, &f)) {
- printf("float values are not yet supported.");
- // printf("old: %4.4f", (double)f);
-
- // /* convert string */
- // char* end;
- // f = strtof(val,&end);
- // param_set(param, &f);
- // printf(" -> new: %4.4f\n", f);
+ printf("curr: %4.4f", (double)f);
+
+ /* convert string */
+ char* end;
+ f = strtod(val,&end);
+ param_set(param, &f);
+ printf(" -> new: %f\n", f);
}
diff --git a/src/systemcmds/pwm/pwm.c b/src/systemcmds/pwm/pwm.c
index de7a53199..ff733df52 100644
--- a/src/systemcmds/pwm/pwm.c
+++ b/src/systemcmds/pwm/pwm.c
@@ -71,13 +71,14 @@ usage(const char *reason)
warnx("%s", reason);
errx(1,
"usage:\n"
- "pwm [-v] [-d <device>] [-u <alt_rate>] [-c <channel group>] [arm|disarm] [<channel_value> ...]\n"
+ "pwm [-v] [-d <device>] [-u <alt_rate>] [-c <channel group>] [-m chanmask ] [arm|disarm] [<channel_value> ...]\n"
" -v Print information about the PWM device\n"
" <device> PWM output device (defaults to " PWM_OUTPUT_DEVICE_PATH ")\n"
" <alt_rate> PWM update rate for channels in <alt_channel_mask>\n"
" <channel_group> Channel group that should update at the alternate rate (may be specified more than once)\n"
" arm | disarm Arm or disarm the ouptut\n"
" <channel_value>... PWM output values in microseconds to assign to the PWM outputs\n"
+ " <chanmask> Directly supply alt rate channel mask (debug use only)\n"
"\n"
"When -c is specified, any channel groups not listed with -c will update at the default rate.\n"
);
@@ -96,11 +97,12 @@ pwm_main(int argc, char *argv[])
int ret;
char *ep;
unsigned group;
+ int32_t set_mask = -1;
if (argc < 2)
usage(NULL);
- while ((ch = getopt(argc, argv, "c:d:u:v")) != EOF) {
+ while ((ch = getopt(argc, argv, "c:d:u:vm:")) != EOF) {
switch (ch) {
case 'c':
group = strtoul(optarg, &ep, 0);
@@ -120,6 +122,12 @@ pwm_main(int argc, char *argv[])
usage("bad alt_rate value");
break;
+ case 'm':
+ set_mask = strtol(optarg, &ep, 0);
+ if (*ep != '\0')
+ usage("bad set_mask value");
+ break;
+
case 'v':
print_info = true;
break;
@@ -143,6 +151,13 @@ pwm_main(int argc, char *argv[])
err(1, "PWM_SERVO_SET_UPDATE_RATE (check rate for sanity)");
}
+ /* directly supplied channel mask */
+ if (set_mask != -1) {
+ ret = ioctl(fd, PWM_SERVO_SELECT_UPDATE_RATE, set_mask);
+ if (ret != OK)
+ err(1, "PWM_SERVO_SELECT_UPDATE_RATE");
+ }
+
/* assign alternate rate to channel groups */
if (alt_channels_set) {
uint32_t mask = 0;