Decode ArmorBlock status register from PLC and surface individual statuses on Match Play page.

This commit is contained in:
Patrick Fairbank
2020-04-04 23:53:25 -07:00
parent 3739cd8690
commit 4e74a7a4cd
8 changed files with 102 additions and 11 deletions

View File

@@ -662,6 +662,11 @@ func (arena *Arena) checkCanStartMatch() error {
if arena.Plc.GetFieldEstop() {
return fmt.Errorf("Cannot start match while field emergency stop is active.")
}
for name, status := range arena.Plc.GetArmorBlockStatuses() {
if !status {
return fmt.Errorf("Cannot start match while PLC ArmorBlock '%s' is not connected.", name)
}
}
}
return nil

View File

@@ -89,11 +89,13 @@ func (arena *Arena) generateArenaStatusMessage() interface{} {
AllianceStations map[string]*AllianceStation
TeamWifiStatuses map[string]network.TeamWifiStatus
MatchState
CanStartMatch bool
PlcIsHealthy bool
FieldEstop bool
CanStartMatch bool
PlcIsHealthy bool
FieldEstop bool
PlcArmorBlockStatuses map[string]bool
}{arena.CurrentMatch.Id, arena.AllianceStations, teamWifiStatuses, arena.MatchState,
arena.checkCanStartMatch() == nil, arena.Plc.IsHealthy, arena.Plc.GetFieldEstop()}
arena.checkCanStartMatch() == nil, arena.Plc.IsHealthy, arena.Plc.GetFieldEstop(),
arena.Plc.GetArmorBlockStatuses()}
}
func (arena *Arena) generateAudienceDisplayModeMessage() interface{} {