From 728b596e1b6a0f4f37fe68c54b3ca5d502a2e645 Mon Sep 17 00:00:00 2001 From: Martin Budden Date: Thu, 9 Mar 2017 19:02:47 +0000 Subject: [PATCH] Minor fixes to parameter groups --- src/main/fc/cli.c | 6 ++++-- src/main/fc/config.c | 13 +++++++++---- 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/src/main/fc/cli.c b/src/main/fc/cli.c index 9821de073..704b186e0 100755 --- a/src/main/fc/cli.c +++ b/src/main/fc/cli.c @@ -204,7 +204,7 @@ static const char * const sensorTypeNames[] = { #define SENSOR_NAMES_MASK (SENSOR_GYRO | SENSOR_ACC | SENSOR_BARO | SENSOR_MAG) -static const char * const sensorHardwareNames[4][15] = { +static const char * const sensorHardwareNames[4][16] = { { "", "None", "MPU6050", "L3G4200D", "MPU3050", "L3GD20", "MPU6000", "MPU6500", "MPU9250", "ICM20689", "ICM20608G", "ICM20602", "BMI160", "FAKE", NULL }, { "", "None", "ADXL345", "MPU6050", "MMA845x", "BMA280", "LSM303DLHC", "MPU6000", "MPU6500", "ICM20689", "MPU9250", "ICM20608G", "ICM20602", "BMI160", "FAKE", NULL }, { "", "None", "BMP085", "MS5611", "BMP280", NULL }, @@ -736,7 +736,8 @@ static const clivalue_t valueTable[] = { { "iterm_windup", VAR_UINT8 | PROFILE_VALUE, .config.minmax = { 30, 100 }, PG_PID_PROFILE, offsetof(pidProfile_t, itermWindupPointPercent) }, { "yaw_lowpass", VAR_UINT16 | PROFILE_VALUE, .config.minmax = { 0, 500 }, PG_PID_PROFILE, offsetof(pidProfile_t, yaw_lpf_hz) }, - { "pidsum_limit", VAR_FLOAT | PROFILE_VALUE, .config.minmax = { 0.1, 1.0 }, PG_PID_CONFIG, offsetof(pidProfile_t, pidSumLimit) }, + { "pidsum_limit", VAR_FLOAT | PROFILE_VALUE, .config.minmax = { 0.1, 1.0 }, PG_PID_PROFILE, offsetof(pidProfile_t, pidSumLimit) }, + { "pidsum_limit_yaw", VAR_FLOAT | PROFILE_VALUE, .config.minmax = { 0.1, 1.0 }, PG_PID_PROFILE, offsetof(pidProfile_t, pidSumLimitYaw) }, { "p_pitch", VAR_UINT8 | PROFILE_VALUE, .config.minmax = { 0, 200 }, PG_PID_PROFILE, offsetof(pidProfile_t, P8[PITCH]) }, { "i_pitch", VAR_UINT8 | PROFILE_VALUE, .config.minmax = { 0, 200 }, PG_PID_PROFILE, offsetof(pidProfile_t, I8[PITCH]) }, @@ -1510,6 +1511,7 @@ static const cliCurrentAndDefaultConfig_t *getCurrentAndDefaultConfigs(pgn_t pgn case PG_THROTTLE_CORRECTION_CONFIG: ret.currentConfig = &throttleCorrectionConfigCopy; ret.defaultConfig = throttleCorrectionConfig(); + break; case PG_FAILSAFE_CONFIG: ret.currentConfig = &failsafeConfigCopy; ret.defaultConfig = failsafeConfig(); diff --git a/src/main/fc/config.c b/src/main/fc/config.c index b93395afb..51dd00128 100755 --- a/src/main/fc/config.c +++ b/src/main/fc/config.c @@ -1270,6 +1270,10 @@ void validateAndFixConfig(void) if (!isSerialConfigValid(serialConfig)) { resetSerialConfig(serialConfig); } +#else + if (!isSerialConfigValid(serialConfig())) { + pgResetFn_serialPinConfig(serialConfigMutable()); + } #endif // Prevent invalid notch cutoff @@ -1373,13 +1377,14 @@ void readEEPROM(void) failureMode(FAILURE_INVALID_EEPROM_CONTENTS); } -// pgActivateProfile(getCurrentPidProfileIndex()); -// setControlRateProfile(rateProfileSelection()->defaultRateProfileIndex); + if (systemConfig()->activeRateProfile >= CONTROL_RATE_PROFILE_COUNT) {// sanity check + systemConfigMutable()->activeRateProfile = 0; + } + setControlRateProfile(systemConfig()->activeRateProfile); - if (systemConfig()->pidProfileIndex > MAX_PROFILE_COUNT - 1) {// sanity check + if (systemConfig()->pidProfileIndex >= MAX_PROFILE_COUNT) {// sanity check systemConfigMutable()->pidProfileIndex = 0; } - setPidProfile(systemConfig()->pidProfileIndex); validateAndFixConfig();