@@ -2705,35 +2705,53 @@ pid_tuning.updateRatesLabels = function() {
2705
2705
const rcRate = self . currentRates . rc_rate ;
2706
2706
const rcRatePitch = self . currentRates . rc_rate_pitch ;
2707
2707
2708
+ function getOffsetForBalloon ( value ) {
2709
+ return curveWidth - ( Math . ceil ( stickContext . measureText ( value ) . width ) / ( stickContext . canvas . clientWidth / stickContext . canvas . clientHeight ) ) - 40 ;
2710
+ }
2711
+
2712
+ const angleModeText = `Angle Mode` ;
2713
+
2708
2714
if ( self . currentRatesType === FC . RATES_TYPE . ACTUAL ) {
2709
- drawAxisLabel ( stickContext , `Angle Mode` , ( curveWidth - 10 ) / textScale , curveHeight - 250 , 'right' ) ;
2715
+ drawAxisLabel ( stickContext , angleModeText , ( curveWidth - 10 ) / textScale , curveHeight - 250 , 'right' ) ;
2710
2716
2711
2717
const angleCenterSensitivityRoll = ( rcRate / maxAngleRollRate * angleLimit ) . toFixed ( 1 ) ;
2712
2718
const angleCenterSensitivityPitch = ( rcRatePitch / maxAnglePitchRate * angleLimit ) . toFixed ( 1 ) ;
2713
2719
2720
+ const angleCenterSensitivityRollText = `${ angleCenterSensitivityRoll } ...${ angleLimit } ` ;
2721
+ const angleCenterSensitivityPitchText = `${ angleCenterSensitivityPitch } ...${ angleLimit } ` ;
2722
+
2723
+ const angleCenterSensitivityRollOffset = getOffsetForBalloon ( angleCenterSensitivityRollText ) ;
2724
+ const angleCenterSensitivityPitchOffset = getOffsetForBalloon ( angleCenterSensitivityPitchText ) ;
2725
+
2714
2726
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 ) ; } } ,
2727
+ { value : parseInt ( angleCenterSensitivityRoll ) , balloon : function ( ) { drawBalloonLabel ( stickContext , angleCenterSensitivityRollText , angleCenterSensitivityRollOffset , curveHeight - 150 , 'none' , BALLOON_COLORS . roll , balloonsDirty ) ; } } ,
2728
+ { value : parseInt ( angleCenterSensitivityPitch ) , balloon : function ( ) { drawBalloonLabel ( stickContext , angleCenterSensitivityPitchText , angleCenterSensitivityPitchOffset , curveHeight - 50 , 'none' , BALLOON_COLORS . pitch , balloonsDirty ) ; } } ,
2717
2729
) ;
2718
2730
}
2719
2731
2720
2732
if ( self . currentRatesType === FC . RATES_TYPE . BETAFLIGHT ) {
2721
- drawAxisLabel ( stickContext , `Angle Mode` , ( curveWidth - 10 ) / textScale , curveHeight - 250 , 'right' ) ;
2733
+ drawAxisLabel ( stickContext , angleModeText , ( curveWidth - 10 ) / textScale , curveHeight - 250 , 'right' ) ;
2722
2734
2723
2735
const RC_RATE_INCREMENTAL = 14.54 ;
2724
2736
2725
2737
// ROLL
2726
2738
const expo = self . currentRates . rc_expo ;
2727
2739
const rcRateModified = rcRate > 2.0 ? ( rcRate - 2.0 ) * RC_RATE_INCREMENTAL + 2.0 : rcRate ;
2728
2740
const sensitivityFractionRoll = ( angleLimit * ( ( 1 - expo ) * rcRateModified * 200 / maxAngleRollRate ) ) . toFixed ( 1 ) ;
2741
+
2742
+ const sensitivityFractionRollText = `${ sensitivityFractionRoll } ...${ angleLimit } ` ;
2743
+ const sensitivityFractionRollOffset = getOffsetForBalloon ( sensitivityFractionRollText ) ;
2729
2744
// PITCH
2730
2745
const expoPitch = self . currentRates . rc_pitch_expo ;
2731
2746
const rcRateModifiedPitch = rcRatePitch > 2.0 ? ( rcRatePitch - 2.0 ) * RC_RATE_INCREMENTAL + 2.0 : rcRatePitch ;
2732
2747
const sensitivityFractionPitch = ( angleLimit * ( ( 1 - expoPitch ) * rcRateModifiedPitch * 200 / maxAnglePitchRate ) ) . toFixed ( 1 ) ;
2733
2748
2749
+ const sensitivityFractionPitchText = `${ sensitivityFractionPitch } ...${ angleLimit } ` ;
2750
+ const sensitivityFractionPitchOffset = getOffsetForBalloon ( sensitivityFractionPitchText ) ;
2751
+
2734
2752
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 ) ; } } ,
2753
+ { value : parseInt ( sensitivityFractionRoll ) , balloon : function ( ) { drawBalloonLabel ( stickContext , sensitivityFractionRollText , sensitivityFractionRollOffset , curveHeight - 150 , 'none' , BALLOON_COLORS . roll , balloonsDirty ) ; } } ,
2754
+ { value : parseInt ( sensitivityFractionPitch ) , balloon : function ( ) { drawBalloonLabel ( stickContext , sensitivityFractionPitchText , sensitivityFractionPitchOffset , curveHeight - 50 , 'none' , BALLOON_COLORS . pitch , balloonsDirty ) ; } } ,
2737
2755
) ;
2738
2756
}
2739
2757
0 commit comments