From e947151bb35b1da7fb61427bd8271b5a83d69d69 Mon Sep 17 00:00:00 2001 From: Patrick Fairbank Date: Sun, 22 Sep 2019 10:33:55 -0700 Subject: [PATCH] Turn off cargo ship lights during sandstorm period as well. --- field/arena.go | 7 +++++++ plc/plc.go | 7 +++++-- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/field/arena.go b/field/arena.go index 2d441ca..a8b31d8 100644 --- a/field/arena.go +++ b/field/arena.go @@ -739,6 +739,7 @@ func (arena *Arena) handlePlcOutput() { arena.Plc.SetFieldResetLight(false) } + arena.Plc.SetCargoShipLights(true) arena.Plc.SetCargoShipMagnets(true) arena.Plc.SetRocketLights(false, false) case PostMatch: @@ -748,8 +749,13 @@ func (arena *Arena) handlePlcOutput() { scoreReady := arena.RedRealtimeScore.FoulsCommitted && arena.BlueRealtimeScore.FoulsCommitted && arena.alliancePostMatchScoreReady("red") && arena.alliancePostMatchScoreReady("blue") arena.Plc.SetStackLights(false, false, !scoreReady, false) + arena.Plc.SetCargoShipLights(true) arena.Plc.SetCargoShipMagnets(true) arena.Plc.SetRocketLights(false, false) + case AutoPeriod: + fallthrough + case PausePeriod: + arena.Plc.SetCargoShipLights(false) case TeleopPeriod: if arena.lastMatchState != TeleopPeriod { arena.Plc.SetSandstormUp(true) @@ -758,6 +764,7 @@ func (arena *Arena) handlePlcOutput() { arena.Plc.SetSandstormUp(false) }() } + arena.Plc.SetCargoShipLights(false) arena.Plc.SetCargoShipMagnets(false) arena.Plc.SetRocketLights(arena.RedScoreSummary().CompleteRocket, arena.BlueScoreSummary().CompleteRocket) } diff --git a/plc/plc.go b/plc/plc.go index b843964..05c45ed 100644 --- a/plc/plc.go +++ b/plc/plc.go @@ -186,11 +186,14 @@ func (plc *Plc) SetSandstormUp(state bool) { plc.coils[sandstormUpBlue] = state } +func (plc *Plc) SetCargoShipLights(state bool) { + plc.coils[cargoShipLightRed] = state + plc.coils[cargoShipLightBlue] = state +} + func (plc *Plc) SetCargoShipMagnets(state bool) { plc.coils[cargoShipMagnetRed] = state plc.coils[cargoShipMagnetBlue] = state - plc.coils[cargoShipLightRed] = state - plc.coils[cargoShipLightBlue] = state } func (plc *Plc) SetRocketLights(red, blue bool) {