Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adds support for satellite name and frequency computations for QO-100 #7

Merged
merged 1 commit into from
Sep 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "wavelog-hamlib"
version = "1.1.0"
version = "1.2.0"
authors = ["Luca Cireddu <[email protected]>"]
description = "Simple tool to connect Hamlib rigctld instance with Wavelog"
repository = "https://github.com/sardylan/wavelog-hamlib.git"
Expand Down
10 changes: 10 additions & 0 deletions src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
}
26 changes: 22 additions & 4 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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);

Expand Down