mirror of
https://github.com/DJ2LS/FreeDATA
synced 2024-05-14 08:04:33 +00:00
adjusted rigctld
This commit is contained in:
parent
0f0e7b6532
commit
ddb61ad866
1 changed files with 20 additions and 14 deletions
|
@ -228,14 +228,8 @@ class radio:
|
||||||
if self.connected:
|
if self.connected:
|
||||||
try:
|
try:
|
||||||
result = self.send_command('u TUNER')
|
result = self.send_command('u TUNER')
|
||||||
if result is not None:
|
state = result not in [None, ''] and int(result) == 1
|
||||||
if int(result) == 1:
|
self.parameters['tuner'] = state
|
||||||
state = True
|
|
||||||
else:
|
|
||||||
state = False
|
|
||||||
else:
|
|
||||||
state = False
|
|
||||||
self.parameters['tuner'] = state # Update TUNER state in parameters
|
|
||||||
return True
|
return True
|
||||||
except Exception as err:
|
except Exception as err:
|
||||||
self.log.warning(f"[RIGCTLD] Error getting TUNER state: {err}")
|
self.log.warning(f"[RIGCTLD] Error getting TUNER state: {err}")
|
||||||
|
@ -259,7 +253,11 @@ class radio:
|
||||||
def get_frequency(self):
|
def get_frequency(self):
|
||||||
try:
|
try:
|
||||||
frequency_response = self.send_command('f')
|
frequency_response = self.send_command('f')
|
||||||
self.parameters['frequency'] = int(frequency_response) if frequency_response is not None else 'err'
|
if frequency_response not in [None, '']:
|
||||||
|
self.parameters['frequency'] = int(frequency_response)
|
||||||
|
else:
|
||||||
|
self.parameters['frequency'] = 'err'
|
||||||
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
self.log.warning(f"Error getting frequency: {e}")
|
self.log.warning(f"Error getting frequency: {e}")
|
||||||
self.parameters['frequency'] = 'err'
|
self.parameters['frequency'] = 'err'
|
||||||
|
@ -267,7 +265,7 @@ class radio:
|
||||||
def get_mode_bandwidth(self):
|
def get_mode_bandwidth(self):
|
||||||
try:
|
try:
|
||||||
response = self.send_command('m')
|
response = self.send_command('m')
|
||||||
if response is not None:
|
if response not in [None, '']:
|
||||||
response = response.strip()
|
response = response.strip()
|
||||||
mode, bandwidth = response.split('\n', 1)
|
mode, bandwidth = response.split('\n', 1)
|
||||||
bandwidth = int(bandwidth)
|
bandwidth = int(bandwidth)
|
||||||
|
@ -288,7 +286,12 @@ class radio:
|
||||||
def get_alc(self):
|
def get_alc(self):
|
||||||
try:
|
try:
|
||||||
alc_response = self.send_command('l ALC')
|
alc_response = self.send_command('l ALC')
|
||||||
self.parameters['alc'] = alc_response if alc_response is not None else 'err'
|
if alc_response not in [None, '']:
|
||||||
|
self.parameters['alc'] = int(alc_response)
|
||||||
|
else:
|
||||||
|
self.parameters['alc'] = 'err'
|
||||||
|
|
||||||
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
self.log.warning(f"Error getting ALC: {e}")
|
self.log.warning(f"Error getting ALC: {e}")
|
||||||
self.parameters['alc'] = 'err'
|
self.parameters['alc'] = 'err'
|
||||||
|
@ -296,7 +299,10 @@ class radio:
|
||||||
def get_strength(self):
|
def get_strength(self):
|
||||||
try:
|
try:
|
||||||
strength_response = self.send_command('l STRENGTH')
|
strength_response = self.send_command('l STRENGTH')
|
||||||
self.parameters['strength'] = int(strength_response) if strength_response is not None else 'err'
|
if strength_response not in [None, '']:
|
||||||
|
self.parameters['strength'] = int(strength_response)
|
||||||
|
else:
|
||||||
|
self.parameters['strength'] = 'err'
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
self.log.warning(f"Error getting strength: {e}")
|
self.log.warning(f"Error getting strength: {e}")
|
||||||
self.parameters['strength'] = 'err'
|
self.parameters['strength'] = 'err'
|
||||||
|
@ -304,7 +310,7 @@ class radio:
|
||||||
def get_rf(self):
|
def get_rf(self):
|
||||||
try:
|
try:
|
||||||
rf_response = self.send_command('l RFPOWER')
|
rf_response = self.send_command('l RFPOWER')
|
||||||
if rf_response is not None:
|
if rf_response not in [None, '']:
|
||||||
self.parameters['rf'] = int(float(rf_response) * 100)
|
self.parameters['rf'] = int(float(rf_response) * 100)
|
||||||
else:
|
else:
|
||||||
self.parameters['rf'] = 'err'
|
self.parameters['rf'] = 'err'
|
||||||
|
@ -317,7 +323,7 @@ class radio:
|
||||||
def get_swr(self):
|
def get_swr(self):
|
||||||
try:
|
try:
|
||||||
rf_response = self.send_command('l SWR')
|
rf_response = self.send_command('l SWR')
|
||||||
if rf_response is not None:
|
if rf_response not in [None, '']:
|
||||||
self.parameters['swr'] = rf_response
|
self.parameters['swr'] = rf_response
|
||||||
else:
|
else:
|
||||||
self.parameters['swr'] = 'err'
|
self.parameters['swr'] = 'err'
|
||||||
|
|
Loading…
Reference in a new issue