@@ -124,13 +124,13 @@ public override void UpdatePressure(ref float pressureBar, float elapsedClockSec
124124 switch ( type )
125125 {
126126 case ControllerState . Release :
127- IncreasePressure ( ref pressureBar , MaxPressureBar ( ) , ReleaseRateBarpS ( ) , elapsedClockSeconds ) ;
127+ IncreasePressure ( ref pressureBar , Math . Min ( MaxPressureBar ( ) , MainReservoirPressureBar ( ) ) , ReleaseRateBarpS ( ) , elapsedClockSeconds ) ;
128128 DecreasePressure ( ref pressureBar , MaxPressureBar ( ) , OverchargeEliminationRateBarpS ( ) , elapsedClockSeconds ) ;
129129 epState = - 1 ;
130130 break ;
131131 case ControllerState . FullQuickRelease :
132132 case ControllerState . SMEReleaseStart :
133- IncreasePressure ( ref pressureBar , MaxPressureBar ( ) , QuickReleaseRateBarpS ( ) , elapsedClockSeconds ) ;
133+ IncreasePressure ( ref pressureBar , Math . Min ( MaxPressureBar ( ) , MainReservoirPressureBar ( ) ) , QuickReleaseRateBarpS ( ) , elapsedClockSeconds ) ;
134134 DecreasePressure ( ref pressureBar , MaxPressureBar ( ) , OverchargeEliminationRateBarpS ( ) , elapsedClockSeconds ) ;
135135 epState = - 1 ;
136136 break ;
@@ -197,7 +197,7 @@ public override void UpdatePressure(ref float pressureBar, float elapsedClockSec
197197 x = MaxPressureBar ( ) - MinReductionBar ( ) * ( 1 - x ) - FullServReductionBar ( ) * x ;
198198 DecreasePressure ( ref pressureBar , x , ApplyRateBarpS ( ) , elapsedClockSeconds ) ;
199199 if ( ForceControllerReleaseGraduated || notch . Type == ControllerState . EPApply )
200- IncreasePressure ( ref pressureBar , x , ReleaseRateBarpS ( ) , elapsedClockSeconds ) ;
200+ IncreasePressure ( ref pressureBar , Math . Min ( x , MainReservoirPressureBar ( ) ) , ReleaseRateBarpS ( ) , elapsedClockSeconds ) ;
201201 }
202202 break ;
203203 case ControllerState . GSelfLapH :
@@ -207,15 +207,15 @@ public override void UpdatePressure(ref float pressureBar, float elapsedClockSec
207207 x = MaxPressureBar ( ) - MinReductionBar ( ) * ( 1 - x ) - FullServReductionBar ( ) * x ;
208208 DecreasePressure ( ref pressureBar , x , ApplyRateBarpS ( ) , elapsedClockSeconds ) ;
209209 if ( ForceControllerReleaseGraduated || notch . Type == ControllerState . GSelfLap )
210- IncreasePressure ( ref pressureBar , x , ReleaseRateBarpS ( ) , elapsedClockSeconds ) ;
210+ IncreasePressure ( ref pressureBar , Math . Min ( x , MainReservoirPressureBar ( ) ) , ReleaseRateBarpS ( ) , elapsedClockSeconds ) ;
211211 break ;
212212 case ControllerState . Emergency :
213213 pressureBar -= EmergencyRateBarpS ( ) * elapsedClockSeconds ;
214214 epState = 1 ;
215215 break ;
216216 case ControllerState . Dummy :
217217 x = MaxPressureBar ( ) - FullServReductionBar ( ) * ( notch . Smooth ? x : CurrentValue ( ) ) ;
218- IncreasePressure ( ref pressureBar , x , ReleaseRateBarpS ( ) , elapsedClockSeconds ) ;
218+ IncreasePressure ( ref pressureBar , Math . Min ( x , MainReservoirPressureBar ( ) ) , ReleaseRateBarpS ( ) , elapsedClockSeconds ) ;
219219 DecreasePressure ( ref pressureBar , x , ApplyRateBarpS ( ) , elapsedClockSeconds ) ;
220220 epState = - 1 ;
221221 break ;
0 commit comments