fix: compile error
This commit is contained in:
parent
92eee703a1
commit
cc7c5c92b0
@ -2,12 +2,13 @@ use anyhow::{anyhow, Context, Result};
|
|||||||
use chrono::{DateTime, Duration, Utc};
|
use chrono::{DateTime, Duration, Utc};
|
||||||
use log::{debug, error, info, warn};
|
use log::{debug, error, info, warn};
|
||||||
use rppal::gpio::{Gpio, InputPin, Trigger};
|
use rppal::gpio::{Gpio, InputPin, Trigger};
|
||||||
use serialport::{SerialPort, SerialPortSettings};
|
use serialport::{SerialPort};
|
||||||
use std::io::{BufRead, BufReader};
|
use std::io::{BufRead, BufReader};
|
||||||
use std::path::Path;
|
use std::path::Path;
|
||||||
use std::sync::{Arc, Mutex};
|
use std::sync::{Arc, Mutex};
|
||||||
use std::thread;
|
use std::thread;
|
||||||
use std::time;
|
use std::time;
|
||||||
|
use serialport::DataBits::Eight;
|
||||||
use tokio::sync::broadcast;
|
use tokio::sync::broadcast;
|
||||||
|
|
||||||
use crate::gps::nmea::{parse_nmea_sentence, NmeaPosition};
|
use crate::gps::nmea::{parse_nmea_sentence, NmeaPosition};
|
||||||
@ -111,16 +112,14 @@ impl GpsController {
|
|||||||
let mut init_failed = false;
|
let mut init_failed = false;
|
||||||
|
|
||||||
// Open the serial port
|
// Open the serial port
|
||||||
let settings = SerialPortSettings {
|
|
||||||
baud_rate: self.config.baud_rate,
|
|
||||||
data_bits: serialport::DataBits::Eight,
|
|
||||||
flow_control: serialport::FlowControl::None,
|
|
||||||
parity: serialport::Parity::None,
|
|
||||||
stop_bits: serialport::StopBits::One,
|
|
||||||
timeout: time::Duration::from_millis(1000),
|
|
||||||
};
|
|
||||||
|
|
||||||
match serialport::open_with_settings(&self.config.port, &settings) {
|
let port = serialport::new(&self.config.port, self.config.baud_rate)
|
||||||
|
.data_bits(Eight)
|
||||||
|
.flow_control(serialport::FlowControl::None)
|
||||||
|
.parity(serialport::Parity::None)
|
||||||
|
.stop_bits(serialport::StopBits::One)
|
||||||
|
.timeout(time::Duration::from_millis(1000));
|
||||||
|
match port.open() {
|
||||||
Ok(port) => {
|
Ok(port) => {
|
||||||
self.port = Some(port);
|
self.port = Some(port);
|
||||||
self.gps_state.initialized = true;
|
self.gps_state.initialized = true;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user