Some rig control work

This commit is contained in:
Mashintime 2023-11-18 17:50:40 -05:00
parent 2f1132cec5
commit 7c73e131a5
10 changed files with 22 additions and 28 deletions

View file

@ -110,8 +110,8 @@ const state = useStateStore(pinia);
data-bs-trigger="hover"
data-bs-html="true"
v-bind:class="{
'btn-warning': state.channel_busy === 'True',
'btn-secondary': state.channel_busy === 'False',
'btn-warning': state.channel_busy === true,
'btn-secondary': state.channel_busy === false,
}"
style="pointer-events: auto"
data-bs-title="Channel busy"

View file

@ -3,8 +3,6 @@ import { setActivePinia } from "pinia";
import pinia from "../store/index";
setActivePinia(pinia);
import { settingsStore as settings } from "../store/settingsStore.js";
import { useStateStore } from "../store/stateStore.js";
const state = useStateStore(pinia);
@ -13,11 +11,7 @@ function getOverallHealth() {
let health = 0;
if (state.modem_connection !== "connected") health += 5;
if (!state.is_modem_running) health += 3;
if (
settings.remote.RADIO.control === "rigctld" &&
(state.rigctld_started === undefined || state.rigctld_started === "false")
)
health += 2;
if ( state.radio_status === false) health += 2;
if (process.env.FDUpdateAvail === "1") health += 1;
return health;
}

View file

@ -48,18 +48,13 @@ function getRigControlStuff() {
case "disabled":
return true;
case "rigctld":
if (state.rigctld_started === true) {
return true;
} else {
return false;
}
case "tci":
return true;
return state.radio_status
default:
console.error(
"Unknown radio control mode " + settings.remote.RADIO.control,
);
return "Unknown control type";
return "Unknown control type" + settings.remote.RADIO.control;
}
}

View file

@ -37,7 +37,8 @@ export function stateDispatcher(data) {
stateStore.dbfs_level = data["audio_dbfs"];
stateStore.channel_busy_slot = data["channel_busy_slot"];
stateStore.beacon_state = data["is_beacon_running"];
stateStore.radio_status = data["radio_status"];
stateStore.frequency = data["radio_frequency"];
/*
self.is_arq_state = False
self.is_arq_session = False

View file

@ -12,12 +12,13 @@ export const useStateStore = defineStore("stateStore", () => {
var bandwidth = ref("-");
var dbfs_level_percent = ref(0);
var dbfs_level = ref(0);
var radio_status = ref(false);
var ptt_state = ref("False");
var speed_level = ref(0);
var fft = ref();
var channel_busy = ref("");
var channel_busy = ref(false);
var channel_busy_slot = ref();
var scatter = ref();
var s_meter_strength_percent = ref(0);
@ -139,5 +140,6 @@ export const useStateStore = defineStore("stateStore", () => {
python_version,
modem_version,
rx_buffer_length,
radio_status,
};
});

View file

@ -1291,20 +1291,20 @@ class RF:
while True:
try:
# this looks weird, but is necessary for avoiding rigctld packet colission sock
threading.Event().wait(0.25)
#threading.Event().wait(0.1)
self.states.set("radio_status", self.radio.get_status())
#threading.Event().wait(0.25)
self.states.set("radio_frequency", self.radio.get_frequency())
threading.Event().wait(0.1)
self.states.set("radio_mode", self.radio.get_mode())
threading.Event().wait(0.1)
self.states.set("radio_bandwidth", self.radio.get_bandwidth())
threading.Event().wait(0.1)
self.states.set("radio_status", self.radio.get_status())
threading.Event().wait(0.1)
if self.states.is_transmitting:
self.radio_alc = self.radio.get_alc()
threading.Event().wait(0.1)
self.states.set("radio_rf_power", self.radio.get_level())
# threading.Event().wait(0.1)
threading.Event().wait(0.1)
self.states.set("radio_strength", self.radio.get_strength())
except Exception as e:

View file

@ -197,7 +197,7 @@ class radio:
def get_status(self):
""" """
return "connected" if self.data_connected and self.ptt_connected else "unknown/disconnected"
return True if self.data_connected and self.ptt_connected else False
def get_level(self):
try:

View file

@ -79,7 +79,7 @@ class radio:
Returns:
"""
return "connected"
return True
def get_ptt(self):
""" """
return None

View file

@ -44,6 +44,8 @@ class STATES:
self.radio_bandwidth = 0
self.radio_rf_power = 0
self.radio_strength = 0
# Set rig control status regardless or rig control method
self.radio_status = False
def sendState (self):
currentState = self.getAsJSON(False)
@ -56,9 +58,8 @@ class STATES:
def set(self, key, value):
setattr(self, key, value)
#print(f"State ==> Setting {key} to value {value}")
# only process data if changed
# but also send an update if more than a 'updateCadence' second(s) has lapsed
# Otherwise GUI can't tell if modem is active due to lack of state messages on startup
new_state = self.getAsJSON(True)
if new_state != self.newstate:
self.newstate = new_state
@ -77,5 +78,6 @@ class STATES:
"is_codec2_traffic": self.is_codec2_traffic,
"is_modem_running": self.is_modem_running,
"is_beacon_running": self.is_beacon_running,
"radio_status": self.radio_status,
"radio_frequency": self.radio_frequency,
})

View file

@ -307,7 +307,7 @@ class TCICtrl:
Returns:
"""
return "connected"
return True
def get_ptt(self):
""" """