Skip to content

Commit 89eeb02

Browse files
committed
better fix to prevent pitch FMA flickering with autopilot
Signed-off-by: Octol1ttle <[email protected]>
1 parent e7fcdee commit 89eeb02

File tree

3 files changed

+5
-11
lines changed

3 files changed

+5
-11
lines changed

src/main/kotlin/ru/octol1ttle/flightassistant/impl/computer/autoflight/base/PitchComputer.kt

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -75,10 +75,10 @@ class PitchComputer(computers: ComputerBus) : Computer(computers), FlightControl
7575
if (canMoveOrBlockPitch() && finalInput.status == ControlInput.Status.ACTIVE) {
7676
var target: Float = finalInput.target
7777
if (!finalInput.priority.isHigherOrSame(minimumPitch?.priority)) {
78-
target = target.coerceAtLeast(minimumPitch!!.target)
78+
target = target.coerceAtLeast(minimumPitch!!.target + 1.0f)
7979
}
8080
if (!finalInput.priority.isHigherOrSame(maximumPitch?.priority)) {
81-
target = target.coerceAtMost(maximumPitch!!.target)
81+
target = target.coerceAtMost(maximumPitch!!.target - 1.0f)
8282
}
8383
smoothSetPitch(computers.data.player, pitch, target.throwIfNotInRange(-90.0f..90.0f), finalInput.deltaTimeMultiplier.throwIfNotInRange(0.001f..Float.MAX_VALUE))
8484
}
@@ -109,17 +109,11 @@ class PitchComputer(computers: ComputerBus) : Computer(computers), FlightControl
109109

110110
val max: ControlInput? = maximumPitch
111111
if (max != null && computers.data.pitch > max.target) {
112-
if (computers.data.pitch - max.target < 5.0f) {
113-
return max.copy(text = null)
114-
}
115112
return max
116113
}
117114

118115
val min: ControlInput? = minimumPitch
119116
if (min != null && computers.data.pitch < min.target) {
120-
if (min.target - computers.data.pitch < 5.0f) {
121-
return min.copy(text = null)
122-
}
123117
return min
124118
}
125119

src/main/kotlin/ru/octol1ttle/flightassistant/impl/computer/autoflight/modes/BuiltInVerticalModes.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ data class VerticalSpeedVerticalMode(val targetVerticalSpeed: Double, override v
3232
}
3333

3434
companion object {
35-
private val controller: PIDController = PIDController(1.75, 0.125, 0.3, 10, -70.0, 70.0)
35+
private val controller: PIDController = PIDController(1.8, 0.1, 0.35, 10, -85.0, 85.0)
3636
private var lastPitchCommand: Float = 0.0f
3737
}
3838
}

src/main/kotlin/ru/octol1ttle/flightassistant/impl/computer/safety/GroundProximityComputer.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ class GroundProximityComputer(computers: ComputerBus) : Computer(computers), Fli
5555
Status.SAFE
5656
} else if (groundImpactStatus == Status.SAFE && (data.velocityPerSecond.y > -10 || groundImpactTime > cautionThreshold)) {
5757
Status.SAFE
58-
} else if (data.velocityPerSecond.y > -7.5 || groundImpactTime > clearThreshold) {
58+
} else if (data.velocityPerSecond.y > -8.5 || groundImpactTime > clearThreshold) {
5959
Status.SAFE
6060
} else if (groundImpactStatus >= Status.CAUTION && groundImpactTime > warningThreshold) {
6161
Status.CAUTION
@@ -73,7 +73,7 @@ class GroundProximityComputer(computers: ComputerBus) : Computer(computers), Fli
7373
Status.SAFE
7474
} else if (obstacleImpactStatus == Status.SAFE && (damageOnCollision < data.player.health * 0.5f || obstacleImpactTime > groundImpactTime * 1.1f || obstacleImpactTime > cautionThreshold)) {
7575
Status.SAFE
76-
} else if (damageOnCollision < data.player.health * 0.25f || obstacleImpactTime > groundImpactTime * 1.5f || obstacleImpactTime > clearThreshold) {
76+
} else if (damageOnCollision < data.player.health * 0.25f || obstacleImpactTime > groundImpactTime * 1.2f || obstacleImpactTime > clearThreshold) {
7777
Status.SAFE
7878
} else if (obstacleImpactStatus >= Status.CAUTION && obstacleImpactTime > warningThreshold) {
7979
Status.CAUTION

0 commit comments

Comments
 (0)