From 57522c26ccf6f70c7c7aaf5fb0433d156bfa49df Mon Sep 17 00:00:00 2001 From: Andy Killorin <37423245+Speedy6451@users.noreply.github.com> Date: Sun, 19 Jan 2025 17:17:29 -0500 Subject: [PATCH] added weapon enable flag --- controller/src/main.rs | 2 +- interface/src/main.rs | 15 +++++++++++---- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/controller/src/main.rs b/controller/src/main.rs index 830886c..b01839d 100644 --- a/controller/src/main.rs +++ b/controller/src/main.rs @@ -360,6 +360,6 @@ fn handle_cam(cam: &mut Pwm, state: &mut CamState, limit: &Input) { let mut f: pwm::Config = Default::default(); f.divider = 40.into(); f.top = 62500; // 20ms - f.compare_b = calc_speed(speed); // 1.5ms + f.compare_b = calc_speed(-speed); // 1.5ms cam.set_config(&f); } diff --git a/interface/src/main.rs b/interface/src/main.rs index 1addf0e..4b324d6 100644 --- a/interface/src/main.rs +++ b/interface/src/main.rs @@ -112,6 +112,9 @@ async fn controller(mut notes: mpsc::Receiver<(Option) -> 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");