That fixed compilation issues and seems more semantically correct. Using array
of length 0 fails compilation because of -Werror=array-bounds in GCC 6.1.
We actually don't want a flexible array in this union, but rather a way
to access it byte by byte. This fixes the build for gcc >= 6
In file included from ../../libraries/AP_GPS/AP_GPS.cpp:24:0:
../../libraries/AP_GPS/AP_GPS_ERB.h:93:23: error: flexible array member in union
uint8_t bytes[];
^
compilation terminated due to -Wfatal-errors.
In file included from ../../libraries/AP_GPS/AP_GPS_ERB.cpp:22:0:
../../libraries/AP_GPS/AP_GPS_ERB.h:93:23: error: flexible array member in union
uint8_t bytes[];
^
compilation terminated due to -Wfatal-errors.
In file included from ../../libraries/AP_GPS/AP_GPS_MTK.cpp:25:0:
../../libraries/AP_GPS/AP_GPS_MTK.h:75:23: error: flexible array member in union
uint8_t bytes[];
^
compilation terminated due to -Wfatal-errors.
In file included from ../../libraries/AP_GPS/AP_GPS_MTK19.cpp:26:0:
../../libraries/AP_GPS/AP_GPS_MTK.h:75:23: error: flexible array member in union
uint8_t bytes[];
^
compilation terminated due to -Wfatal-errors.
In file included from ../../libraries/AP_GPS/AP_GPS_SIRF.cpp:22:0:
../../libraries/AP_GPS/AP_GPS_SIRF.h:101:23: error: flexible array member in union
uint8_t bytes[];
^
compilation terminated due to -Wfatal-errors.
In file included from ../../libraries/AP_GPS/AP_GPS_UBLOX.cpp:23:0:
../../libraries/AP_GPS/AP_GPS_UBLOX.h:387:23: error: flexible array member in union
uint8_t bytes[];
^
compilation terminated due to -Wfatal-errors.
Due to the way the headers are organized a single change in a
AP_GPS backend would trigger a rebuild for most of the files in the
project. Time could be saved by using ccache (since most of the things
didn't change) but we can do better, i.e. re-organize
the headers so we don't have to re-build everything.
This makes internal headers internal and then other libraries only
depend on the AP_GPS.h header.
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.
This is a complete rewrite of the GPS driver structure, with a static
main driver and separate backend drivers. This will allow proper
support for multiple GPSes, and will allow parameters to be set on the
GPS object
the old mechanism wasted most of the input bytes, and chewed a lot of
CPU, making it impractical to do GPS detection for a GPS attached
after startup
The new code is async, and detects a GPS by looking for a fully formed
packet with the right checksum for each GPS type
Nuke AP_GPS_IMU, as nothing is using it anymore.
Simplify the handling of no GPS/no fix detection.
Fix prototypes for ::init and ::read.
Update AP_GPS_Auto and corresponding example, nearly ready for primetime.
Use uint8_t rather than byte.
Strip some _error() calls to save space. More could still go.
git-svn-id: https://arducopter.googlecode.com/svn/trunk@1246 f9c3cf11-9bcb-44bc-f272-b75c42450872
Note that this is currently disabled as changes need to be made to APM to support it.
Tested with MTK, u-blox and SiRF GPS'.
git-svn-id: https://arducopter.googlecode.com/svn/trunk@671 f9c3cf11-9bcb-44bc-f272-b75c42450872