Skip to content

Commit

Permalink
commit for deployment
Browse files Browse the repository at this point in the history
  • Loading branch information
jmmaa committed Mar 6, 2023
1 parent ed5d816 commit 9ffd511
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 7 deletions.
1 change: 1 addition & 0 deletions scripts/start.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
"./target/release/orca-iot"
1 change: 1 addition & 0 deletions scripts/start.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
"./target/release/orca-iot"
19 changes: 13 additions & 6 deletions src/serial.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
use nom::InputIter;
use serialport::{self, SerialPortType::UsbPort, UsbPortInfo};
use serialport::{
self, DataBits, FlowControl, Parity, SerialPortType::UsbPort, StopBits, UsbPortInfo,
};

use csv;
use csv::Writer;
Expand Down Expand Up @@ -73,11 +75,11 @@ fn open_port(b: u32, t: u64) -> Result<Box<dyn serialport::SerialPort>, Box<dyn
match find_port() {
Ok(path) => {
let port = serialport::new(path, b)
.flow_control(serialport::FlowControl::None)
.data_bits(serialport::DataBits::Eight)
.stop_bits(serialport::StopBits::One)
.flow_control(FlowControl::None)
.data_bits(DataBits::Eight)
.stop_bits(StopBits::One)
.timeout(Duration::from_millis(t))
.parity(serialport::Parity::None)
.parity(Parity::None)
.open();

match port {
Expand Down Expand Up @@ -167,7 +169,8 @@ fn process_data(port: &mut Box<dyn serialport::SerialPort>, wtr: &mut Writer<Fil
match port.read(&mut buf) {
Ok(num) => {
if num > 0 {
let slice = Slicer::new(Slicer::new(&buf).to_before(num));
let bytes_read = Slicer::new(&buf).to_before(num);
let slice = Slicer::new(bytes_read);

let marker_pos = slice.to_end().position(|b| b == b'$');

Expand Down Expand Up @@ -210,3 +213,7 @@ pub fn start(baudrate: u32, timeout: u64, path: String) {
sleep(Duration::from_secs(1));
}
}

// CREATE BINARY FOR THIS
// CLI
//
2 changes: 1 addition & 1 deletion src/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ impl<'a, V> Slicer<'a, V, NoStartIndex> {
}

pub fn to_end(&self) -> &'a [V] {
&self.v[..]
self.v
}
}

Expand Down

0 comments on commit 9ffd511

Please sign in to comment.