shorten blink interval, allow for adjusting blink interval
ci/woodpecker/push/woodpecker Pipeline was successful
Details
ci/woodpecker/push/woodpecker Pipeline was successful
Details
This commit is contained in:
parent
ce7f3fd010
commit
8654fe5070
|
@ -6,6 +6,7 @@
|
|||
use std::{
|
||||
path::{Path, PathBuf},
|
||||
sync::{Arc, Mutex},
|
||||
thread::sleep,
|
||||
time::Duration,
|
||||
};
|
||||
|
||||
|
@ -21,6 +22,7 @@ const MIC_THRESHOLD: f32 = 0.5f32;
|
|||
|
||||
struct MicThreshold(Arc<Mutex<f32>>);
|
||||
struct AudioLevel(Arc<Mutex<f32>>);
|
||||
struct BlinkInterval(Arc<Mutex<u64>>);
|
||||
|
||||
// struct LastImage(Option<Arc<Path>>);
|
||||
// struct LastRay(Arc<Mutex<Path>>);
|
||||
|
@ -29,6 +31,7 @@ fn main() {
|
|||
env_logger::init();
|
||||
let threshold = Arc::new(Mutex::new(MIC_THRESHOLD));
|
||||
let level = Arc::new(Mutex::new(0.));
|
||||
let blink_interval = Arc::new(Mutex::new(1500));
|
||||
let mut ray = None;
|
||||
|
||||
if let Some(d) = cache_dir() {
|
||||
|
@ -42,6 +45,7 @@ fn main() {
|
|||
tauri::Builder::default()
|
||||
.manage(MicThreshold(threshold.clone()))
|
||||
.manage(AudioLevel(level.clone()))
|
||||
.manage(BlinkInterval(blink_interval.clone()))
|
||||
.setup(|app| {
|
||||
let window = app.get_window("main").unwrap();
|
||||
tauri::async_runtime::spawn(async move {
|
||||
|
@ -57,7 +61,8 @@ fn main() {
|
|||
warn!("Failed to emit blink event: {}", e);
|
||||
}
|
||||
}
|
||||
tokio::time::sleep(Duration::from_millis(3000)).await;
|
||||
let blink = blink_interval.lock().unwrap();
|
||||
sleep(Duration::from_millis(*blink));
|
||||
}
|
||||
});
|
||||
|
||||
|
|
Loading…
Reference in New Issue