Skip to content

Commit

Permalink
Limit configured warning tone freq. to acceptable range
Browse files Browse the repository at this point in the history
  • Loading branch information
KoffeinFlummi committed Mar 23, 2024
1 parent 50e0b54 commit d40bd81
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/buzzer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ impl<TIM: CaptureCompare16bitInstance> Buzzer<TIM> {
}

pub fn set_warning_tone(&mut self, frequency: f32, duration: u32) {
self.warning_note = Note::frequency(frequency, duration);
self.warning_note = Note::frequency(f32::min(f32::max(frequency, 300.0), 1500.0), duration);
}

pub fn tick(&mut self, time: u32) {
Expand Down

0 comments on commit d40bd81

Please sign in to comment.