added weapon enable flag

This commit is contained in:
Andy Killorin 2025-01-19 17:17:29 -05:00
commit 57522c26cc
Signed by: ank
GPG key ID: 23F9463ECB67FE8C

View file

@ -112,6 +112,9 @@ async fn controller(mut notes: mpsc::Receiver<(Option<pitch_detection::Pitch<f32
}
}
/// Weapon enabled
const ARMED: bool = true;
fn sax_control(control: &mut ControlPacket, vol: f32, note: &pitch_detection::Pitch<f32>) -> ControlFlow<()> {
if note.frequency < 150. {
println!("too low");
@ -142,8 +145,10 @@ fn sax_control(control: &mut ControlPacket, vol: f32, note: &pitch_detection::Pi
*control = ControlPacket::Twist(0.0, -1.0);
}
Pitch { letter: NoteLetter::G, accidental: 1} => {
println!("fire");
*control = ControlPacket::Fire;
if ARMED {
println!("fire");
*control = ControlPacket::Fire;
}
}
Pitch { letter: NoteLetter::F, accidental: 1} => {
println!("stop flat");
@ -193,8 +198,10 @@ fn recorder_control(control: &mut ControlPacket, vol: f32, note: pitch_detection
*control = ControlPacket::Twist(0.0, -1.0);
}
Pitch { letter: NoteLetter::G, accidental: 0|1} => {
println!("fire");
*control = ControlPacket::Fire;
if ARMED {
println!("fire");
*control = ControlPacket::Fire;
}
}
Pitch { letter: NoteLetter::F, accidental: 1} => {
println!("stop flat");