added vfo setting

pull/742/head
DJ2LS 2024-06-04 12:20:36 +02:00
parent e44e9fb937
commit 3b1f87826e
6 changed files with 107 additions and 10 deletions

View File

@ -32,6 +32,25 @@ const serialStore = useSerialStore();
/>
</div>
<div class="input-group input-group-sm mb-1">
<label class="input-group-text w-50">rigctld VFO parameter</label>
<label class="input-group-text w-50">
<div class="form-check form-switch form-check-inline">
<input
class="form-check-input"
type="checkbox"
id="enableVFOSwitch"
v-model="settings.remote.RIGCTLD.enable_vfo"
@change="onChange"
/>
<label class="form-check-label" for="enableVFOSwitch">VFO</label>
</div>
</label>
</div>
<hr class="m-2" />
<div
:class="settings.remote.RADIO.control == 'rigctld_bundle' ? '' : 'd-none'"

View File

@ -80,6 +80,7 @@ const defaultConfig = {
path: "",
command: "",
arguments: "",
enable_vfo: false,
},
STATION: {
enable_explorer: false,

View File

@ -22,6 +22,7 @@ port = 4532
path =
command =
arguments =
enable_vfo = False
[RADIO]
control = disabled

View File

@ -47,6 +47,7 @@ class CONFIG:
'path': str,
'command': str,
'arguments': str,
'enable_vfo': bool,
},
'TCI': {
'tci_ip': str,

View File

@ -33,7 +33,7 @@ class radio:
'ptt': False, # Initial PTT state is set to False,
'tuner': False,
'swr': '---',
'vfo': False,
'vfo': '---',
}
# start rigctld...
@ -51,6 +51,7 @@ class radio:
self.connected = True
self.states.set_radio("radio_status", True)
self.log.info(f"[RIGCTLD] Connected to rigctld at {self.hostname}:{self.port}")
self.get_vfo()
except Exception as err:
self.log.warning(f"[RIGCTLD] Failed to connect to rigctld: {err}")
self.connected = False
@ -73,7 +74,8 @@ class radio:
'rf': '---',
'ptt': False, # Initial PTT state is set to False,
'tuner': False,
'swr': '---'
'swr': '---',
'vfo': '---'
}
def send_command(self, command) -> str:
@ -103,9 +105,10 @@ class radio:
return ""
def insert_vfo(self, command):
self.get_vfo()
if self.parameters['vfo'] and self.parameters['vfo'] not in [None, False, 'err', 0] and self.parameters['vfo'].startswith('VFO'):
#self.get_vfo()
if self.parameters['vfo'] and self.parameters['vfo'] not in [None, False, 'err', 0] and self.config["RIGCTLD"]["enable_vfo"]:
return f"{command[:1].strip()} {self.parameters['vfo']} {command[1:].strip()}"
return command
@ -271,7 +274,8 @@ class radio:
return True
except Exception as err:
self.log.warning(f"[RIGCTLD] Error getting TUNER state: {err}")
self.connected = False
self.get_vfo()
return False
def get_parameters(self):
@ -287,12 +291,14 @@ class radio:
self.get_rf()
self.get_tuner()
self.get_swr()
return self.parameters
def get_vfo(self):
try:
vfo_response = self.send_command('v')
if vfo_response not in [None, 'None', '']:
self.parameters['vfo'] = vfo_response.strip('')
else:
@ -306,7 +312,6 @@ class radio:
try:
command = self.insert_vfo('f')
frequency_response = self.send_command(command)
if frequency_response not in [None, '']:
self.parameters['frequency'] = int(frequency_response)
else:
@ -349,11 +354,9 @@ class radio:
self.parameters['alc'] = 'err'
except Exception as e:
print(command)
print(alc_response)
print(self.parameters['vfo'])
self.log.warning(f"Error getting ALC: {e}")
self.parameters['alc'] = 'err'
self.get_vfo()
def get_strength(self):
try:
@ -366,6 +369,7 @@ class radio:
except Exception as e:
self.log.warning(f"Error getting strength: {e}")
self.parameters['strength'] = 'err'
self.get_vfo()
def get_rf(self):
try:
@ -380,6 +384,7 @@ class radio:
except Exception as e:
self.log.warning(f"Error getting RF power: {e}")
self.parameters['rf'] = 'err'
self.get_vfo()
def get_swr(self):
try:
@ -394,6 +399,7 @@ class radio:
except Exception as e:
self.log.warning(f"Error getting SWR: {e}")
self.parameters['swr'] = 'err'
self.get_vfo()
def start_service(self):
binary_name = "rigctld"

View File

@ -0,0 +1,69 @@
import matplotlib.pyplot as plt
import numpy as np
codec2_modes = {
'datac4': {
'min_snr': -4,
'bit_rate': 87, # Bit rate in bits per second
'bandwidth': 250, # Bandwidth in Hz
},
'data_ofdm_500': {
'min_snr': 1,
'bit_rate': 276,
'bandwidth': 500,
},
'datac1': {
'min_snr': 5,
'bit_rate': 980,
'bandwidth': 1700,
},
#'datac2000': {
# 'min_snr': 7.5,
# 'bit_rate': 1280,
# 'bandwidth': 2000,
#},
'data_ofdm_2438': {
'min_snr': 8.5,
'bit_rate': 1830,
'bandwidth': 2438,
},
}
# Extracting data from the dictionary
snr_values = [info['min_snr'] for info in codec2_modes.values()]
bit_rates = [info['bit_rate'] for info in codec2_modes.values()]
bandwidths = [info['bandwidth'] for info in codec2_modes.values()]
modes = list(codec2_modes.keys()) # Get the mode names
# Plot bit/s vs SNR
plt.figure(figsize=(12, 6))
plt.subplot(1, 2, 1)
plt.scatter(snr_values, bit_rates, color='b')
for i, txt in enumerate(modes):
plt.annotate(txt, (snr_values[i], bit_rates[i])) # Annotate each point with mode name
plt.plot(snr_values, bit_rates, '--', color='b')
plt.yscale("log")
plt.xlabel('SNR (dB)')
plt.ylabel('Bit/s')
plt.title('Bit Rate vs SNR')
plt.grid(True)
# Plot bandwidth vs SNR
plt.subplot(1, 2, 2)
plt.scatter(snr_values, bandwidths, color='g')
for i, txt in enumerate(modes):
plt.annotate(txt, (snr_values[i], bandwidths[i])) # Annotate each point with mode name
plt.plot(snr_values, bandwidths, '--', color='g')
plt.xlabel('SNR (dB)')
plt.ylabel('Bandwidth (Hz)')
plt.title('Bandwidth vs SNR')
plt.grid(True)
# Show plot
plt.tight_layout()
plt.show()