@@ -136,7 +136,7 @@ public override float Update(float elapsedSeconds)
136
136
break ;
137
137
}
138
138
139
- NeutralModeOn = NeutralModeCommandSwitchOn || EmergencyBrakingPushButton ( ) || TCSEmergencyBraking ( ) ;
139
+ NeutralModeOn = NeutralModeCommandSwitchOn || EmergencyBrakingPushButton ( ) || TCSEmergencyBraking ( ) || ! IsAuxiliaryPowerSupplyOn ( ) ;
140
140
141
141
return CurrentValue ( ) ;
142
142
}
@@ -266,18 +266,20 @@ public override void UpdatePressure(ref float pressureBar, float elapsedClockSec
266
266
break ;
267
267
}
268
268
case State . Emergency :
269
- SetUpdateValue ( 1 ) ;
270
-
271
- pressureBar -= EmergencyRateBarpS ( ) * elapsedClockSeconds ;
269
+ {
270
+ SetUpdateValue ( 1 ) ;
272
271
273
- if ( pressureBar < 0 )
274
- pressureBar = 0 ;
275
- break ;
272
+ float dp = EmergencyRateBarpS ( ) * elapsedClockSeconds ;
273
+ if ( pressureBar - dp < MaxPressureBar ( ) - FullServReductionBar ( ) )
274
+ dp = Math . Max ( pressureBar - ( MaxPressureBar ( ) - FullServReductionBar ( ) ) , 0 ) ;
275
+ pressureBar -= dp ;
276
+ break ;
277
+ }
276
278
}
277
279
278
280
if ( BrakePipePressureBar ( ) > Math . Max ( MaxPressureBar ( ) - FullServReductionBar ( ) , pressureBar ) + EpActivationThresholdBar )
279
281
epPressureBar = 1 ; // EP application wire
280
- else if ( CurrentState != State . Emergency && BrakePipePressureBar ( ) >= MaxPressureBar ( ) - FullServReductionBar ( ) && BrakePipePressureBar ( ) < Math . Min ( MaxPressureBar ( ) , pressureBar ) - EpActivationThresholdBar )
282
+ else if ( ! NeutralModeOn && BrakePipePressureBar ( ) >= MaxPressureBar ( ) - FullServReductionBar ( ) && BrakePipePressureBar ( ) < Math . Min ( MaxPressureBar ( ) , pressureBar ) - EpActivationThresholdBar )
281
283
epPressureBar = 0 ; // EP release wire
282
284
else
283
285
epPressureBar = - 1 ;
@@ -391,8 +393,16 @@ public override bool IsValid()
391
393
392
394
public override ControllerState GetState ( )
393
395
{
394
- if ( CurrentState != State . Emergency && NeutralModeOn )
395
- return ControllerState . Neutral ;
396
+ if ( NeutralModeOn )
397
+ {
398
+ switch ( CurrentState )
399
+ {
400
+ case State . Emergency :
401
+ return ControllerState . Emergency ;
402
+ default :
403
+ return ControllerState . Lap ;
404
+ }
405
+ }
396
406
switch ( CurrentState )
397
407
{
398
408
case State . Overcharge :
0 commit comments