From 472fbc8c949315848682a1febf3a53a889ed43e3 Mon Sep 17 00:00:00 2001 From: Luca Cireddu Date: Fri, 13 Sep 2024 11:06:22 +0200 Subject: [PATCH] feat(wavelog): adds support for satellite name and frequency computations for QO-100 --- CHANGELOG.md | 4 ++++ Cargo.toml | 2 +- src/config.rs | 10 ++++++++++ src/main.rs | 26 ++++++++++++++++++++++---- 4 files changed, 37 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d5a623f..a1e9204 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # Changelog +## v1.2.0 + +Adds "sat" name configuration parameter and support for QO-100 operations + ## v1.1.0 Let update interval configurable diff --git a/Cargo.toml b/Cargo.toml index 75caf69..eff6f2a 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "wavelog-hamlib" -version = "1.1.0" +version = "1.2.0" authors = ["Luca Cireddu "] description = "Simple tool to connect Hamlib rigctld instance with Wavelog" repository = "https://github.com/sardylan/wavelog-hamlib.git" diff --git a/src/config.rs b/src/config.rs index 6886844..2f31e43 100644 --- a/src/config.rs +++ b/src/config.rs @@ -100,4 +100,14 @@ pub struct Config { long_help = "Set the amount of time to wait for rigctl response (in milliseconds)" )] pub rigctl_timeout: u64, + + #[arg( + short = 's', + long, + action = ArgAction::Set, + default_value = "", + help = "Satellite name", + long_help = "Set the name of Satellite (empty values disable Sat Mode)" + )] + pub sat: String, } diff --git a/src/main.rs b/src/main.rs index f97ff13..f727c30 100644 --- a/src/main.rs +++ b/src/main.rs @@ -23,8 +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::adif::{Mode, PropagationMode}; use hamlib_client::RigCtlClient; +use std::string::String; use std::time::Duration; use tokio::time::sleep; @@ -76,16 +77,33 @@ async fn program(configuration: &Config) -> Result<(), WavelogHamlibError> { let tx_freq = rigctl.get_split_freq(rx_vfo).await?; log::trace!("{}: {}", &tx_vfo, &tx_freq); + let update_prop_mode = + if !&configuration.sat.is_empty() { + log::debug!("Enabling SAT propagation mode"); + Some(PropagationMode::SAT) + } else { + None + }; + + let update_tx_freq = + if &configuration.sat == "QO-100" + && tx_freq.frequency == rx_freq.frequency { + log::debug!("Manually setting TX Frequency for QO-100 satellite activity"); + tx_freq.frequency - 8089500000 + } else { + tx_freq.frequency + }; + log::debug!("Preparing update"); let update = Update { radio: String::from(&configuration.wavelog_radio), - frequency: tx_freq.frequency, + frequency: update_tx_freq, mode: Mode::from(tx_mode.mode), frequency_rx: Some(rx_freq.frequency), mode_rx: Some(Mode::from(rx_mode.mode)), - prop_mode: None, + prop_mode: update_prop_mode, power: None, - sat_name: None, + sat_name: Some(String::from(&configuration.sat)).filter(String::is_empty), }; log::trace!("Update: {}", &update);