mirror of
https://github.com/betaflight/betaflight.git
synced 2025-07-15 20:35:33 +03:00
Add config reload to inflight adjustments and osd
This commit is contained in:
parent
4a0f678dec
commit
29690b9c00
3 changed files with 6 additions and 2 deletions
|
@ -130,6 +130,7 @@ static long cmsx_PidWriteback(const OSD_Entry *self)
|
||||||
masterConfig.profile[profileIndex].pidProfile.I8[i] = tempPid[i][1];
|
masterConfig.profile[profileIndex].pidProfile.I8[i] = tempPid[i][1];
|
||||||
masterConfig.profile[profileIndex].pidProfile.D8[i] = tempPid[i][2];
|
masterConfig.profile[profileIndex].pidProfile.D8[i] = tempPid[i][2];
|
||||||
}
|
}
|
||||||
|
pidInitConfig(¤tProfile->pidProfile);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -248,6 +249,7 @@ static long cmsx_profileOtherOnExit(const OSD_Entry *self)
|
||||||
|
|
||||||
masterConfig.profile[profileIndex].pidProfile.dtermSetpointWeight = cmsx_dtermSetpointWeight;
|
masterConfig.profile[profileIndex].pidProfile.dtermSetpointWeight = cmsx_dtermSetpointWeight;
|
||||||
masterConfig.profile[profileIndex].pidProfile.setpointRelaxRatio = cmsx_setpointRelaxRatio;
|
masterConfig.profile[profileIndex].pidProfile.setpointRelaxRatio = cmsx_setpointRelaxRatio;
|
||||||
|
pidInitConfig(¤tProfile->pidProfile);
|
||||||
|
|
||||||
masterConfig.profile[profileIndex].pidProfile.P8[PIDLEVEL] = cmsx_angleStrength;
|
masterConfig.profile[profileIndex].pidProfile.P8[PIDLEVEL] = cmsx_angleStrength;
|
||||||
masterConfig.profile[profileIndex].pidProfile.I8[PIDLEVEL] = cmsx_horizonStrength;
|
masterConfig.profile[profileIndex].pidProfile.I8[PIDLEVEL] = cmsx_horizonStrength;
|
||||||
|
|
|
@ -579,7 +579,7 @@ static void applyStepAdjustment(controlRateConfig_t *controlRateConfig, uint8_t
|
||||||
case ADJUSTMENT_ROLL_D:
|
case ADJUSTMENT_ROLL_D:
|
||||||
newValue = constrain((int)pidProfile->D8[PIDROLL] + delta, 0, 200); // FIXME magic numbers repeated in serial_cli.c
|
newValue = constrain((int)pidProfile->D8[PIDROLL] + delta, 0, 200); // FIXME magic numbers repeated in serial_cli.c
|
||||||
pidProfile->D8[PIDROLL] = newValue;
|
pidProfile->D8[PIDROLL] = newValue;
|
||||||
blackboxLogInflightAdjustmentEvent(ADJUSTMENT_ROLL_D, newValue);
|
blackboxLogInflightAdjustmentEvent(ADJUSTMENT_ROLL_D, newValue);
|
||||||
break;
|
break;
|
||||||
case ADJUSTMENT_YAW_P:
|
case ADJUSTMENT_YAW_P:
|
||||||
newValue = constrain((int)pidProfile->P8[PIDYAW] + delta, 0, 200); // FIXME magic numbers repeated in serial_cli.c
|
newValue = constrain((int)pidProfile->P8[PIDYAW] + delta, 0, 200); // FIXME magic numbers repeated in serial_cli.c
|
||||||
|
@ -676,7 +676,8 @@ void processRcAdjustments(controlRateConfig_t *controlRateConfig, rxConfig_t *rx
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
applyStepAdjustment(controlRateConfig, adjustmentFunction, delta);
|
applyStepAdjustment(controlRateConfig,adjustmentFunction,delta);
|
||||||
|
pidInitConfig(pidProfile);
|
||||||
} else if (adjustmentState->config->mode == ADJUSTMENT_MODE_SELECT) {
|
} else if (adjustmentState->config->mode == ADJUSTMENT_MODE_SELECT) {
|
||||||
uint16_t rangeWidth = ((2100 - 900) / adjustmentState->config->data.selectConfig.switchPositions);
|
uint16_t rangeWidth = ((2100 - 900) / adjustmentState->config->data.selectConfig.switchPositions);
|
||||||
uint8_t position = (constrain(rcData[channelIndex], 900, 2100 - 1) - 900) / rangeWidth;
|
uint8_t position = (constrain(rcData[channelIndex], 900, 2100 - 1) - 900) / rangeWidth;
|
||||||
|
|
|
@ -708,6 +708,7 @@ static bool bstSlaveProcessFeedbackCommand(uint8_t bstRequest)
|
||||||
bstWrite8(currentProfile->pidProfile.I8[i]);
|
bstWrite8(currentProfile->pidProfile.I8[i]);
|
||||||
bstWrite8(currentProfile->pidProfile.D8[i]);
|
bstWrite8(currentProfile->pidProfile.D8[i]);
|
||||||
}
|
}
|
||||||
|
pidInitConfig(¤tProfile->pidProfile);
|
||||||
break;
|
break;
|
||||||
case BST_PIDNAMES:
|
case BST_PIDNAMES:
|
||||||
bstWriteNames(pidnames);
|
bstWriteNames(pidnames);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue