Decoupled mpu6050 acc and gyro detection code.
This commit cleans up the #ifdef/#ifndef code which, due to the amount
of targets and variants, was starting to get a bit out of hand.
Now each acc & gyro is assumed to be used unless the respective
USE_ACC_* and USE_GYRO_* is #undef'd at the top of the file by a
particular target.
This commit also cleans up the mess of re-running all the mpu6050
detection code twice. Now the acc specific communication code is only
run once and only code that is actually needed to be run twice is run
twice, and the rest of the code is now only used once. This will
improve board startup time, albeit negligibly.
Sensor alignment is only known for the NAZE target so now the alignment
will be ALIGN_DEFAULT for all targets other than NAZE unless they are
known.
Finally, in the Makefile a file was included twice in the source list
for the STM32F3DISCOVERY target and now additional sensors are supported
for users that may want to try them on that board.
Moved some GPS code from mw.c into gps_common.c.
Moved pid values into a pidProfile_t structure; this was done so that
gps_common.c does not have a dependency on config_profile.h.
pidProfile_t lives in flight_common.h now.
Moved gps profile settings from profile_t into gpsProfile_t for the same
reason.
Removed gps_common.c's dependency on masterConfig_t by passing needed
variables into gpsInit().
separate concerns and help reduce and clarify dependencies.
cfg and mcfg are too similarly named and are not obvious. Renamed cfg
to currentProfile and mcfg to masterConfig. This will increase source
code line length somewhat but that's ok; lines of code doing too much
are now easier to spot.
This resulted in the removal of duplicate logic, duplicate code and the
removal of a temporary buffer per-driver.
The NAZE specific sensor alignment is now contained within the core code
instead of in the drivers.
The sensor alignment is determines by the sensor initialisation code.
The alignment of sensor readings is now performed once and only by the
appropriate sensor code, see usages of alignSensors().
The acc/gyro/compass driver code is now more reusable since it has no
dependencies on the main code.
each. relocated acc_t/gyro_t from sensors_common.h into
drivers/accgyro_common.h since they define an interface and the
dependency was pointing the wrong way from the drivers.
baro_t/acc_t/gyro_t dependences are all now pointing the right way.
of determining a revision code. Previously there was mpu6050 specific
code in cli.c (the status command).
Finally this commit has removed all non-serial port configuration
settings from core_t so that a future commit can refactor core_t to
reduce dependencies on serial port code.
In doing this I also noted from other source code that the MPU6050
accelerometer trim for some revisions appeared to be incorrectly set to
255 * 8 instead of 256 * 8.