From c3bc0fe4ebb7b8b0d85e32d14153b1aa3c040b8f Mon Sep 17 00:00:00 2001 From: grabbit Date: Fri, 21 Mar 2025 21:09:58 +0800 Subject: [PATCH] fix: compile error --- src/camera/opencv.rs | 2 +- src/gps/controller.rs | 12 ++++++++++-- src/streaming/rtsp.rs | 2 +- 3 files changed, 12 insertions(+), 4 deletions(-) diff --git a/src/camera/opencv.rs b/src/camera/opencv.rs index c4fff24..2de790d 100644 --- a/src/camera/opencv.rs +++ b/src/camera/opencv.rs @@ -229,7 +229,7 @@ pub struct OpenCVCaptureStream { impl OpenCVCaptureStream { /// Capture a single frame from the camera pub fn capture_frame(&mut self) -> Result { - let mut frame = core::Mat::default()?; + let mut frame = core::Mat::default(); if self.capture.read(&mut frame)? { if frame.empty() { return Err(anyhow!("Captured frame is empty")); diff --git a/src/gps/controller.rs b/src/gps/controller.rs index f93cdc9..fa7918c 100644 --- a/src/gps/controller.rs +++ b/src/gps/controller.rs @@ -152,7 +152,7 @@ impl GpsController { // Set up PPS edge detection (rising edge) let last_pps = self.last_pps.clone(); - match input_pin.set_async_interrupt(Trigger::RisingEdge, move |_| { + match input_pin.set_async_interrupt(Trigger::RisingEdge, Some(time::Duration::from_millis(20)), move |_| { let now = Utc::now(); let mut last_pps = last_pps.lock().unwrap(); *last_pps = Some(now); @@ -249,9 +249,17 @@ impl GpsController { // Create a separate thread for GPS processing (blocking I/O) thread::spawn(move || { info!("Starting GPS processing on port {}", port_name); + // Open the serial port + + let port = serialport::new(&port_name, 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)); // Get the port - let port = match serialport::open(&port_name) { + let port = match port.open() { Ok(port) => port, Err(e) => { error!("Failed to open GPS port: {}", e); diff --git a/src/streaming/rtsp.rs b/src/streaming/rtsp.rs index d98ec74..c059646 100644 --- a/src/streaming/rtsp.rs +++ b/src/streaming/rtsp.rs @@ -9,7 +9,7 @@ use std::thread; use std::time::Duration; use tokio::sync::mpsc; -use crate::camera::frame_buffer::Frame; +use crate::camera::Frame; /// Stream quality settings #[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]