added weapon enable flag
This commit is contained in:
parent
70d4e551b4
commit
57522c26cc
1 changed files with 12 additions and 5 deletions
|
|
@ -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");
|
||||
|
|
|
|||
Loading…
Reference in a new issue