diff --git a/field/arena.go b/field/arena.go index fd88c03..9aca253 100644 --- a/field/arena.go +++ b/field/arena.go @@ -82,11 +82,12 @@ type Arena struct { } type AllianceStation struct { - DsConn *DriverStationConnection - Astop bool - Estop bool - Bypass bool - Team *model.Team + DsConn *DriverStationConnection + Ethernet bool + Astop bool + Estop bool + Bypass bool + Team *model.Team } // Creates the arena and sets it to its initial state. @@ -747,6 +748,13 @@ func (arena *Arena) handlePlcInput() { arena.handleEstop("B1", blueEstops[0]) arena.handleEstop("B2", blueEstops[1]) arena.handleEstop("B3", blueEstops[2]) + redEthernets, blueEthernets := arena.Plc.GetEthernetConnected() + arena.AllianceStations["R1"].Ethernet = redEthernets[0] + arena.AllianceStations["R2"].Ethernet = redEthernets[1] + arena.AllianceStations["R3"].Ethernet = redEthernets[2] + arena.AllianceStations["B1"].Ethernet = blueEthernets[0] + arena.AllianceStations["B2"].Ethernet = blueEthernets[1] + arena.AllianceStations["B3"].Ethernet = blueEthernets[2] if arena.MatchState == PreMatch || arena.MatchState == PostMatch || arena.MatchState == TimeoutActive || arena.MatchState == PostTimeout { diff --git a/plc/plc.go b/plc/plc.go index e649c2c..4217205 100644 --- a/plc/plc.go +++ b/plc/plc.go @@ -159,6 +159,20 @@ func (plc *Plc) GetTeamEstops() ([3]bool, [3]bool) { return redEstops, blueEstops } +// Returns whether anything is connected to each station's designated Ethernet port on the SCC. +func (plc *Plc) GetEthernetConnected() ([3]bool, [3]bool) { + return [3]bool{ + plc.inputs[redConnected1], + plc.inputs[redConnected2], + plc.inputs[redConnected3], + }, + [3]bool{ + plc.inputs[blueConnected1], + plc.inputs[blueConnected2], + plc.inputs[blueConnected3], + } +} + // Set the on/off state of the stack lights on the scoring table. func (plc *Plc) SetStackLights(red, blue, orange, green bool) { plc.coils[stackLightRed] = red diff --git a/static/css/field_monitor_display.css b/static/css/field_monitor_display.css index 123a67f..899ae79 100644 --- a/static/css/field_monitor_display.css +++ b/static/css/field_monitor_display.css @@ -5,9 +5,6 @@ html { height: 100%; - cursor: none; - -webkit-user-select: none; - -moz-user-select: none; overflow: hidden; } body { @@ -74,7 +71,7 @@ body { width: 100%; } .team-box { - width: 25%; + width: 20%; height: 100%; font-size: 2.5vw; background-color: #333; diff --git a/static/js/field_monitor_display.js b/static/js/field_monitor_display.js index ee65cf9..85dc220 100644 --- a/static/js/field_monitor_display.js +++ b/static/js/field_monitor_display.js @@ -19,6 +19,7 @@ var handleArenaStatus = function(data) { teamElementPrefix = "#" + blueSide + "Team" + station[1]; } var teamIdElement = $(teamElementPrefix + "Id"); + var teamEthernetElement = $(teamElementPrefix + "Ethernet"); var teamDsElement = $(teamElementPrefix + "Ds"); var teamRadioElement = $(teamElementPrefix + "Radio"); var teamRadioTextElement = $(teamElementPrefix + "Radio span"); @@ -47,6 +48,14 @@ var handleArenaStatus = function(data) { teamIdElement.attr("data-status", ""); } + // Format the Ethernet status box. + teamEthernetElement.attr("data-status-ok", stationStatus.Ethernet ? "true" : ""); + if (stationStatus.DsConn && stationStatus.DsConn.DsRobotTripTimeMs > 0) { + teamEthernetElement.text(stationStatus.DsConn.DsRobotTripTimeMs); + } else { + teamEthernetElement.text("ETH"); + } + var wifiStatus = data.TeamWifiStatuses[station]; teamRadioTextElement.text(wifiStatus.TeamId); @@ -54,6 +63,7 @@ var handleArenaStatus = function(data) { // Format the driver station status box. var dsConn = stationStatus.DsConn; teamDsElement.attr("data-status-ok", dsConn.DsLinked); + teamDsElement.text(dsConn.MissedPacketCount); // Format the radio status box according to the connection status of the robot radio. var radioOkay = stationStatus.Team && stationStatus.Team.Id === wifiStatus.TeamId && wifiStatus.RadioLinked; @@ -69,6 +79,7 @@ var handleArenaStatus = function(data) { } } else { teamDsElement.attr("data-status-ok", ""); + teamDsElement.text("DS"); teamRobotElement.attr("data-status-ok", ""); teamRobotElement.text("RBT"); diff --git a/templates/field_monitor_display.html b/templates/field_monitor_display.html index 01ddf37..4fdffef 100644 --- a/templates/field_monitor_display.html +++ b/templates/field_monitor_display.html @@ -44,13 +44,17 @@