From 60df932dea95afa7a53250eeb6e3c339788a0b93 Mon Sep 17 00:00:00 2001 From: Luca Cireddu Date: Wed, 11 Sep 2024 09:55:28 +0200 Subject: [PATCH] feat(config): implement configurable update interval (#4) --- src/config.rs | 2 +- src/main.rs | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/config.rs b/src/config.rs index ceedee1..6886844 100644 --- a/src/config.rs +++ b/src/config.rs @@ -36,7 +36,7 @@ pub struct Config { short = 'i', long, action = ArgAction::Set, - default_value = "1000", + default_value = "2000", help = "Update interval", long_help = "Set the duration of the interval between two updates (milliseconds)" )] diff --git a/src/main.rs b/src/main.rs index db28fe3..f97ff13 100644 --- a/src/main.rs +++ b/src/main.rs @@ -23,9 +23,9 @@ use crate::config::Config; use crate::errors::WavelogHamlibError; use crate::wavelog::Update; use clap::Parser; +use hamlib_client::adif::Mode; use hamlib_client::RigCtlClient; use std::time::Duration; -use hamlib_client::adif::Mode; use tokio::time::sleep; #[tokio::main] @@ -104,6 +104,6 @@ async fn program(configuration: &Config) -> Result<(), WavelogHamlibError> { } log::debug!("Sleeping"); - sleep(Duration::from_millis(1000)).await; + sleep(Duration::from_millis(configuration.interval)).await; } }