diff options
author | Lorenz Meier <lm@inf.ethz.ch> | 2012-11-10 12:13:15 +0100 |
---|---|---|
committer | Lorenz Meier <lm@inf.ethz.ch> | 2012-11-10 12:13:15 +0100 |
commit | 15f43b1acc456ae47bac0575e785ed87d95db93c (patch) | |
tree | 24df2f09ca0a2e3b9ebaf046010e0a06a7e36082 /apps | |
parent | f0860ee8cb99dfa864ff6ab369a3663443538879 (diff) | |
download | px4-firmware-15f43b1acc456ae47bac0575e785ed87d95db93c.tar.gz px4-firmware-15f43b1acc456ae47bac0575e785ed87d95db93c.tar.bz2 px4-firmware-15f43b1acc456ae47bac0575e785ed87d95db93c.zip |
improved ADC test, not yet stable
Diffstat (limited to 'apps')
-rw-r--r-- | apps/px4/tests/test_adc.c | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/apps/px4/tests/test_adc.c b/apps/px4/tests/test_adc.c index 4ffa9374f..c33af1311 100644 --- a/apps/px4/tests/test_adc.c +++ b/apps/px4/tests/test_adc.c @@ -81,18 +81,18 @@ int test_adc(int argc, char *argv[]) fd0 = open("/dev/adc0", O_RDONLY | O_NONBLOCK); if (fd0 <= 0) { - message("/dev/adc0 open fail: %d", errno); + message("/dev/adc0 open fail: %d\n", errno); return ERROR; } else { - message("opened /dev/adc0 successfully"); + message("opened /dev/adc0 successfully\n"); } usleep(10000); for (j = 0; j < 10; j++) { - /* sleep 1 millisecond */ - usleep(1000); + /* sleep 20 milliseconds */ + usleep(20000); nbytes = read(fd0, &sample1, sizeof(sample1)); /* Handle unexpected return values */ @@ -101,15 +101,15 @@ int test_adc(int argc, char *argv[]) errval = errno; if (errval != EINTR) { - message("reading /dev/adc0 failed: %d", errval); + message("reading /dev/adc0 failed: %d\n", errval); errval = 3; goto errout_with_dev; } - message("\tinterrupted read.."); + message("\tinterrupted read..\n"); } else if (nbytes == 0) { - message("\tno data read, ignoring."); + message("\tno data read, ignoring.\n"); ret = ERROR; } @@ -117,22 +117,22 @@ int test_adc(int argc, char *argv[]) else { if (nbytes != sizeof(sample1)) { - message("\tsample 1 size %d is not matching struct size %d, ignoring", + message("\tsample 1 size %d is not matching struct size %d, ignoring\n", nbytes, sizeof(sample1)); ret = ERROR; } else { - message("CYCLE %d:", j); + message("CYCLE %d:\n", j); + message("channel: %d value: %d\n", + (int)sample1.am_channel1, sample1.am_data1); message("channel: %d value: %d", - sample1.am_channel1, sample1.am_data1); + (int)sample1.am_channel2, sample1.am_data2); message("channel: %d value: %d", - sample1.am_channel2, sample1.am_data2); + (int)sample1.am_channel3, sample1.am_data3); message("channel: %d value: %d", - sample1.am_channel3, sample1.am_data3); - message("channel: %d value: %d", - sample1.am_channel4, sample1.am_data4); + (int)sample1.am_channel4, sample1.am_data4); } } fflush(stdout); |