Skip to content
Snippets Groups Projects
Commit 6d825633 authored by Robert Hedman's avatar Robert Hedman
Browse files

added port and address constants

parent f2e7a90b
No related branches found
No related tags found
No related merge requests found
......@@ -16,6 +16,12 @@ use serial::prelude::*;
//use std::str;
// constants
const LIDAR_ADDRESS: &str = "127.0.0.1:8080";
const COUNTER_SERIAL_PORT: &str = "/dev/cu.usbmodem41";
// should the map matrix be two dim array of const size, vecs of dynamic, or what?
......@@ -25,7 +31,7 @@ const COLS: usize = 100;
fn main() {
// dummy thread for replacing lidar
let server = thread::spawn(|| {
let listener = TcpListener::bind("127.0.0.1:8080").unwrap();
let listener = TcpListener::bind(LIDAR_ADDRESS).unwrap();
let mut stream;
let mut message = [0u8; 2];
match listener.accept() {
......@@ -60,8 +66,7 @@ fn main() {
println!("Tracker started.");
let mut serial_buf: [u8; 8] = [0; 8];
let device = String::from("/dev/cu.usbmodem41");
let mut port = serial::open(&device).unwrap();
let mut port = serial::open(&COUNTER_SERIAL_PORT).unwrap();
interact(&mut port).unwrap();
......@@ -111,7 +116,7 @@ fn main() {
let mut pos: (i32, i32); //= (0,0);
// set up connection to lidar
let mut stream = TcpStream::connect("127.0.0.1:8080").unwrap();
let mut stream = TcpStream::connect(&LIDAR_ADDRESS).unwrap();
let mut lidar_buf: [u8; 2] = [0; 2];
// main loop for this thread
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment