Skip to content

Commit 8555a4b

Browse files
committed
Disable dynamic brake locking
1 parent d4e79e2 commit 8555a4b

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

Source/Orts.Simulation/Simulation/RollingStocks/MSTSLocomotive.cs

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -379,6 +379,7 @@ public float OdometerM
379379
public double? DynamicBrakeCommandStartTime;
380380
protected bool DynamicBrakeBlendingOverride; // true when DB lever >0% should always override the blending. When false, the bigger command is applied.
381381
protected bool DynamicBrakeBlendingForceMatch = true; // if true, dynamic brake blending tries to achieve the same braking force as the airbrake would have.
382+
protected bool DynamicBrakeControllerSetupLock; // if true if dynamic brake lever will lock until dynamic brake is available
382383

383384
public float DynamicBrakeBlendingPercent { get; protected set; } = -1;
384385

@@ -2036,7 +2037,7 @@ public override void Update(float elapsedClockSeconds)
20362037
ThrottleController.UpdateValue > 0 ? CabSetting.Increase : CabSetting.Decrease,
20372038
ThrottleController.CurrentValue * 100);
20382039
}
2039-
if (DynamicBrakeController != null && DynamicBrakeController.UpdateValue != 0.0 && DynamicBrake)
2040+
if (DynamicBrakeController != null && DynamicBrakeController.UpdateValue != 0.0 && (DynamicBrake || !DynamicBrakeControllerSetupLock))
20402041
{
20412042
Simulator.Confirmer.UpdateWithPerCent(
20422043
CabControl.DynamicBrake,
@@ -2242,7 +2243,7 @@ protected virtual void UpdateControllers(float elapsedClockSeconds)
22422243
}
22432244
if (DynamicBrakeController != null && DynamicBrakeIntervention >= 0)
22442245
{
2245-
if (DynamicBrake)
2246+
if (DynamicBrake || !DynamicBrakeControllerSetupLock)
22462247
{
22472248
DynamicBrakeController.Update(elapsedClockSeconds);
22482249
DynamicBrakeIntervention = DynamicBrakeController.CurrentValue;
@@ -4461,7 +4462,7 @@ public void StartDynamicBrakeIncrease(float? target)
44614462
{
44624463
DynamicBrakeChangeActiveState(true);
44634464
}
4464-
else if (DynamicBrake)
4465+
else if (DynamicBrake || !DynamicBrakeControllerSetupLock)
44654466
{
44664467
SignalEvent(Event.DynamicBrakeChange);
44674468
DynamicBrakeController.StartIncrease(target);
@@ -4493,7 +4494,7 @@ public void StartDynamicBrakeDecrease(float? target)
44934494
{
44944495
DynamicBrakeChangeActiveState(false);
44954496
}
4496-
else if (DynamicBrake)
4497+
else if (DynamicBrake || !DynamicBrakeControllerSetupLock)
44974498
{
44984499
SignalEvent(Event.DynamicBrakeChange);
44994500
DynamicBrakeController.StartDecrease(target);
@@ -4548,7 +4549,7 @@ public void SetDynamicBrakeValue(float value)
45484549
DynamicBrakeChangeActiveState(false);
45494550
return;
45504551
}
4551-
if (!DynamicBrake || CruiseControl != null && CruiseControl.UseThrottleAsForceSelector && !CruiseControl.DynamicBrakePriority && !CruiseControl.UseThrottleInCombinedControl)
4552+
if ((!DynamicBrake && DynamicBrakeControllerSetupLock) || CruiseControl != null && CruiseControl.UseThrottleAsForceSelector && !CruiseControl.DynamicBrakePriority && !CruiseControl.UseThrottleInCombinedControl)
45524553
return;
45534554

45544555
var controller = DynamicBrakeController;

0 commit comments

Comments
 (0)