diff options
author | Lorenz Meier <lm@inf.ethz.ch> | 2013-10-06 14:19:17 -0700 |
---|---|---|
committer | Lorenz Meier <lm@inf.ethz.ch> | 2013-10-06 14:19:17 -0700 |
commit | 55f7c561efde3af1fcf562f71391a94711480988 (patch) | |
tree | be302e6ab8808bb5592af1174d4c179f77d2c9c0 | |
parent | 4ceddfdd92343277be3c6231cbd2a547e8b7bc57 (diff) | |
parent | 378041ad31794109b2673adab8102faf6806bd96 (diff) | |
download | px4-firmware-55f7c561efde3af1fcf562f71391a94711480988.tar.gz px4-firmware-55f7c561efde3af1fcf562f71391a94711480988.tar.bz2 px4-firmware-55f7c561efde3af1fcf562f71391a94711480988.zip |
Merge pull request #442 from PX4/px4io_rate_fix
px4io: make "too high rate" warning consistent with real behavor
-rw-r--r-- | src/drivers/px4io/px4io.cpp | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/src/drivers/px4io/px4io.cpp b/src/drivers/px4io/px4io.cpp index 133646051..cba193208 100644 --- a/src/drivers/px4io/px4io.cpp +++ b/src/drivers/px4io/px4io.cpp @@ -94,6 +94,8 @@ extern device::Device *PX4IO_serial_interface() weak_function; #define PX4IO_SET_DEBUG _IOC(0xff00, 0) #define PX4IO_INAIR_RESTART_ENABLE _IOC(0xff00, 1) +#define UPDATE_INTERVAL_MIN 2 + /** * The PX4IO class. * @@ -790,8 +792,8 @@ PX4IO::task_main() /* adjust update interval */ if (_update_interval != 0) { - if (_update_interval < 5) - _update_interval = 5; + if (_update_interval < UPDATE_INTERVAL_MIN) + _update_interval = UPDATE_INTERVAL_MIN; if (_update_interval > 100) _update_interval = 100; orb_set_interval(_t_actuators, _update_interval); @@ -1942,8 +1944,8 @@ int PX4IO::set_update_rate(int rate) { int interval_ms = 1000 / rate; - if (interval_ms < 3) { - interval_ms = 3; + if (interval_ms < UPDATE_INTERVAL_MIN) { + interval_ms = UPDATE_INTERVAL_MIN; warnx("update rate too high, limiting interval to %d ms (%d Hz).", interval_ms, 1000 / interval_ms); } @@ -2317,7 +2319,7 @@ px4io_main(int argc, char *argv[]) if ((argc > 2)) { g_dev->set_update_rate(atoi(argv[2])); } else { - errx(1, "missing argument (50 - 400 Hz)"); + errx(1, "missing argument (50 - 500 Hz)"); return 1; } exit(0); |