added acc_trim stuff into cli

spacing/indentation fixes
flyingwing is somewhat supported, reflect that in comment
added anti-moron gyro calibration routine... if model is getting moved while its arming... don't calculate gyro avearage because its gonna be wrong... example of fail see here: http://www.rcgroups.com/forums/showthread.php?t=1749966

git-svn-id: https://afrodevices.googlecode.com/svn/trunk/baseflight@229 7c89a4a9-59b9-e629-4cfe-3a2d53b20e61
This commit is contained in:
timecop@gmail.com 2012-10-13 12:08:56 +00:00
parent 9fc43d5357
commit 0976133f1f
5 changed files with 2594 additions and 2569 deletions

File diff suppressed because it is too large Load Diff

View File

@ -151,6 +151,8 @@ const clivalue_t valueTable[] = {
{ "acc_hardware", VAR_UINT8, &cfg.acc_hardware, 0, 3 },
{ "acc_lpf_factor", VAR_UINT8, &cfg.acc_lpf_factor, 0, 250 },
{ "acc_lpf_for_velocity", VAR_UINT8, &cfg.acc_lpf_for_velocity, 1, 250 },
{ "acc_trim_pitch", VAR_INT16, &cfg.angleTrim[PITCH], -300, 300 },
{ "acc_trim_roll", VAR_INT16, &cfg.angleTrim[ROLL], -300, 300 },
{ "gyro_lpf", VAR_UINT16, &cfg.gyro_lpf, 0, 256 },
{ "gyro_cmpf_factor", VAR_UINT16, &cfg.gyro_cmpf_factor, 100, 1000 },
{ "mpu6050_scale", VAR_UINT8, &cfg.mpu6050_scale, 0, 1 },

View File

@ -1,7 +1,7 @@
#include "board.h"
#include "mw.h"
// July 2012 V2.1
// October 2012 V2.1-dev
flags_t f;
int16_t debug[4];
@ -48,7 +48,6 @@ int16_t nav_rated[2]; // Adding a rate controller to the navigatio
int8_t nav_mode = NAV_MODE_NONE; // Navigation mode
// Automatic ACC Offset Calibration
// **********************
uint16_t InflightcalibratingA = 0;
int16_t AccInflightCalibrationArmed;
uint16_t AccInflightCalibrationMeasurementDone = 0;

View File

@ -2,7 +2,6 @@
/* for VBAT monitoring frequency */
#define VBATFREQ 6 // to read battery voltage - nth number of loop iterations
#define BARO_TAB_SIZE_MAX 48
#define VERSION 211
@ -29,13 +28,13 @@ typedef enum MultiType
MULTITYPE_GIMBAL = 5,
MULTITYPE_Y6 = 6,
MULTITYPE_HEX6 = 7,
MULTITYPE_FLYING_WING = 8, // UNSUPPORTED, do not select!
MULTITYPE_FLYING_WING = 8,
MULTITYPE_Y4 = 9,
MULTITYPE_HEX6X = 10,
MULTITYPE_OCTOX8 = 11, // Java GUI is same for the next 3 configs
MULTITYPE_OCTOFLATP = 12, // MultiWinGui shows this differently
MULTITYPE_OCTOFLATX = 13, // MultiWinGui shows this differently
MULTITYPE_AIRPLANE = 14, // airplane / singlecopter / dualcopter
MULTITYPE_AIRPLANE = 14, // airplane / singlecopter / dualcopter (not yet properly supported)
MULTITYPE_HELI_120_CCPM = 15,
MULTITYPE_HELI_90_DEG = 16,
MULTITYPE_VTAIL4 = 17,

View File

@ -308,9 +308,11 @@ void Baro_update(void)
static void GYRO_Common(void)
{
int axis;
static int16_t previousGyroADC[3] = { 0, 0, 0 };
static int32_t g[3];
int axis;
static int16_t gyroMin[3];
static int16_t gyroMax[3];
if (calibratingG > 0) {
for (axis = 0; axis < 3; axis++) {
@ -319,11 +321,23 @@ static void GYRO_Common(void)
g[axis] = 0;
// Sum up 1000 readings
g[axis] += gyroADC[axis];
// g[axis] += (1000 - calibratingG) >> 1;
if (gyroMin[axis] > gyroADC[axis])
gyroMin[axis] = gyroADC[axis];
if (gyroMax[axis] < gyroADC[axis])
gyroMax[axis] = gyroADC[axis];
// Clear global variables for next reading
gyroADC[axis] = 0;
gyroZero[axis] = 0;
if (calibratingG == 1) {
int16_t gyroDiff = gyroMax[axis] - gyroMin[axis];
// check variance and startover if idiot was moving the model
if (gyroDiff > 10) {
calibratingG = 1000;
gyroMin[0] = gyroMin[1] = gyroMin[2] = 0;
gyroMax[0] = gyroMax[1] = gyroMax[2] = 0;
g[0] = g[1] = g[2] = 0;
continue;
}
gyroZero[axis] = g[axis] / 1000;
blinkLED(10, 15, 1);
}