Skip to content

Commit

Permalink
fix: make beep only on player turn
Browse files Browse the repository at this point in the history
  • Loading branch information
zabackary committed Nov 2, 2023
1 parent 6d830e0 commit 6da5045
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/countdown.rs
Original file line number Diff line number Diff line change
Expand Up @@ -89,9 +89,10 @@ pub fn countdown<DP: InputPin, UP: InputPin, SP: InputPin, BP: OutputPin, B: Dat
if remaining_buzzer_duration > 0 {
remaining_buzzer_duration -= 1;
}
if (new_p1_ms <= 1000 * 10 && new_p1_ms % 1000 == 0)
|| (new_p2_ms <= 1000 * 10 && new_p2_ms % 1000 == 0)
{
if match *turn {
Turn::P1 => new_p1_ms <= 1000 * 10 && new_p1_ms % 1000 == 0,
Turn::P2 => new_p2_ms <= 1000 * 10 && new_p2_ms % 1000 == 0,
} {
buzzer_pin
.set_high()
.map_err(|_| RuntimeError::PinWriteError)?;
Expand Down

0 comments on commit 6da5045

Please sign in to comment.