Skip to content

Commit

Permalink
Move amplified time remaining assignment above score change check for…
Browse files Browse the repository at this point in the history
… notifiction.
  • Loading branch information
patfair committed Jun 25, 2024
1 parent 0c845c6 commit 0e300d0
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions field/arena.go
Original file line number Diff line number Diff line change
Expand Up @@ -981,17 +981,17 @@ func (arena *Arena) handlePlcInputOutput() {
blueAmpSpeaker.UpdateState(
blueAmpNoteCount, blueSpeakerNoteCount, blueAmplifyButton, blueCoopButton, matchStartTime, currentTime,
)
redAmplifiedTimeRemaining := redAmpSpeaker.AmplifiedTimeRemaining(currentTime)
arena.RedRealtimeScore.AmplifiedTimeRemainingSec = int(math.Ceil(redAmplifiedTimeRemaining))
blueAmplifiedTimeRemaining := blueAmpSpeaker.AmplifiedTimeRemaining(currentTime)
arena.BlueRealtimeScore.AmplifiedTimeRemainingSec = int(math.Ceil(blueAmplifiedTimeRemaining))
if !oldRedScore.Equals(redScore) || !oldBlueScore.Equals(blueScore) ||
oldRedAmplifiedTimeRemainingSec != arena.RedRealtimeScore.AmplifiedTimeRemainingSec ||
oldBlueAmplifiedTimeRemainingSec != arena.BlueRealtimeScore.AmplifiedTimeRemainingSec {
arena.RealtimeScoreNotifier.Notify()
}

// Handle the amp outputs.
redAmplifiedTimeRemaining := redAmpSpeaker.AmplifiedTimeRemaining(currentTime)
arena.RedRealtimeScore.AmplifiedTimeRemainingSec = int(math.Ceil(redAmplifiedTimeRemaining))
blueAmplifiedTimeRemaining := blueAmpSpeaker.AmplifiedTimeRemaining(currentTime)
arena.BlueRealtimeScore.AmplifiedTimeRemainingSec = int(math.Ceil(blueAmplifiedTimeRemaining))
if arena.MatchState == AutoPeriod || arena.MatchState == PausePeriod || arena.MatchState == TeleopPeriod {
redLowAmpLight := redAmpSpeaker.BankedAmpNotes >= 1
redHighAmpLight := redAmpSpeaker.BankedAmpNotes >= 2
Expand Down

0 comments on commit 0e300d0

Please sign in to comment.