mirror of
https://github.com/DJ2LS/FreeDATA
synced 2024-05-14 08:04:33 +00:00
added tuner control
This commit is contained in:
parent
edd50128b8
commit
67e7f1b71a
7 changed files with 38 additions and 4 deletions
|
@ -5,6 +5,7 @@ import {
|
|||
setRadioParametersFrequency,
|
||||
setRadioParametersMode,
|
||||
setRadioParametersRFLevel,
|
||||
setRadioParametersTuner,
|
||||
} from "../../js/api";
|
||||
setActivePinia(pinia);
|
||||
|
||||
|
@ -22,6 +23,11 @@ function set_radio_parameter_mode() {
|
|||
function set_radio_parameter_rflevel() {
|
||||
setRadioParametersRFLevel(state.rf_level);
|
||||
}
|
||||
|
||||
function set_radio_parameter_auto_tuner() {
|
||||
console.log(state.tuner)
|
||||
setRadioParametersTuner(state.tuner);
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
|
@ -97,6 +103,21 @@ function set_radio_parameter_rflevel() {
|
|||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-check form-switch">
|
||||
<input
|
||||
class="form-check-input"
|
||||
type="checkbox"
|
||||
role="switch"
|
||||
id="flexSwitchTuner"
|
||||
v-model="state.tuner"
|
||||
@change="set_radio_parameter_auto_tuner()"
|
||||
/>
|
||||
<label class="form-check-label" for="flexSwitchTuner"
|
||||
>Tuner</label
|
||||
>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -160,6 +160,13 @@ export async function setRadioParametersRFLevel(rf_level) {
|
|||
radio_rf_level: rf_level,
|
||||
});
|
||||
}
|
||||
|
||||
export async function setRadioParametersTuner(state) {
|
||||
return await apiPost("/radio", {
|
||||
radio_tuner: state,
|
||||
});
|
||||
}
|
||||
|
||||
export async function getRadioStatus() {
|
||||
return await apiGet("/radio");
|
||||
}
|
||||
|
|
|
@ -84,7 +84,7 @@ export function stateDispatcher(data) {
|
|||
stateStore.s_meter_strength_percent = Math.round(
|
||||
Math.pow(10, data["s_meter_strength"] / 20) * 100,
|
||||
);
|
||||
|
||||
console.log(data)
|
||||
stateStore.radio_status = data["radio_status"];
|
||||
stateStore.frequency = data["radio_frequency"];
|
||||
stateStore.mode = data["radio_mode"];
|
||||
|
|
|
@ -15,4 +15,5 @@ export async function processRadioStatus() {
|
|||
stateStore.mode = result.radio_mode;
|
||||
stateStore.frequency = result.radio_frequency;
|
||||
stateStore.rf_level = result.radio_rf_level;
|
||||
stateStore.tuner = result.radio_tuner;
|
||||
}
|
||||
|
|
|
@ -12,7 +12,7 @@ export const useStateStore = defineStore("stateStore", () => {
|
|||
var bandwidth = ref("-");
|
||||
|
||||
var swr = ref(0);
|
||||
var tuner = ref("-");
|
||||
var tuner = ref();
|
||||
|
||||
var dbfs_level_percent = ref(0);
|
||||
var dbfs_level = ref(0);
|
||||
|
@ -88,6 +88,7 @@ export const useStateStore = defineStore("stateStore", () => {
|
|||
frequency,
|
||||
mode,
|
||||
bandwidth,
|
||||
tuner,
|
||||
swr,
|
||||
tuner,
|
||||
dbfs_level,
|
||||
|
|
|
@ -32,17 +32,22 @@ class RadioManager:
|
|||
def set_ptt(self, state):
|
||||
self.radio.set_ptt(state)
|
||||
|
||||
|
||||
def set_tuner(self, state):
|
||||
self.radio.set_tuner(state)
|
||||
self.state_manager.set_radio("radio_tuner", state)
|
||||
|
||||
def set_frequency(self, frequency):
|
||||
self.radio.set_frequency(frequency)
|
||||
self.state_manager.set_radio("radio_frequency", frequency)
|
||||
|
||||
def set_mode(self, mode):
|
||||
self.radio.set_mode(mode)
|
||||
self.state_manager.set_radio("radio_mode", mode)
|
||||
|
||||
def set_rf_level(self, level):
|
||||
self.radio.set_rf_level(level)
|
||||
self.state_manager.set_radio("radio_rf_level", level)
|
||||
|
||||
def update_parameters(self):
|
||||
while not self.stop_event.is_set():
|
||||
|
|
|
@ -261,8 +261,7 @@ def get_post_radio():
|
|||
if "radio_rf_level" in request.json:
|
||||
app.radio_manager.set_rf_level(int(request.json['radio_rf_level']))
|
||||
if "radio_tuner" in request.json:
|
||||
app.radio_manager.set_tuner(int(request.json['radio_tuner']))
|
||||
|
||||
app.radio_manager.set_tuner(request.json['radio_tuner'])
|
||||
return api_response(request.json)
|
||||
elif request.method == 'GET':
|
||||
return api_response(app.state_manager.get_radio_status())
|
||||
|
|
Loading…
Reference in a new issue