1
Fork 0

shifted override fire

This commit is contained in:
Andy Killorin 2025-01-19 01:20:46 -05:00
parent 5a30e91800
commit 5953f2c584
Signed by: ank
GPG key ID: 23F9463ECB67FE8C

View file

@ -46,6 +46,7 @@ fn main() -> Result<()> {
let control = executor.block_on(async {
let cruisecontrol = TcpStream::connect("169.254.1.1:1234").await?;
println!("connected");
cruisecontrol.set_nodelay(true)?;
let (telem, control) = cruisecontrol.into_split();
@ -90,7 +91,7 @@ async fn controller(mut notes: mpsc::Receiver<(Option<pitch_detection::Pitch<f32
let (note,vol) = note.context("channel closed")?;
if let Some(note) = note {
//dbg!(note.frequency);
dbg!(note.frequency);
//dbg!(note.clarity);
//dbg!(vol);
let note = Note::from_freq(note.frequency, Tuning::EqualTemperament);
@ -116,15 +117,18 @@ async fn controller(mut notes: mpsc::Receiver<(Option<pitch_detection::Pitch<f32
control = ControlPacket::Fire;
}
Pitch { letter: NoteLetter::E, accidental: 0} => {
println!("fire");
control = ControlPacket::Fire;
println!("e");
}
_pitch => {
Pitch { letter: NoteLetter::F, accidental: 1} => {
println!("fire");
control = ControlPacket::FireOverride(1.0);
}
pitch => {
if vol > 3000. {
println!("fire");
control = ControlPacket::FireOverride(1.0);
} else {
//dbg!(pitch);
dbg!(pitch);
}
}
}