shifted override fire
This commit is contained in:
parent
5a30e91800
commit
5953f2c584
1 changed files with 9 additions and 5 deletions
|
@ -46,6 +46,7 @@ fn main() -> Result<()> {
|
||||||
|
|
||||||
let control = executor.block_on(async {
|
let control = executor.block_on(async {
|
||||||
let cruisecontrol = TcpStream::connect("169.254.1.1:1234").await?;
|
let cruisecontrol = TcpStream::connect("169.254.1.1:1234").await?;
|
||||||
|
println!("connected");
|
||||||
cruisecontrol.set_nodelay(true)?;
|
cruisecontrol.set_nodelay(true)?;
|
||||||
let (telem, control) = cruisecontrol.into_split();
|
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")?;
|
let (note,vol) = note.context("channel closed")?;
|
||||||
if let Some(note) = note {
|
if let Some(note) = note {
|
||||||
//dbg!(note.frequency);
|
dbg!(note.frequency);
|
||||||
//dbg!(note.clarity);
|
//dbg!(note.clarity);
|
||||||
//dbg!(vol);
|
//dbg!(vol);
|
||||||
let note = Note::from_freq(note.frequency, Tuning::EqualTemperament);
|
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;
|
control = ControlPacket::Fire;
|
||||||
}
|
}
|
||||||
Pitch { letter: NoteLetter::E, accidental: 0} => {
|
Pitch { letter: NoteLetter::E, accidental: 0} => {
|
||||||
println!("fire");
|
println!("e");
|
||||||
control = ControlPacket::Fire;
|
|
||||||
}
|
}
|
||||||
_pitch => {
|
Pitch { letter: NoteLetter::F, accidental: 1} => {
|
||||||
|
println!("fire");
|
||||||
|
control = ControlPacket::FireOverride(1.0);
|
||||||
|
}
|
||||||
|
pitch => {
|
||||||
if vol > 3000. {
|
if vol > 3000. {
|
||||||
println!("fire");
|
println!("fire");
|
||||||
control = ControlPacket::FireOverride(1.0);
|
control = ControlPacket::FireOverride(1.0);
|
||||||
} else {
|
} else {
|
||||||
//dbg!(pitch);
|
dbg!(pitch);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue