Skip to content

Commit 9e07b12

Browse files
authored
Add angle mode center sensitivity (#3910)
1 parent 6b7b06e commit 9e07b12

File tree

1 file changed

+41
-0
lines changed

1 file changed

+41
-0
lines changed

src/js/tabs/pid_tuning.js

+41
Original file line numberDiff line numberDiff line change
@@ -2696,6 +2696,47 @@ pid_tuning.updateRatesLabels = function() {
26962696
{value: parseInt(currentValues[2]), balloon: function() {drawBalloonLabel(stickContext, currentValues[2], 10, 350, 'none', BALLOON_COLORS.yaw, balloonsDirty);}},
26972697
);
26982698
}
2699+
2700+
// Add labels for angleCenterSensitivity
2701+
2702+
const angleLimit = FC.ADVANCED_TUNING.levelAngleLimit;
2703+
const maxAngleRollRate = parseInt(maxAngularVelRoll);
2704+
const maxAnglePitchRate = parseInt(maxAngularVelPitch);
2705+
const rcRate = self.currentRates.rc_rate;
2706+
const rcRatePitch = self.currentRates.rc_rate_pitch;
2707+
2708+
if (self.currentRatesType === FC.RATES_TYPE.ACTUAL) {
2709+
drawAxisLabel(stickContext, `Angle Mode`, (curveWidth - 10) / textScale, curveHeight - 250, 'right');
2710+
2711+
const angleCenterSensitivityRoll = (rcRate / maxAngleRollRate * angleLimit).toFixed(1);
2712+
const angleCenterSensitivityPitch = (rcRatePitch / maxAnglePitchRate * angleLimit).toFixed(1);
2713+
2714+
balloons.push(
2715+
{value: parseInt(angleCenterSensitivityRoll), balloon: function() {drawBalloonLabel(stickContext, `${angleCenterSensitivityRoll}...${angleLimit}`, ((curveWidth / 2) - 10) / textScale, curveHeight - 150, 'none', BALLOON_COLORS.roll, balloonsDirty);}},
2716+
{value: parseInt(angleCenterSensitivityPitch), balloon: function() {drawBalloonLabel(stickContext, `${angleCenterSensitivityPitch}...${angleLimit}`, ((curveWidth / 2) - 10) / textScale, curveHeight - 50, 'none', BALLOON_COLORS.pitch, balloonsDirty);}},
2717+
);
2718+
}
2719+
2720+
if (self.currentRatesType === FC.RATES_TYPE.BETAFLIGHT) {
2721+
drawAxisLabel(stickContext, `Angle Mode`, (curveWidth - 10) / textScale, curveHeight - 250, 'right');
2722+
2723+
const RC_RATE_INCREMENTAL = 14.54;
2724+
2725+
// ROLL
2726+
const expo = self.currentRates.rc_expo;
2727+
const rcRateModified = rcRate > 2.0 ? (rcRate - 2.0) * RC_RATE_INCREMENTAL + 2.0: rcRate;
2728+
const sensitivityFractionRoll = (angleLimit * ((1 - expo) * rcRateModified * 200 / maxAngleRollRate)).toFixed(1);
2729+
// PITCH
2730+
const expoPitch = self.currentRates.rc_pitch_expo;
2731+
const rcRateModifiedPitch = rcRatePitch > 2.0 ? (rcRatePitch - 2.0) * RC_RATE_INCREMENTAL + 2.0: rcRatePitch;
2732+
const sensitivityFractionPitch = (angleLimit * ((1 - expoPitch) * rcRateModifiedPitch * 200 / maxAnglePitchRate)).toFixed(1);
2733+
2734+
balloons.push(
2735+
{value: parseInt(sensitivityFractionRoll), balloon: function() {drawBalloonLabel(stickContext, `${sensitivityFractionRoll}...${angleLimit}`, ((curveWidth / 2) - 10) / textScale, curveHeight - 150, 'none', BALLOON_COLORS.roll, balloonsDirty);}},
2736+
{value: parseInt(sensitivityFractionPitch), balloon: function() {drawBalloonLabel(stickContext, `${sensitivityFractionPitch}...${angleLimit}`, ((curveWidth / 2) - 10) / textScale, curveHeight - 50, 'none', BALLOON_COLORS.pitch, balloonsDirty);}},
2737+
);
2738+
}
2739+
26992740
// then display them on the chart
27002741
for (const balloon of balloons) {
27012742
balloon.balloon();

0 commit comments

Comments
 (0)