diff --git a/field/arena.go b/field/arena.go index 419f81e..6e9456d 100644 --- a/field/arena.go +++ b/field/arena.go @@ -68,7 +68,6 @@ type Arena struct { AllianceStationDisplayMode string AllianceSelectionAlliances [][]model.AllianceTeam LowerThird *model.LowerThird - BypassPreMatchScore bool MuteMatchSounds bool matchAborted bool soundsPlayed map[*game.MatchSound]struct{} @@ -338,7 +337,6 @@ func (arena *Arena) ResetMatch() error { arena.AllianceStations["B1"].Bypass = false arena.AllianceStations["B2"].Bypass = false arena.AllianceStations["B3"].Bypass = false - arena.BypassPreMatchScore = false arena.MuteMatchSounds = false return nil } @@ -640,10 +638,6 @@ func (arena *Arena) checkCanStartMatch() error { return err } - if !arena.BypassPreMatchScore { - return fmt.Errorf("Cannot start match until pre-match scoring is set") - } - if arena.EventSettings.PlcAddress != "" { if !arena.Plc.IsHealthy { return fmt.Errorf("Cannot start match while PLC is not healthy.") @@ -735,11 +729,9 @@ func (arena *Arena) handlePlcOutput() { // not input, or blinking green if ready. redAllianceReady := arena.checkAllianceStationsReady("R1", "R2", "R3") == nil blueAllianceReady := arena.checkAllianceStationsReady("B1", "B2", "B3") == nil - preMatchScoreReady := arena.BypassPreMatchScore - greenStackLight := redAllianceReady && blueAllianceReady && preMatchScoreReady && - arena.Plc.GetCycleState(2, 0, 2) - arena.Plc.SetStackLights(!redAllianceReady, !blueAllianceReady, !preMatchScoreReady, greenStackLight) - arena.Plc.SetStackBuzzer(redAllianceReady && blueAllianceReady && preMatchScoreReady) + greenStackLight := redAllianceReady && blueAllianceReady && arena.Plc.GetCycleState(2, 0, 2) + arena.Plc.SetStackLights(!redAllianceReady, !blueAllianceReady, false, greenStackLight) + arena.Plc.SetStackBuzzer(redAllianceReady && blueAllianceReady) // Turn off lights if all teams become ready. if redAllianceReady && blueAllianceReady { diff --git a/field/arena_notifiers.go b/field/arena_notifiers.go index 79726ce..90d9213 100644 --- a/field/arena_notifiers.go +++ b/field/arena_notifiers.go @@ -42,9 +42,8 @@ type MatchTimeMessage struct { } type audienceAllianceScoreFields struct { - Score *game.Score - ScoreSummary *game.ScoreSummary - IsPreMatchScoreReady bool + Score *game.Score + ScoreSummary *game.ScoreSummary } // Instantiates notifiers and configures their message producing methods. @@ -92,11 +91,10 @@ func (arena *Arena) generateArenaStatusMessage() interface{} { AllianceStations map[string]*AllianceStation TeamWifiStatuses map[string]network.TeamWifiStatus MatchState - BypassPreMatchScore bool - CanStartMatch bool - PlcIsHealthy bool - FieldEstop bool - }{arena.CurrentMatch.Id, arena.AllianceStations, teamWifiStatuses, arena.MatchState, arena.BypassPreMatchScore, + CanStartMatch bool + PlcIsHealthy bool + FieldEstop bool + }{arena.CurrentMatch.Id, arena.AllianceStations, teamWifiStatuses, arena.MatchState, arena.checkCanStartMatch() == nil, arena.Plc.IsHealthy, arena.Plc.GetFieldEstop()} } diff --git a/field/arena_test.go b/field/arena_test.go index f490538..aecd3ca 100644 --- a/field/arena_test.go +++ b/field/arena_test.go @@ -70,13 +70,6 @@ func TestArenaCheckCanStartMatch(t *testing.T) { assert.Contains(t, err.Error(), "Cannot start match until all robots are connected or bypassed") } arena.AllianceStations["B3"].Bypass = true - err = arena.checkCanStartMatch() - if assert.NotNil(t, err) { - assert.Contains(t, err.Error(), "Cannot start match until pre-match scoring is set") - } - - // Check scoring constraints. - arena.BypassPreMatchScore = true assert.Nil(t, arena.checkCanStartMatch()) // Check PLC constraints. @@ -119,7 +112,6 @@ func TestArenaMatchFlow(t *testing.T) { arena.AllianceStations["B1"].Bypass = true arena.AllianceStations["B2"].Bypass = true arena.AllianceStations["B3"].DsConn.RobotLinked = true - arena.BypassPreMatchScore = true err = arena.StartMatch() assert.Nil(t, err) arena.Update() @@ -218,7 +210,6 @@ func TestArenaStateEnforcement(t *testing.T) { arena.AllianceStations["B1"].Bypass = true arena.AllianceStations["B2"].Bypass = true arena.AllianceStations["B3"].Bypass = true - arena.BypassPreMatchScore = true err := arena.LoadMatch(new(model.Match)) assert.Nil(t, err) @@ -325,7 +316,6 @@ func TestMatchStartRobotLinkEnforcement(t *testing.T) { for _, station := range arena.AllianceStations { station.DsConn.RobotLinked = true } - arena.BypassPreMatchScore = true err = arena.StartMatch() assert.Nil(t, err) arena.MatchState = PreMatch @@ -499,7 +489,6 @@ func TestAstop(t *testing.T) { arena.AllianceStations["B1"].Bypass = true arena.AllianceStations["B2"].Bypass = true arena.AllianceStations["B3"].Bypass = true - arena.BypassPreMatchScore = true err = arena.StartMatch() assert.Nil(t, err) arena.Update() @@ -605,7 +594,6 @@ func TestArenaTimeout(t *testing.T) { arena.AllianceStations["B1"].Bypass = true arena.AllianceStations["B2"].Bypass = true arena.AllianceStations["B3"].Bypass = true - arena.BypassPreMatchScore = true assert.Nil(t, arena.StartMatch()) arena.Update() assert.NotNil(t, arena.StartTimeout(1)) @@ -642,7 +630,6 @@ func TestSaveTeamHasConnected(t *testing.T) { arena.AllianceStations["B2"].DsConn = &DriverStationConnection{TeamId: 105, RobotLinked: true} arena.AllianceStations["B3"].DsConn = &DriverStationConnection{TeamId: 106, RobotLinked: true} arena.AllianceStations["B3"].Team.City = "Sand Hosay" // Change some other field to verify that it isn't saved. - arena.BypassPreMatchScore = true assert.Nil(t, arena.StartMatch()) // Check that the connection status was saved for the teams that just linked for the first time. diff --git a/static/js/match_play.js b/static/js/match_play.js index 5acfffe..0252808 100644 --- a/static/js/match_play.js +++ b/static/js/match_play.js @@ -18,11 +18,6 @@ var toggleBypass = function(station) { websocket.send("toggleBypass", station); }; -// Sends a websocket message to toggle the bypass state for the pre-match scoring. -var toggleBypassPreMatchScore = function() { - websocket.send("toggleBypassPreMatchScore"); -}; - // Sends a websocket message to start the match. var startMatch = function() { websocket.send("startMatch", @@ -184,8 +179,6 @@ var handleArenaStatus = function(data) { break; } - $("#bypassPreMatchScore").prop("checked", data.BypassPreMatchScore); - if (data.PlcIsHealthy) { $("#plcStatus").text("Connected"); $("#plcStatus").attr("data-ready", true); @@ -208,10 +201,6 @@ var handleMatchTime = function(data) { var handleRealtimeScore = function(data) { $("#redScore").text(data.Red.ScoreSummary.Score); $("#blueScore").text(data.Blue.ScoreSummary.Score); - if (matchStates[data.MatchState] == "PRE_MATCH") { - $("#redPreMatchScoreStatus").attr("data-ready", data.Red.IsPreMatchScoreReady); - $("#bluePreMatchScoreStatus").attr("data-ready", data.Blue.IsPreMatchScoreReady); - } }; // Handles a websocket message to update the audience display screen selector. diff --git a/templates/match_play.html b/templates/match_play.html index 54a26c1..71276bb 100644 --- a/templates/match_play.html +++ b/templates/match_play.html @@ -112,15 +112,7 @@
-

Pre-Match Scoring

-

Red Scoring
- Blue Scoring

-
- -
-

Post-Match Scoring

+

Scoring

Referee

diff --git a/web/alliance_station_display_test.go b/web/alliance_station_display_test.go index eb25969..b97eadf 100644 --- a/web/alliance_station_display_test.go +++ b/web/alliance_station_display_test.go @@ -58,7 +58,6 @@ func TestAllianceStationDisplayWebsocket(t *testing.T) { web.arena.AllianceStations["B1"].Bypass = true web.arena.AllianceStations["B2"].Bypass = true web.arena.AllianceStations["B3"].Bypass = true - web.arena.BypassPreMatchScore = true web.arena.StartMatch() web.arena.Update() messages := readWebsocketMultiple(t, ws, 3) diff --git a/web/announcer_display_test.go b/web/announcer_display_test.go index cca4f82..a836548 100644 --- a/web/announcer_display_test.go +++ b/web/announcer_display_test.go @@ -45,7 +45,6 @@ func TestAnnouncerDisplayWebsocket(t *testing.T) { web.arena.AllianceStations["B1"].Bypass = true web.arena.AllianceStations["B2"].Bypass = true web.arena.AllianceStations["B3"].Bypass = true - web.arena.BypassPreMatchScore = true web.arena.StartMatch() web.arena.Update() messages := readWebsocketMultiple(t, ws, 2) diff --git a/web/audience_display_test.go b/web/audience_display_test.go index 2cdd874..bbc9154 100644 --- a/web/audience_display_test.go +++ b/web/audience_display_test.go @@ -55,7 +55,6 @@ func TestAudienceDisplayWebsocket(t *testing.T) { web.arena.AllianceStations["B1"].Bypass = true web.arena.AllianceStations["B2"].Bypass = true web.arena.AllianceStations["B3"].Bypass = true - web.arena.BypassPreMatchScore = true web.arena.StartMatch() web.arena.Update() web.arena.Update() diff --git a/web/match_play.go b/web/match_play.go index 23df217..25e3444 100644 --- a/web/match_play.go +++ b/web/match_play.go @@ -207,8 +207,6 @@ func (web *Web) matchPlayWebsocketHandler(w http.ResponseWriter, r *http.Request continue } web.arena.AllianceStations[station].Bypass = !web.arena.AllianceStations[station].Bypass - case "toggleBypassPreMatchScore": - web.arena.BypassPreMatchScore = !web.arena.BypassPreMatchScore case "startMatch": args := struct { MuteMatchSounds bool diff --git a/web/match_play_test.go b/web/match_play_test.go index abf1988..736a294 100644 --- a/web/match_play_test.go +++ b/web/match_play_test.go @@ -296,7 +296,6 @@ func TestMatchPlayWebsocketCommands(t *testing.T) { web.arena.AllianceStations["B1"].Bypass = true web.arena.AllianceStations["B2"].Bypass = true web.arena.AllianceStations["B3"].Bypass = true - web.arena.BypassPreMatchScore = true ws.Write("startMatch", nil) readWebsocketType(t, ws, "arenaStatus") assert.Equal(t, field.StartMatch, web.arena.MatchState) @@ -356,7 +355,6 @@ func TestMatchPlayWebsocketNotifications(t *testing.T) { web.arena.AllianceStations["B1"].Bypass = true web.arena.AllianceStations["B2"].Bypass = true web.arena.AllianceStations["B3"].Bypass = true - web.arena.BypassPreMatchScore = true assert.Nil(t, web.arena.StartMatch()) web.arena.Update() messages := readWebsocketMultiple(t, ws, 4)