Merge pull request #9574 from IllusionFpv/increase-max-osd-srate-setting

Increase OSD srate max setting for using new rate systems
This commit is contained in:
Michael Keller 2020-03-11 22:32:28 +13:00 committed by GitHub
commit d733c48b04
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 36 additions and 3 deletions

View File

@ -257,9 +257,9 @@ static const OSD_Entry cmsx_menuRateProfileEntries[] =
{ "RC P RATE", OME_FLOAT, NULL, &(OSD_FLOAT_t) { &rateProfile.rcRates[FD_PITCH], 1, CONTROL_RATE_CONFIG_RC_RATES_MAX, 1, 10 }, 0 },
{ "RC Y RATE", OME_FLOAT, NULL, &(OSD_FLOAT_t) { &rateProfile.rcRates[FD_YAW], 1, CONTROL_RATE_CONFIG_RC_RATES_MAX, 1, 10 }, 0 },
{ "ROLL SUPER", OME_FLOAT, NULL, &(OSD_FLOAT_t) { &rateProfile.rates[FD_ROLL], 0, 100, 1, 10 }, 0 },
{ "PITCH SUPER", OME_FLOAT, NULL, &(OSD_FLOAT_t) { &rateProfile.rates[FD_PITCH], 0, 100, 1, 10 }, 0 },
{ "YAW SUPER", OME_FLOAT, NULL, &(OSD_FLOAT_t) { &rateProfile.rates[FD_YAW], 0, 100, 1, 10 }, 0 },
{ "ROLL SUPER", OME_FLOAT, NULL, &(OSD_FLOAT_t) { &rateProfile.rates[FD_ROLL], 0, CONTROL_RATE_CONFIG_RATE_MAX, 1, 10 }, 0 },
{ "PITCH SUPER", OME_FLOAT, NULL, &(OSD_FLOAT_t) { &rateProfile.rates[FD_PITCH], 0, CONTROL_RATE_CONFIG_RATE_MAX, 1, 10 }, 0 },
{ "YAW SUPER", OME_FLOAT, NULL, &(OSD_FLOAT_t) { &rateProfile.rates[FD_YAW], 0, CONTROL_RATE_CONFIG_RATE_MAX, 1, 10 }, 0 },
{ "RC R EXPO", OME_FLOAT, NULL, &(OSD_FLOAT_t) { &rateProfile.rcExpo[FD_ROLL], 0, 100, 1, 10 }, 0 },
{ "RC P EXPO", OME_FLOAT, NULL, &(OSD_FLOAT_t) { &rateProfile.rcExpo[FD_PITCH], 0, 100, 1, 10 }, 0 },

View File

@ -98,6 +98,11 @@ pidProfile_t *currentPidProfile;
#define DYNAMIC_FILTER_MAX_SUPPORTED_LOOP_TIME HZ_TO_INTERVAL_US(2000)
#define BETAFLIGHT_MAX_SRATE 100
#define KISS_MAX_SRATE 100
#define QUICK_MAX_RATE 200
#define ACTUAL_MAX_RATE 200
PG_REGISTER_WITH_RESET_TEMPLATE(pilotConfig_t, pilotConfig, PG_PILOT_CONFIG, 1);
PG_RESET_TEMPLATE(pilotConfig_t, pilotConfig,
@ -555,6 +560,34 @@ static void validateAndFixConfig(void)
#if defined(TARGET_VALIDATECONFIG)
targetValidateConfiguration();
#endif
for (unsigned i = 0; i < CONTROL_RATE_PROFILE_COUNT; i++) {
switch (controlRateProfilesMutable(i)->rates_type) {
case RATES_TYPE_BETAFLIGHT:
default:
for (int axis = FD_ROLL; axis <= FD_YAW; axis++) {
controlRateProfilesMutable(i)->rates[axis] = constrain(controlRateProfilesMutable(i)->rates[axis], 0, BETAFLIGHT_MAX_SRATE);
}
break;
case RATES_TYPE_KISS:
for (int axis = FD_ROLL; axis <= FD_YAW; axis++) {
controlRateProfilesMutable(i)->rates[axis] = constrain(controlRateProfilesMutable(i)->rates[axis], 0, KISS_MAX_SRATE);
}
break;
case RATES_TYPE_ACTUAL:
for (int axis = FD_ROLL; axis <= FD_YAW; axis++) {
controlRateProfilesMutable(i)->rates[axis] = constrain(controlRateProfilesMutable(i)->rates[axis], 0, ACTUAL_MAX_RATE);
}
break;
case RATES_TYPE_QUICK:
for (int axis = FD_ROLL; axis <= FD_YAW; axis++) {
controlRateProfilesMutable(i)->rates[axis] = constrain(controlRateProfilesMutable(i)->rates[axis], 0, QUICK_MAX_RATE);
}
}
}
}
void validateAndFixGyroConfig(void)