mirror of
https://github.com/betaflight/betaflight.git
synced 2025-07-15 20:35:33 +03:00
Added profile macros and index functions
This commit is contained in:
parent
051c9cca48
commit
a3ad97b0a4
10 changed files with 123 additions and 132 deletions
|
@ -64,7 +64,7 @@ static controlRateConfig_t rateProfile;
|
|||
|
||||
static long cmsx_menuImu_onEnter(void)
|
||||
{
|
||||
profileIndex = systemConfig()->current_profile_index;
|
||||
profileIndex = getCurrentProfileIndex();
|
||||
tmpProfileIndex = profileIndex + 1;
|
||||
|
||||
rateProfileIndex = systemConfig()->activeRateProfile;
|
||||
|
@ -77,8 +77,8 @@ static long cmsx_menuImu_onExit(const OSD_Entry *self)
|
|||
{
|
||||
UNUSED(self);
|
||||
|
||||
systemConfigMutable()->current_profile_index = profileIndex;
|
||||
systemConfigMutable()->activeRateProfile = rateProfileIndex;
|
||||
changeProfile(profileIndex);
|
||||
changeControlRateProfile(rateProfileIndex);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -106,7 +106,7 @@ static long cmsx_rateProfileIndexOnChange(displayPort_t *displayPort, const void
|
|||
static long cmsx_PidRead(void)
|
||||
{
|
||||
|
||||
const pidProfile_t *pidProfile = &masterConfig.profile[profileIndex].pidProfile;
|
||||
const pidProfile_t *pidProfile = pidProfiles(profileIndex);
|
||||
for (uint8_t i = 0; i < 3; i++) {
|
||||
tempPid[i][0] = pidProfile->P8[i];
|
||||
tempPid[i][1] = pidProfile->I8[i];
|
||||
|
@ -128,7 +128,7 @@ static long cmsx_PidWriteback(const OSD_Entry *self)
|
|||
{
|
||||
UNUSED(self);
|
||||
|
||||
pidProfile_t *pidProfile = &masterConfig.profile[profileIndex].pidProfile;
|
||||
pidProfile_t *pidProfile = pidProfilesMutable(profileIndex);
|
||||
for (uint8_t i = 0; i < 3; i++) {
|
||||
pidProfile->P8[i] = tempPid[i][0];
|
||||
pidProfile->I8[i] = tempPid[i][1];
|
||||
|
@ -237,7 +237,7 @@ static long cmsx_profileOtherOnEnter(void)
|
|||
{
|
||||
profileIndexString[1] = '0' + tmpProfileIndex;
|
||||
|
||||
const pidProfile_t *pidProfile = &masterConfig.profile[profileIndex].pidProfile;
|
||||
const pidProfile_t *pidProfile = pidProfiles(profileIndex);
|
||||
cmsx_dtermSetpointWeight = pidProfile->dtermSetpointWeight;
|
||||
cmsx_setpointRelaxRatio = pidProfile->setpointRelaxRatio;
|
||||
|
||||
|
@ -252,7 +252,7 @@ static long cmsx_profileOtherOnExit(const OSD_Entry *self)
|
|||
{
|
||||
UNUSED(self);
|
||||
|
||||
pidProfile_t *pidProfile = &masterConfig.profile[profileIndex].pidProfile;
|
||||
pidProfile_t *pidProfile = pidProfilesMutable(profileIndex);
|
||||
pidProfile->dtermSetpointWeight = cmsx_dtermSetpointWeight;
|
||||
pidProfile->setpointRelaxRatio = cmsx_setpointRelaxRatio;
|
||||
pidInitConfig(¤tProfile->pidProfile);
|
||||
|
@ -347,7 +347,7 @@ static uint16_t cmsx_yaw_p_limit;
|
|||
|
||||
static long cmsx_FilterPerProfileRead(void)
|
||||
{
|
||||
const pidProfile_t *pidProfile = &masterConfig.profile[profileIndex].pidProfile;
|
||||
const pidProfile_t *pidProfile = pidProfiles(profileIndex);
|
||||
cmsx_dterm_lpf_hz = pidProfile->dterm_lpf_hz;
|
||||
cmsx_dterm_notch_hz = pidProfile->dterm_notch_hz;
|
||||
cmsx_dterm_notch_cutoff = pidProfile->dterm_notch_cutoff;
|
||||
|
@ -361,7 +361,7 @@ static long cmsx_FilterPerProfileWriteback(const OSD_Entry *self)
|
|||
{
|
||||
UNUSED(self);
|
||||
|
||||
pidProfile_t *pidProfile = &masterConfig.profile[profileIndex].pidProfile;
|
||||
pidProfile_t *pidProfile = pidProfilesMutable(profileIndex);
|
||||
pidProfile->dterm_lpf_hz = cmsx_dterm_lpf_hz;
|
||||
pidProfile->dterm_notch_hz = cmsx_dterm_notch_hz;
|
||||
pidProfile->dterm_notch_cutoff = cmsx_dterm_notch_cutoff;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue