Turn off cargo ship lights during sandstorm period as well.

This commit is contained in:
Patrick Fairbank
2019-09-22 10:33:55 -07:00
parent 92a52ddd88
commit e947151bb3
2 changed files with 12 additions and 2 deletions

View File

@@ -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)
}

View File

@@ -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) {