@@ -124,13 +124,13 @@ public override void UpdatePressure(ref float pressureBar, float elapsedClockSec
124
124
switch ( type )
125
125
{
126
126
case ControllerState . Release :
127
- IncreasePressure ( ref pressureBar , MaxPressureBar ( ) , ReleaseRateBarpS ( ) , elapsedClockSeconds ) ;
127
+ IncreasePressure ( ref pressureBar , Math . Min ( MaxPressureBar ( ) , MainReservoirPressureBar ( ) ) , ReleaseRateBarpS ( ) , elapsedClockSeconds ) ;
128
128
DecreasePressure ( ref pressureBar , MaxPressureBar ( ) , OverchargeEliminationRateBarpS ( ) , elapsedClockSeconds ) ;
129
129
epState = - 1 ;
130
130
break ;
131
131
case ControllerState . FullQuickRelease :
132
132
case ControllerState . SMEReleaseStart :
133
- IncreasePressure ( ref pressureBar , MaxPressureBar ( ) , QuickReleaseRateBarpS ( ) , elapsedClockSeconds ) ;
133
+ IncreasePressure ( ref pressureBar , Math . Min ( MaxPressureBar ( ) , MainReservoirPressureBar ( ) ) , QuickReleaseRateBarpS ( ) , elapsedClockSeconds ) ;
134
134
DecreasePressure ( ref pressureBar , MaxPressureBar ( ) , OverchargeEliminationRateBarpS ( ) , elapsedClockSeconds ) ;
135
135
epState = - 1 ;
136
136
break ;
@@ -197,7 +197,7 @@ public override void UpdatePressure(ref float pressureBar, float elapsedClockSec
197
197
x = MaxPressureBar ( ) - MinReductionBar ( ) * ( 1 - x ) - FullServReductionBar ( ) * x ;
198
198
DecreasePressure ( ref pressureBar , x , ApplyRateBarpS ( ) , elapsedClockSeconds ) ;
199
199
if ( ForceControllerReleaseGraduated || notch . Type == ControllerState . EPApply )
200
- IncreasePressure ( ref pressureBar , x , ReleaseRateBarpS ( ) , elapsedClockSeconds ) ;
200
+ IncreasePressure ( ref pressureBar , Math . Min ( x , MainReservoirPressureBar ( ) ) , ReleaseRateBarpS ( ) , elapsedClockSeconds ) ;
201
201
}
202
202
break ;
203
203
case ControllerState . GSelfLapH :
@@ -207,15 +207,15 @@ public override void UpdatePressure(ref float pressureBar, float elapsedClockSec
207
207
x = MaxPressureBar ( ) - MinReductionBar ( ) * ( 1 - x ) - FullServReductionBar ( ) * x ;
208
208
DecreasePressure ( ref pressureBar , x , ApplyRateBarpS ( ) , elapsedClockSeconds ) ;
209
209
if ( ForceControllerReleaseGraduated || notch . Type == ControllerState . GSelfLap )
210
- IncreasePressure ( ref pressureBar , x , ReleaseRateBarpS ( ) , elapsedClockSeconds ) ;
210
+ IncreasePressure ( ref pressureBar , Math . Min ( x , MainReservoirPressureBar ( ) ) , ReleaseRateBarpS ( ) , elapsedClockSeconds ) ;
211
211
break ;
212
212
case ControllerState . Emergency :
213
213
pressureBar -= EmergencyRateBarpS ( ) * elapsedClockSeconds ;
214
214
epState = 1 ;
215
215
break ;
216
216
case ControllerState . Dummy :
217
217
x = MaxPressureBar ( ) - FullServReductionBar ( ) * ( notch . Smooth ? x : CurrentValue ( ) ) ;
218
- IncreasePressure ( ref pressureBar , x , ReleaseRateBarpS ( ) , elapsedClockSeconds ) ;
218
+ IncreasePressure ( ref pressureBar , Math . Min ( x , MainReservoirPressureBar ( ) ) , ReleaseRateBarpS ( ) , elapsedClockSeconds ) ;
219
219
DecreasePressure ( ref pressureBar , x , ApplyRateBarpS ( ) , elapsedClockSeconds ) ;
220
220
epState = - 1 ;
221
221
break ;
0 commit comments