Skip to content

Commit 82ef736

Browse files
When using the battery switch two buttons option in combination with a delay:
Engine ( ORTSBattery ( Mode ( PushButtons ) Delay ( 2s ) DefaultOn ( 1 ) ) battery does not get switched on/off.
1 parent 5db05ff commit 82ef736

File tree

1 file changed

+3
-17
lines changed
  • Source/Orts.Simulation/Simulation/RollingStocks/SubSystems/PowerSupplies

1 file changed

+3
-17
lines changed

Source/Orts.Simulation/Simulation/RollingStocks/SubSystems/PowerSupplies/BatterySwitch.cs

+3-17
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// COPYRIGHT 2020 by the Open Rails project.
1+
// COPYRIGHT 2020 by the Open Rails project.
22
//
33
// This file is part of Open Rails.
44
//
@@ -211,6 +211,7 @@ public virtual void Update(float elapsedClockSeconds)
211211
if (Timer.Triggered)
212212
{
213213
On = false;
214+
CommandButtonOff = false;
214215
Wagon.SignalEvent(Event.BatterySwitchOff);
215216
Timer.Stop();
216217
}
@@ -235,6 +236,7 @@ public virtual void Update(float elapsedClockSeconds)
235236
if (Timer.Triggered)
236237
{
237238
On = true;
239+
CommandButtonOn = false;
238240
Wagon.SignalEvent(Event.BatterySwitchOn);
239241
Timer.Stop();
240242
}
@@ -279,29 +281,13 @@ public virtual void HandleEvent(PowerSupplyEvent evt)
279281
}
280282
break;
281283

282-
case PowerSupplyEvent.CloseBatterySwitchButtonReleased:
283-
if (Mode == ModeType.PushButtons && CommandButtonOn)
284-
{
285-
CommandButtonOn = false;
286-
Wagon.SignalEvent(Event.BatterySwitchCommandOff);
287-
}
288-
break;
289-
290284
case PowerSupplyEvent.OpenBatterySwitchButtonPressed:
291285
if (Mode == ModeType.PushButtons && !CommandButtonOff)
292286
{
293287
CommandButtonOff = true;
294288
Wagon.SignalEvent(Event.BatterySwitchCommandOn);
295289
}
296290
break;
297-
298-
case PowerSupplyEvent.OpenBatterySwitchButtonReleased:
299-
if (Mode == ModeType.PushButtons && CommandButtonOff)
300-
{
301-
CommandButtonOff = false;
302-
Wagon.SignalEvent(Event.BatterySwitchCommandOff);
303-
}
304-
break;
305291
}
306292
}
307293
}

0 commit comments

Comments
 (0)