The `mag` variable is defined as an `extern` in compass.h but the implementation in compass.c is bounded by `#ifdef USE_MAG`. So if `USE_MAG` is not debined then the `mag` variable is an undefined reference.
In imu.c the `imuMahonyAHRSupdate()` function was being passed the elements of `mag` unconditionally like `mag.magADC[X]` so in the case that `USE_MAG` wasn't defined these were invalid null references. Luckily the logic in `imuMahonyAHRSupdate()` was properly bounded so that it never tried to access these variables. But in the case of a debug build the linker is unable to build a reference to these variables since they're never defined.
Change the logic to not modify rcCommand directly and instead apply the additional throttle directly in the mixer.
Also move the logic to the attitude task instead of having it calculate in the PID loop. The logic relies on an angle that's only updated in the attitude task so there was no point in running the calculation every PID loop.
After disarming and allowing the gyros to settle with no motion, temporarily increase the dcmKpGain to rapidly converge on the correct attitude as indicated by the accelerometer (if present).
Addresses the case of the attitude estimate becoming significantly incorrect after a crash due to high gyro rates. While the estimate will eventually converge, it does so quite slowly. The pilot may re-arm before the estimate has corrected leading to instant flips in self-leveling modes. By speeding up the convergence when disarmed we help reduce this risk.
The function imuIsAccelerometerHealthy() was only using the last ACC sample to determine if the sensor was returning "healthy" data. This then controlled whether the IMU attitude calculation considered ACC data at all. There were two problems with this:
1. A single sample from the ACC can be very noisy and exceed the check threshold resulting in a false negative on the health of the sensor.
2. The attitude calculations exclusively used the averaged ACC samples so there was an inconsistency in checking only the last sample to determine if the data was useful.
This change should lead to fewer occurences of the ACC sensor data being ignored in the attitude estimation which should in turn improve the overall estimate.
If USE_MAG was undefined but USE_GPS was defined, then the "else if" would incorrectly apply to a condition above making the USE_GPS section unlikely to execute.
use quaternion directly & we can fly in 3D mode now
rename uartPort_t to tcpPort_t
fix race on ACC, GYRO, IMU
fix gyro scale & disable SystemLoad calculate
update README.md
remove some unused
fix scale on 3D mode