made gyrodiff for motion detection configurable, 0 = disabled

git-svn-id: https://afrodevices.googlecode.com/svn/trunk/baseflight@230 7c89a4a9-59b9-e629-4cfe-3a2d53b20e61
This commit is contained in:
timecop@gmail.com 2012-10-14 00:34:23 +00:00
parent 0976133f1f
commit e59f639951
5 changed files with 2976 additions and 2970 deletions

File diff suppressed because it is too large Load Diff

View File

@ -159,6 +159,7 @@ const clivalue_t valueTable[] = {
{ "baro_tab_size", VAR_UINT8, &cfg.baro_tab_size, 0, BARO_TAB_SIZE_MAX },
{ "baro_noise_lpf", VAR_FLOAT, &cfg.baro_noise_lpf, 0, 1 },
{ "baro_cf", VAR_FLOAT, &cfg.baro_cf, 0, 1 },
{ "moron_threshold", VAR_UINT8, &cfg.moron_threshold, 0, 128 },
{ "mag_declination", VAR_INT16, &cfg.mag_declination, -18000, 18000 },
{ "gps_type", VAR_UINT8, &cfg.gps_type, 0, 3 },
{ "gps_pos_p", VAR_UINT8, &cfg.P8[PIDPOS], 0, 200 },

View File

@ -12,7 +12,7 @@
config_t cfg;
const char rcChannelLetters[] = "AERT1234";
static uint8_t EEPROM_CONF_VERSION = 33;
static uint8_t EEPROM_CONF_VERSION = 34;
static uint32_t enabledSensors = 0;
static void resetConf(void);
@ -187,6 +187,7 @@ static void resetConf(void)
cfg.baro_tab_size = 21;
cfg.baro_noise_lpf = 0.6f;
cfg.baro_cf = 0.985f;
cfg.moron_threshold = 32;
cfg.gyro_smoothing_factor = 0x00141403; // default factors of 20, 20, 3 for R/P/Y
cfg.vbatscale = 110;
cfg.vbatmaxcellvoltage = 43;

View File

@ -158,6 +158,7 @@ typedef struct config_t {
uint8_t baro_tab_size; // size of baro filter array
float baro_noise_lpf; // additional LPF to reduce baro noise
float baro_cf; // apply Complimentary Filter to keep the calculated velocity based on baro velocity (i.e. near real velocity)
uint8_t moron_threshold; // people keep forgetting that moving model while init results in wrong gyro offsets. and then they never reset gyro. so this is now on by default.
uint16_t activate[CHECKBOXITEMS]; // activate switches
uint8_t vbatscale; // adjust this to match battery voltage to reported value

View File

@ -331,7 +331,7 @@ static void GYRO_Common(void)
if (calibratingG == 1) {
int16_t gyroDiff = gyroMax[axis] - gyroMin[axis];
// check variance and startover if idiot was moving the model
if (gyroDiff > 10) {
if (cfg.moron_threshold && gyroDiff > cfg.moron_threshold) {
calibratingG = 1000;
gyroMin[0] = gyroMin[1] = gyroMin[2] = 0;
gyroMax[0] = gyroMax[1] = gyroMax[2] = 0;