Skip to content

Commit

Permalink
feat(wavelog): adds support for satellite name and frequency computat…
Browse files Browse the repository at this point in the history
…ions for QO-100
  • Loading branch information
sardylan committed Sep 13, 2024
1 parent c1b30de commit 472fbc8
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 5 deletions.
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

0 comments on commit 472fbc8

Please sign in to comment.