Skip to content

Commit

Permalink
Merge branch 'main' into vivid_ap_setting
Browse files Browse the repository at this point in the history
  • Loading branch information
patfair committed Oct 11, 2023
2 parents 4c2c4d1 + 9e03243 commit eb7ed00
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 8 deletions.
9 changes: 9 additions & 0 deletions field/arena.go
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,15 @@ func (arena *Arena) LoadSettings() error {
arena.Plc.SetAddress(settings.PlcAddress)
arena.TbaClient = partner.NewTbaClient(settings.TbaEventCode, settings.TbaSecretId, settings.TbaSecret)

if arena.EventSettings.NetworkSecurityEnabled && arena.MatchState == PreMatch {
if err = arena.accessPoint.ConfigureAdminSettings(); err != nil {
log.Printf("Failed to configure access point admin settings: %s", err.Error())
}
if err = arena.accessPoint2.ConfigureAdminSettings(); err != nil {
log.Printf("Failed to configure second access point admin settings: %s", err.Error())
}
}

game.MatchTiming.WarmupDurationSec = settings.WarmupDurationSec
game.MatchTiming.AutoDurationSec = settings.AutoDurationSec
game.MatchTiming.PauseDurationSec = settings.PauseDurationSec
Expand Down
15 changes: 15 additions & 0 deletions network/access_point.go
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,21 @@ func (ap *AccessPoint) Run() {
}
}

// Calls the access point to configure the non-team-related settings.
func (ap *AccessPoint) ConfigureAdminSettings() error {
if !ap.networkSecurityEnabled {
return nil
}

commands := []string{
fmt.Sprintf("set wireless.radio0.channel='%d'", ap.teamChannel),
"commit wireless",
}
command := fmt.Sprintf("uci batch <<ENDCONFIG && wifi radio0\n%s\nENDCONFIG\n", strings.Join(commands, "\n"))
_, err := ap.runCommand(command)
return err
}

// Adds a request to set up wireless networks for the given set of teams to the asynchronous queue.
func (ap *AccessPoint) ConfigureTeamWifi(teams [6]*model.Team) error {
// Use a channel to serialize configuration requests; the monitoring goroutine will service them.
Expand Down
21 changes: 13 additions & 8 deletions static/css/field_monitor_display.css
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/*
/*
Copyright 2018 Team 254. All Rights Reserved.
Author: [email protected] (Patrick Fairbank)
*/
Expand Down Expand Up @@ -51,6 +51,9 @@ body {
#eventStatusRow[data-ds="true"] {
display: none;
}
#eventStatusRow[data-fta="false"] {
display: none;
}
.left-position, .right-position {
width: 8%;
height: 100%;
Expand Down Expand Up @@ -82,20 +85,20 @@ body {
font-size: 6vw;
}
.team-id[data-status=no-link], .team-notes[data-status=no-link] {
background-color: #963;
background-color: #AAA;
}
.team-id[data-status=ds-linked], .team-notes[data-status=ds-linked] {
background-color: #ff0;
color: #333;
background-color: #EDAB33;
}
.team-id[data-status=robot-linked], .team-notes[data-status=robot-linked] {
background-color: #0a3;
background-color: #00ff00;
color: #333;
}
.team-id[data-status=radio-linked], .team-notes[data-status=radio-linked] {
background-color: #ff00ff;
background-color: #AA3377;
}
.team-id[data-status=wrong-station], .team-notes[data-status=wrong-station] {
background-color: #246f92;
background-color: #4477AA;
}
.team-box-row {
display: flex;
Expand All @@ -109,7 +112,8 @@ body {
background-color: #333;
}
.team-box[data-status-ok="true"] {
background-color: #0a3;
background-color: #00ff00;
color: #333;
}
.team-box[data-status-ok="false"] {
background-color: #f44;
Expand Down Expand Up @@ -156,3 +160,4 @@ textarea {
.left-score[data-reversed=true], .right-score[data-reversed=false] {
color: #2080ff;
}

0 comments on commit eb7ed00

Please sign in to comment.