Merge pull request #2606 from martinbudden/bf_minor_pg_fixes

Minor fixes to parameter groups
This commit is contained in:
Martin Budden 2017-03-09 21:16:07 +00:00 committed by GitHub
commit d48398d15c
2 changed files with 13 additions and 6 deletions

View File

@ -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();

View File

@ -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();