aboutsummaryrefslogtreecommitdiff
path: root/apps/drivers/px4io/px4io.cpp
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2013-01-27 08:16:39 +1100
committerLorenz Meier <lm@inf.ethz.ch>2013-02-17 13:03:36 +0100
commit04bea8678e98d58145d18c44bd3069433f528019 (patch)
treec147a5374615df3b69fdd1c6fb87fcc481658add /apps/drivers/px4io/px4io.cpp
parenta33f314a2500e207d7aa566e2ea4fe8ace7e6300 (diff)
downloadpx4-firmware-04bea8678e98d58145d18c44bd3069433f528019.tar.gz
px4-firmware-04bea8678e98d58145d18c44bd3069433f528019.tar.bz2
px4-firmware-04bea8678e98d58145d18c44bd3069433f528019.zip
Merged debuglevel command from Tridge
Diffstat (limited to 'apps/drivers/px4io/px4io.cpp')
-rw-r--r--apps/drivers/px4io/px4io.cpp28
1 files changed, 27 insertions, 1 deletions
diff --git a/apps/drivers/px4io/px4io.cpp b/apps/drivers/px4io/px4io.cpp
index 51ff3fb83..8bcf4bacb 100644
--- a/apps/drivers/px4io/px4io.cpp
+++ b/apps/drivers/px4io/px4io.cpp
@@ -1019,6 +1019,11 @@ PX4IO::ioctl(file *filep, int cmd, unsigned long arg)
*(unsigned *)arg = _max_actuators;
break;
+ case PWM_SERVO_SET_DEBUG:
+ /* set the debug level */
+ ret = io_reg_set(PX4IO_PAGE_SETUP, PX4IO_P_SETUP_SET_DEBUG, arg);
+ break;
+
case PWM_SERVO_SET(0) ... PWM_SERVO_SET(PWM_OUTPUT_MAX_CHANNELS): {
unsigned channel = cmd - PWM_SERVO_SET(0);
@@ -1287,6 +1292,27 @@ px4io_main(int argc, char *argv[])
exit(0);
}
+ if (!strcmp(argv[1], "debug")) {
+ if (argc <= 2) {
+ printf("usage: px4io debug LEVEL\n");
+ exit(1);
+ }
+ if (g_dev == nullptr) {
+ printf("px4io is not started\n");
+ exit(1);
+ }
+ uint8_t level = atoi(argv[2]);
+ // we can cheat and call the driver directly, as it
+ // doesn't reference filp in ioctl()
+ int ret = g_dev->ioctl(NULL, PWM_SERVO_SET_DEBUG, level);
+ if (ret != 0) {
+ printf("SET_DEBUG failed - %d\n", ret);
+ exit(1);
+ }
+ printf("SET_DEBUG %u OK\n", (unsigned)level);
+ exit(0);
+ }
+
/* note, stop not currently implemented */
if (!strcmp(argv[1], "update")) {
@@ -1353,5 +1379,5 @@ px4io_main(int argc, char *argv[])
monitor();
out:
- errx(1, "need a command, try 'start', 'stop', 'status', 'test', 'monitor' or 'update'");
+ errx(1, "need a command, try 'start', 'stop', 'status', 'test', 'monitor', 'debug' or 'update'");
}