diff --git a/src/js/tabs/pid_tuning.js b/src/js/tabs/pid_tuning.js index ada073e1df3..d21ad2d722c 100644 --- a/src/js/tabs/pid_tuning.js +++ b/src/js/tabs/pid_tuning.js @@ -2698,17 +2698,17 @@ pid_tuning.updateRatesLabels = function() { } // Add labels for angleCenterSensitivity + + const maxAngleRollRate = parseInt(maxAngularVelRoll); + const maxAnglePitchRate = parseInt(maxAngularVelPitch); + const angleLimit = FC.ADVANCED_TUNING.levelAngleLimit; + if (self.currentRatesType === FC.RATES_TYPE.ACTUAL) { drawAxisLabel(stickContext, `Angle Mode`, (curveWidth - 10) / textScale, curveHeight - 250, 'right'); const centerSensitivityRoll = self.currentRates.rc_rate; const centerSensitivityPitch = self.currentRates.rc_rate_pitch; - const maxAngleRollRate = parseInt(maxAngularVelRoll); - const maxAnglePitchRate = parseInt(maxAngularVelPitch); - - const angleLimit = FC.ADVANCED_TUNING.levelAngleLimit; - const angleCenterSensitivityRoll = (centerSensitivityRoll / maxAngleRollRate * angleLimit).toFixed(1); const angleCenterSensitivityPitch = (centerSensitivityPitch / maxAnglePitchRate * angleLimit).toFixed(1); @@ -2718,6 +2718,28 @@ pid_tuning.updateRatesLabels = function() { ); } + if (self.currentRatesType === FC.RATES_TYPE.BETAFLIGHT) { + drawAxisLabel(stickContext, `Angle Mode`, (curveWidth - 10) / textScale, curveHeight - 250, 'right'); + + const RC_RATE_INCREMENTAL = 14.54; + + // ROLL + const expo = self.currentRates.rc_expo / 100; + const rcRate = self.currentRates.rc_rate / 100; + const rcRateModified = rcRate > 2.0 ? rcRate + RC_RATE_INCREMENTAL * (rcRate - 2.0) : rcRate; + const sensitivityFractionRoll = (angleLimit * (1 - expo) * rcRateModified * 200 / maxAngleRollRate).toFixed(1); + // PITCH + const expoPitch = self.currentRates.rc_pitch_expo / 100; + const rcRatePitch = self.currentRates.rc_rate_pitch / 100; + const rcRateModifiedPitch = rcRatePitch > 2.0 ? rcRatePitch + RC_RATE_INCREMENTAL * (rcRatePitch - 2.0) : rcRatePitch; + const sensitivityFractionPitch = (angleLimit * (1 - expoPitch) * rcRateModifiedPitch * 200 / maxAnglePitchRate).toFixed(1); + + balloons.push( + {value: parseInt(sensitivityFractionRoll), balloon: function() {drawBalloonLabel(stickContext, `${sensitivityFractionRoll}...${angleLimit}`, ((curveWidth / 2) - 10) / textScale, curveHeight - 150, 'none', BALLOON_COLORS.roll, balloonsDirty);}}, + {value: parseInt(sensitivityFractionPitch), balloon: function() {drawBalloonLabel(stickContext, `${sensitivityFractionPitch}...${angleLimit}`, ((curveWidth / 2) - 10) / textScale, curveHeight - 50, 'none', BALLOON_COLORS.pitch, balloonsDirty);}}, + ); + } + // then display them on the chart for (const balloon of balloons) { balloon.balloon();