do not read power from flrig

This commit is contained in:
Martin Brodbeck 2023-12-05 08:58:00 +01:00
parent 6285300069
commit d694418dda
5 changed files with 17 additions and 9 deletions

View file

@ -23,6 +23,8 @@ Copy the example config file `clrigctl.toml` to `$HOME/.config/` and adapt it to
# This is an example config file. Please edit it to your needs
# and place it, for example, in your `$HOME/.config/`
power = "5" # Output power in W
[cloudlog]
# Note: URL should end with "/index.php/api/radio".
url = "https://cloudlog.example.com/index.php/api/radio"

View file

@ -1,6 +1,8 @@
# This is an example config file. Please edit it to your needs
# and place it, for example, in your `$HOME/.config/`
power = "5" # Output power in W
[cloudlog]
# Note: URL should end with "/index.php/api/radio".
url = "https://cloudlog.example.com/index.php/api/radio"

View file

@ -9,7 +9,7 @@ use std::result::Result;
pub fn get_radio_data(fl_host: &str, fl_port: &str) -> Result<RadioData, Error> {
let cmd_freq = "rig.get_vfo";
let cmd_mode = "rig.get_mode";
let cmd_power = "rig.get_power";
let cmd_power = "rig.get_power"; // Currently not used.
let client = reqwest::Client::new();
@ -21,7 +21,7 @@ pub fn get_radio_data(fl_host: &str, fl_port: &str) -> Result<RadioData, Error>
let mode = parse_xml(&mode);
let power = parse_xml(&power);
debug!("freq: {freq} --- mode: {mode} --- power: {power}");
debug!("freq: {freq} --- mode: {mode} --- power: {power} (unused)");
let radio_data = RadioData {
key: String::from(""),

View file

@ -2,8 +2,8 @@ mod cloudlog;
mod flrig;
mod settings;
use std::{thread, time::Duration};
use log::debug;
use std::{process, thread, time::Duration};
use crate::cloudlog::RadioData;
use settings::Settings;
@ -13,14 +13,17 @@ fn main() {
debug!("clrigctl started.\n");
let settings = Settings::new().expect("Could not read settings.");
let settings = Settings::new().unwrap_or_else(|err| {
eprintln!("Could not read settings: {}", err);
process::exit(1)
});
let mut radio_data_current = RadioData {
key: settings.cloudlog.key,
radio: settings.cloudlog.identifier,
frequency: String::from("14017000"),
mode: String::from("CW"),
power: String::from("5"),
frequency: String::from(""),
mode: String::from(""),
power: String::from(&settings.power),
};
let mut changes_detected = false;
@ -37,12 +40,12 @@ fn main() {
if radio_data_current.frequency != radio_data_new.frequency
|| radio_data_current.mode != radio_data_new.mode
|| radio_data_current.power != radio_data_new.power
//|| radio_data_current.power != radio_data_new.power
{
changes_detected = true;
radio_data_current.frequency = radio_data_new.frequency;
radio_data_current.mode = radio_data_new.mode;
radio_data_current.power = radio_data_new.power;
//radio_data_current.power = radio_data_new.power;
}
if changes_detected {

View file

@ -22,6 +22,7 @@ pub struct Flrig {
pub struct Settings {
pub cloudlog: Cloudlog,
pub flrig: Flrig,
pub power: String,
}
impl Settings {