Commit Graph

24 Commits

Author SHA1 Message Date
Brad Bosch 6e9756ff79 HAL_PX4: Rework support for FLOW_CONTROL_AUTO.
Now instead of requiring the buffer to fill completely before we can
detect it is not draining, we use a time based mechanism to detect
when none of the first few bytes are transmitted after sitting in our
buffer a half second or more after flow control is enabled.  This
huristic is reliable only for the first several chracters because we
believe that the radio must still have plenty of room in it's own
buffers at that time even if it is not able to transmit them to the
other radio yet.  Note that the original algorithm made the same
assumption.

The new algorithm is especially helpful for cases where only keepalive
messages are transmitted before other packets can be requested by the
GCS.  In this situation, the original code required almost 2 minutes
to disable flow control and allow communication with the GCS.
2015-08-19 15:21:10 +10:00
Gustavo Jose de Sousa 08333f1ffe AP_HAL_PX4: standardize inclusion of libaries headers
This commit changes the way libraries headers are included in source files:

 - If the header is in the same directory the source belongs to, so the
 notation '#include ""' is used with the path relative to the directory
 containing the source.

 - If the header is outside the directory containing the source, then we use
 the notation '#include <>' with the path relative to libraries folder.

Some of the advantages of such approach:

 - Only one search path for libraries headers.

 - OSs like Windows may have a better lookup time.
2015-08-11 16:28:43 +10:00
Matthias Badaire 1d3a49e466 AP_HAL_PX4 : make UARTDriver capable to be called from different threads.
The modification allows the read and write functions to be called by any thread but the calling thread must be the last one that called the begin() function.
2014-11-14 13:51:16 +11:00
Andrew Tridgell 7c1b9b344f AP_HAL: added get_flow_control() API 2014-02-14 21:51:00 +11:00
Andrew Tridgell c5c1d1358a HAL_PX4: added automatic hardware flow control detection
this allows us to detect if hardware flow control is not available and
automatically disable it
2014-02-11 12:11:26 +11:00
Andrew Tridgell 3e637ac5d9 AP_HAL: added enable_flow_control() option in AP_HAL 2014-02-10 12:54:50 +11:00
Andrew Tridgell ad30f8effa HAL_PX4: try to reopen UARTs if safety switch is disarmed
this allows attaching to the USB port after power on

Pair-Programmed-With: Randy Mackay <rmackay9@yahoo.com>
2013-10-05 15:47:28 +10:00
Andrew Tridgell 40af9ab674 AP_HAL_PX4: updates for new API 2013-09-22 12:22:05 +10:00
Andrew Tridgell 05b426c1fc HAL_PX4: use common printf implementation on UARTs 2013-09-21 14:23:52 +10:00
Andrew Tridgell 8766e86091 HAL_PX4: fixed blocking bulk writes to UARTs
this fixes a problem with uBlox initialisation on PX4
2013-03-20 15:41:52 +11:00
Andrew Tridgell 54e7bce75e HAL_PX4: cope with O_NONBLOCK not working in NuttX on ttyACM0
writes will block anyway, which clags up APM
2013-02-19 12:02:46 +11:00
Andrew Tridgell e45b137816 HAL_PX4: added run_debug_shell() implementation for PX4 2013-02-07 15:04:33 +11:00
Andrew Tridgell fc8065b50f HAL_PX4: added UART performance counters 2013-01-24 15:04:57 +11:00
Andrew Tridgell f72b532405 HAL_PX4: ensure all writes go via buffers
this prevents output corruption by direct fd writes
2013-01-23 09:22:51 +11:00
Andrew Tridgell 89cb3fbd61 HAL_PX4: fixed blocking IO in UART driver 2013-01-22 21:52:21 +11:00
Andrew Tridgell 6ffa18fa61 HAL_PX4: rewrite UART driver to be much more efficient
this does the IO in the timer thread, and uses buffers in the main
task to avoid system call costs in the flight code.

The cost of PX4 read and write system calls is quite high - about 10
to 15 usec. We can't afford to pay that per byte
2013-01-22 21:22:01 +11:00
Andrew Tridgell 546ed19ffc HAL_PX4: improved efficiency of serial writes
use buffer at a time writes when possible, and use O_NONBLOCKING to
avoid txspace()
2013-01-22 10:50:26 +11:00
Andrew Tridgell 18cfd29f2f HAL_PX4: added a read buffer to the UART driver
this lowers the average cost of reading bytes by a large amount, and
prevents the GPS driver from chewing lots of time.
2013-01-22 10:34:04 +11:00
Andrew Tridgell 76092eb590 AP_HAL: remove unused peek() interface from UART drivers
this is a bit tricky to implement on some platforms, and is unused
anyway
2013-01-16 14:43:18 +11:00
Andrew Tridgell bd9c61562f HAL_PX4: added -d command line option to app
allows control of serial device
2013-01-14 16:21:27 +11:00
Andrew Tridgell d492b72a2c HAL_PX4: use /dev/ttyS0 for uartA
this also changes txspace and available to use FIONWRITE and FIONREAD
2013-01-03 21:12:10 +11:00
Andrew Tridgell c6c336a6e8 HAL_PX4: implement peek() and available()
keep a 1 byte buffer
2013-01-03 17:27:53 +11:00
Andrew Tridgell d9d5eb52bf HAL_PX4: use fd IO instead of stdio
this allows for hal console output from within timers, which is very
handy for debugging
2013-01-03 13:16:41 +11:00
Andrew Tridgell 9373a4e5b3 HAL_PX4: added a uartA driver
uses stdin/stdout for IO
2013-01-03 11:03:05 +11:00