Skip to content

Commit 89b68a3

Browse files
authored
feat(wavelog): adds support for satellite name and frequency computations for QO-100 (#7)
1 parent c1b30de commit 89b68a3

File tree

4 files changed

+37
-5
lines changed

4 files changed

+37
-5
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# Changelog
22

3+
## v1.2.0
4+
5+
Adds "sat" name configuration parameter and support for QO-100 operations
6+
37
## v1.1.0
48

59
Let update interval configurable

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "wavelog-hamlib"
3-
version = "1.1.0"
3+
version = "1.2.0"
44
authors = ["Luca Cireddu <[email protected]>"]
55
description = "Simple tool to connect Hamlib rigctld instance with Wavelog"
66
repository = "https://github.com/sardylan/wavelog-hamlib.git"

src/config.rs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,4 +100,14 @@ pub struct Config {
100100
long_help = "Set the amount of time to wait for rigctl response (in milliseconds)"
101101
)]
102102
pub rigctl_timeout: u64,
103+
104+
#[arg(
105+
short = 's',
106+
long,
107+
action = ArgAction::Set,
108+
default_value = "",
109+
help = "Satellite name",
110+
long_help = "Set the name of Satellite (empty values disable Sat Mode)"
111+
)]
112+
pub sat: String,
103113
}

src/main.rs

Lines changed: 22 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,9 @@ use crate::config::Config;
2323
use crate::errors::WavelogHamlibError;
2424
use crate::wavelog::Update;
2525
use clap::Parser;
26-
use hamlib_client::adif::Mode;
26+
use hamlib_client::adif::{Mode, PropagationMode};
2727
use hamlib_client::RigCtlClient;
28+
use std::string::String;
2829
use std::time::Duration;
2930
use tokio::time::sleep;
3031

@@ -76,16 +77,33 @@ async fn program(configuration: &Config) -> Result<(), WavelogHamlibError> {
7677
let tx_freq = rigctl.get_split_freq(rx_vfo).await?;
7778
log::trace!("{}: {}", &tx_vfo, &tx_freq);
7879

80+
let update_prop_mode =
81+
if !&configuration.sat.is_empty() {
82+
log::debug!("Enabling SAT propagation mode");
83+
Some(PropagationMode::SAT)
84+
} else {
85+
None
86+
};
87+
88+
let update_tx_freq =
89+
if &configuration.sat == "QO-100"
90+
&& tx_freq.frequency == rx_freq.frequency {
91+
log::debug!("Manually setting TX Frequency for QO-100 satellite activity");
92+
tx_freq.frequency - 8089500000
93+
} else {
94+
tx_freq.frequency
95+
};
96+
7997
log::debug!("Preparing update");
8098
let update = Update {
8199
radio: String::from(&configuration.wavelog_radio),
82-
frequency: tx_freq.frequency,
100+
frequency: update_tx_freq,
83101
mode: Mode::from(tx_mode.mode),
84102
frequency_rx: Some(rx_freq.frequency),
85103
mode_rx: Some(Mode::from(rx_mode.mode)),
86-
prop_mode: None,
104+
prop_mode: update_prop_mode,
87105
power: None,
88-
sat_name: None,
106+
sat_name: Some(String::from(&configuration.sat)).filter(String::is_empty),
89107
};
90108
log::trace!("Update: {}", &update);
91109

0 commit comments

Comments
 (0)