From da3afe228edfc67c9b6b05243f6377e0b827a455 Mon Sep 17 00:00:00 2001 From: QuantumEntangledAndy Date: Thu, 25 May 2023 23:55:47 +0700 Subject: [PATCH] Use async sleep --- src/ptz/mod.rs | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/ptz/mod.rs b/src/ptz/mod.rs index 8bf2846..93f0923 100644 --- a/src/ptz/mod.rs +++ b/src/ptz/mod.rs @@ -17,8 +17,7 @@ /// ``` /// use anyhow::{Context, Result}; -use std::thread::sleep; -use std::time::Duration; +use tokio::time::{sleep, Duration}; mod cmdline; @@ -68,7 +67,7 @@ pub(crate) async fn main(opt: Opt, config: Config) -> Result<()> { .send_ptz(direction, 32_f32) .await .context("Unable to execute PTZ move command")?; - sleep(Duration::from_millis(duration as u64)); + sleep(Duration::from_millis(duration as u64)).await; camera .send_ptz(Direction::Stop, 0_f32) .await