mirror of
https://github.com/DJ2LS/FreeDATA
synced 2024-05-14 08:04:33 +00:00
RADIO MANAGER - WIP fixed set mode and power
This commit is contained in:
parent
f85e032e2f
commit
87002745a5
6 changed files with 15 additions and 9 deletions
|
@ -47,7 +47,7 @@ function set_radio_parameters() {
|
||||||
<select
|
<select
|
||||||
class="form-control"
|
class="form-control"
|
||||||
v-model="state.mode"
|
v-model="state.mode"
|
||||||
@click="set_hamlib_mode()"
|
@click="set_radio_parameters()"
|
||||||
v-bind:class="{
|
v-bind:class="{
|
||||||
disabled: state.hamlib_status === 'disconnected',
|
disabled: state.hamlib_status === 'disconnected',
|
||||||
}"
|
}"
|
||||||
|
@ -69,7 +69,7 @@ function set_radio_parameters() {
|
||||||
<select
|
<select
|
||||||
class="form-control"
|
class="form-control"
|
||||||
v-model="state.rf_level"
|
v-model="state.rf_level"
|
||||||
@click="set_hamlib_rf_level()"
|
@click="set_radio_parameters()"
|
||||||
v-bind:class="{
|
v-bind:class="{
|
||||||
disabled: state.hamlib_status === 'disconnected',
|
disabled: state.hamlib_status === 'disconnected',
|
||||||
}"
|
}"
|
||||||
|
|
|
@ -121,6 +121,7 @@ export function setRadioParameters(frequency, mode, rf_level) {
|
||||||
return apiPost("/radio", {
|
return apiPost("/radio", {
|
||||||
radio_frequency: frequency,
|
radio_frequency: frequency,
|
||||||
radio_mode: mode,
|
radio_mode: mode,
|
||||||
|
radio_rf_level: rf_level,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
export function getRadioStatus() {
|
export function getRadioStatus() {
|
||||||
|
|
|
@ -39,13 +39,16 @@ class RadioManager:
|
||||||
def set_mode(self, mode):
|
def set_mode(self, mode):
|
||||||
self.radio.set_mode(mode)
|
self.radio.set_mode(mode)
|
||||||
|
|
||||||
|
def set_rf_level(self, level):
|
||||||
|
self.radio.set_rf_level(level)
|
||||||
|
|
||||||
def update_parameters(self):
|
def update_parameters(self):
|
||||||
while not self.stop_event.is_set():
|
while not self.stop_event.is_set():
|
||||||
parameters = self.radio.get_parameters()
|
parameters = self.radio.get_parameters()
|
||||||
self.state_manager.set("radio_frequency", parameters['frequency'])
|
self.state_manager.set("radio_frequency", parameters['frequency'])
|
||||||
self.state_manager.set("radio_mode", parameters['mode'])
|
self.state_manager.set("radio_mode", parameters['mode'])
|
||||||
self.state_manager.set("radio_bandwidth", parameters['bandwidth'])
|
self.state_manager.set("radio_bandwidth", parameters['bandwidth'])
|
||||||
self.state_manager.set("radio_rf_power", parameters['rf'])
|
self.state_manager.set("radio_rf_level", parameters['rf'])
|
||||||
|
|
||||||
if self.state_manager.isTransmitting():
|
if self.state_manager.isTransmitting():
|
||||||
self.radio_alc = parameters['alc']
|
self.radio_alc = parameters['alc']
|
||||||
|
|
|
@ -110,7 +110,7 @@ class radio:
|
||||||
"""
|
"""
|
||||||
if self.connected:
|
if self.connected:
|
||||||
try:
|
try:
|
||||||
command = f"M {mode}"
|
command = f"M {mode} 0"
|
||||||
self.send_command(command)
|
self.send_command(command)
|
||||||
self.parameters['mode'] = mode
|
self.parameters['mode'] = mode
|
||||||
return True
|
return True
|
||||||
|
@ -159,7 +159,7 @@ class radio:
|
||||||
self.connected = False
|
self.connected = False
|
||||||
return False
|
return False
|
||||||
|
|
||||||
def set_rf(self, rf):
|
def set_rf_level(self, rf):
|
||||||
"""Set the RF.
|
"""Set the RF.
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
|
@ -170,7 +170,7 @@ class radio:
|
||||||
"""
|
"""
|
||||||
if self.connected:
|
if self.connected:
|
||||||
try:
|
try:
|
||||||
command = f"l RF {rf}"
|
command = f"L RFPOWER {rf/100}" #RF RFPOWER --> RFPOWER == IC705
|
||||||
self.send_command(command)
|
self.send_command(command)
|
||||||
self.parameters['rf'] = rf
|
self.parameters['rf'] = rf
|
||||||
return True
|
return True
|
||||||
|
@ -199,7 +199,7 @@ class radio:
|
||||||
|
|
||||||
self.parameters['alc'] = self.send_command('l ALC')
|
self.parameters['alc'] = self.send_command('l ALC')
|
||||||
self.parameters['strength'] = self.send_command('l STRENGTH')
|
self.parameters['strength'] = self.send_command('l STRENGTH')
|
||||||
self.parameters['rf'] = self.send_command('l RF')
|
self.parameters['rf'] = self.send_command('l RFPOWER') # RF, RFPOWER
|
||||||
|
|
||||||
"""Return the latest fetched parameters."""
|
"""Return the latest fetched parameters."""
|
||||||
return self.parameters
|
return self.parameters
|
||||||
|
|
|
@ -246,7 +246,8 @@ def post_modem_send_raw_stop():
|
||||||
def get_post_radio():
|
def get_post_radio():
|
||||||
if request.method in ['POST']:
|
if request.method in ['POST']:
|
||||||
app.radio_manager.set_frequency(request.json['radio_frequency'])
|
app.radio_manager.set_frequency(request.json['radio_frequency'])
|
||||||
#app.radio_manager.set_mode(request.json['radio_mode'])
|
app.radio_manager.set_mode(request.json['radio_mode'])
|
||||||
|
app.radio_manager.set_rf_level(int(request.json['radio_rf_level']))
|
||||||
|
|
||||||
return api_response(request.json)
|
return api_response(request.json)
|
||||||
elif request.method == 'GET':
|
elif request.method == 'GET':
|
||||||
|
|
|
@ -43,7 +43,7 @@ class StateManager:
|
||||||
self.radio_frequency = 0
|
self.radio_frequency = 0
|
||||||
self.radio_mode = None
|
self.radio_mode = None
|
||||||
self.radio_bandwidth = 0
|
self.radio_bandwidth = 0
|
||||||
self.radio_rf_power = 0
|
self.radio_rf_level = 0
|
||||||
self.radio_strength = 0
|
self.radio_strength = 0
|
||||||
# Set rig control status regardless or rig control method
|
# Set rig control status regardless or rig control method
|
||||||
self.radio_status = False
|
self.radio_status = False
|
||||||
|
@ -183,4 +183,5 @@ class StateManager:
|
||||||
"radio_status": self.radio_status,
|
"radio_status": self.radio_status,
|
||||||
"radio_frequency": self.radio_frequency,
|
"radio_frequency": self.radio_frequency,
|
||||||
"radio_mode": self.radio_mode,
|
"radio_mode": self.radio_mode,
|
||||||
|
"radio_rf_level": self.radio_rf_level
|
||||||
}
|
}
|
Loading…
Reference in a new issue