Skip to content

Commit

Permalink
Fixed battery switch sound being repeted
Browse files Browse the repository at this point in the history
  • Loading branch information
Sharpe49 committed Oct 24, 2022
1 parent a84cab0 commit 72947b0
Showing 1 changed file with 6 additions and 6 deletions.
Expand Up @@ -235,47 +235,47 @@ public virtual void HandleEvent(PowerSupplyEvent evt)
switch (evt)
{
case PowerSupplyEvent.CloseBatterySwitch:
if (Mode == ModeType.Switch)
if (Mode == ModeType.Switch && !CommandSwitch)
{
CommandSwitch = true;
Wagon.SignalEvent(Event.BatterySwitchCommandOn);
}
break;

case PowerSupplyEvent.OpenBatterySwitch:
if (Mode == ModeType.Switch)
if (Mode == ModeType.Switch && CommandSwitch)
{
CommandSwitch = false;
Wagon.SignalEvent(Event.BatterySwitchCommandOff);
}
break;

case PowerSupplyEvent.CloseBatterySwitchButtonPressed:
if (Mode == ModeType.PushButtons)
if (Mode == ModeType.PushButtons && !CommandButtonOn)
{
CommandButtonOn = true;
Wagon.SignalEvent(Event.BatterySwitchCommandOn);
}
break;

case PowerSupplyEvent.CloseBatterySwitchButtonReleased:
if (Mode == ModeType.PushButtons)
if (Mode == ModeType.PushButtons && CommandButtonOn)
{
CommandButtonOn = false;
Wagon.SignalEvent(Event.BatterySwitchCommandOff);
}
break;

case PowerSupplyEvent.OpenBatterySwitchButtonPressed:
if (Mode == ModeType.PushButtons)
if (Mode == ModeType.PushButtons && !CommandButtonOff)
{
CommandButtonOff = true;
Wagon.SignalEvent(Event.BatterySwitchCommandOn);
}
break;

case PowerSupplyEvent.OpenBatterySwitchButtonReleased:
if (Mode == ModeType.PushButtons)
if (Mode == ModeType.PushButtons && CommandButtonOff)
{
CommandButtonOff = false;
Wagon.SignalEvent(Event.BatterySwitchCommandOff);
Expand Down

0 comments on commit 72947b0

Please sign in to comment.