fix compile error

This commit is contained in:
grabbit 2025-03-22 11:42:09 +08:00
parent d2ca715eeb
commit 62d6f38bc5
5 changed files with 13 additions and 15 deletions

View File

@ -10,9 +10,10 @@ pub use opencv::OpenCVCamera;
use anyhow::Result; use anyhow::Result;
use chrono::DateTime; use chrono::DateTime;
use chrono::Utc; use chrono::Utc;
use serde::{Deserialize, Serialize};
/// Camera resolution options /// Camera resolution options
#[derive(Debug, Clone, Copy, PartialEq, Eq)] #[derive(Debug, Clone, Copy, PartialEq, Eq,Serialize,Deserialize)]
pub enum Resolution { pub enum Resolution {
/// 1920x1080 (1080p) /// 1920x1080 (1080p)
HD1080p, HD1080p,
@ -40,7 +41,7 @@ impl Resolution {
} }
/// Camera exposure mode /// Camera exposure mode
#[derive(Debug, Clone, Copy, PartialEq, Eq)] #[derive(Debug, Clone, Copy, PartialEq, Eq,Serialize,Deserialize)]
pub enum ExposureMode { pub enum ExposureMode {
/// Automatic exposure control /// Automatic exposure control
Auto, Auto,

View File

@ -13,7 +13,7 @@ mod monitoring;
use anyhow::{Context, Result}; use anyhow::{Context, Result};
use log::{info, error}; use log::{info, error};
use std::path::PathBuf; use std::path::PathBuf;
use std::sync::Arc; use std::sync::{Arc,Mutex as StdMutex};
use tokio::sync::Mutex; use tokio::sync::Mutex;
pub use config::Config; pub use config::Config;
@ -63,8 +63,8 @@ async fn main() -> Result<()> {
overlay::watermark::Watermark::new( overlay::watermark::Watermark::new(
config.watermark.clone(), config.watermark.clone(),
Arc::new(Mutex::new(env_data)), Arc::new(StdMutex::new(env_data)),
Arc::new(Mutex::new(gps_status)), Arc::new(StdMutex::new(gps_status)),
) )
}; };
let watermark = Arc::new(Mutex::new(watermark)); let watermark = Arc::new(Mutex::new(watermark));
@ -80,8 +80,9 @@ async fn main() -> Result<()> {
// Initialize detection pipeline // Initialize detection pipeline
let detection_pipeline = detection::DetectionPipeline::new( let detection_pipeline = detection::DetectionPipeline::new(
camera_controller.clone(), camera_controller.clone(),
&config &config,
).await.context("Failed to initialize detection pipeline")?; config.detection.pipeline
).context("Failed to initialize detection pipeline")?;
// Initialize storage system // Initialize storage system
let storage_manager = storage::StorageManager::new(&config) let storage_manager = storage::StorageManager::new(&config)

View File

@ -1,3 +1,3 @@
mod watermark; pub(crate) mod watermark;
pub use watermark::{WatermarkOptions, WatermarkPosition, Watermark, WatermarkContent}; pub use watermark::{WatermarkOptions, WatermarkPosition, Watermark, WatermarkContent};

View File

@ -344,7 +344,7 @@ impl SensorController {
camera_sensor.update_brightness(brightness); camera_sensor.update_brightness(brightness);
// Update the current data // Update the current data
let mut data = self.current_data.lock().unwrap(); let mut data = self.current_data.lock()?;
data.sky_brightness = brightness; data.sky_brightness = brightness;
data.timestamp = Utc::now(); data.timestamp = Utc::now();
@ -376,8 +376,4 @@ impl LightSensor for Box<dyn LightSensor> {
} }
} }
impl LightSensorExt for Box<dyn LightSensor> {
fn as_any(&self) -> &dyn std::any::Any {
self
}
}

View File

@ -1,7 +1,7 @@
use anyhow::{anyhow, Context, Result}; use anyhow::{anyhow, Context, Result};
use chrono::Utc; use chrono::Utc;
use log::{debug, error, info, warn}; use log::{debug, error, info, warn};
use opencv::{core, imgproc, prelude::*}; use opencv::{prelude::*};
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
use std::process::{Child, Command, Stdio}; use std::process::{Child, Command, Stdio};
use std::sync::{Arc, Mutex}; use std::sync::{Arc, Mutex};