Skip to content

Commit

Permalink
remove uneeded let
Browse files Browse the repository at this point in the history
  • Loading branch information
jr1221 committed Jul 1, 2024
1 parent 305762d commit d845493
Showing 1 changed file with 6 additions and 9 deletions.
15 changes: 6 additions & 9 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ fn read_can(pub_path: &str, can_interface: &str) -> JoinHandle<u32> {
client.connect().expect("Could not connect to Siren!");
let socket = CanSocket::open(can_interface).expect("Failed to open CAN socket!");

let join_handle: JoinHandle<_> = thread::spawn(move || loop {
thread::spawn(move || loop {
let msg = match socket.read_frame() {
Ok(CanFrame::Data(msg)) => msg,
Ok(CanFrame::Remote(_)) => {
Expand Down Expand Up @@ -66,8 +66,7 @@ fn read_can(pub_path: &str, can_interface: &str) -> JoinHandle<u32> {
// TODO: investigate disabling this
thread::sleep(Duration::from_micros(100));
}
});
join_handle
})
}

/**
Expand All @@ -90,7 +89,7 @@ fn read_siren(pub_path: &str, send_map: Arc<RwLock<HashMap<u32, EncodeData>>>) -
}
drop(writable_send_map);

let join_handle = thread::spawn(move || {
thread::spawn(move || {
for msg in reciever.iter() {
if let Some(msg) = msg {
let buf = match command_data::CommandData::parse_from_bytes(msg.payload()) {
Expand Down Expand Up @@ -129,8 +128,7 @@ fn read_siren(pub_path: &str, send_map: Arc<RwLock<HashMap<u32, EncodeData>>>) -
}
}
}
});
join_handle
})
}

fn send_out(
Expand All @@ -139,7 +137,7 @@ fn send_out(
) -> JoinHandle<()> {
let socket = CanSocket::open(can_interface).expect("Failed to open CAN socket!");

let join_handle = thread::spawn(move || loop {
thread::spawn(move || loop {
thread::sleep(Duration::from_millis(750));
let sender = send_map.read().expect("Cannot read map of sendables!");
for msg in sender.iter() {
Expand Down Expand Up @@ -172,8 +170,7 @@ fn send_out(
}
}
}
});
join_handle
})
}

/**
Expand Down

0 comments on commit d845493

Please sign in to comment.