mirror of
https://github.com/DJ2LS/FreeDATA
synced 2024-05-14 08:04:33 +00:00
first attempt fixing radio mode related problems by separating parameters
This commit is contained in:
parent
f1971cdf4f
commit
f76dc5da14
5 changed files with 64 additions and 33 deletions
|
@ -8,7 +8,7 @@ import "../../node_modules/gridstack/dist/gridstack.min.css";
|
||||||
import { GridStack } from "gridstack";
|
import { GridStack } from "gridstack";
|
||||||
import { useStateStore } from "../store/stateStore.js";
|
import { useStateStore } from "../store/stateStore.js";
|
||||||
const state = useStateStore(pinia);
|
const state = useStateStore(pinia);
|
||||||
import { setRadioParameters } from "../js/api";
|
import { setRadioParametersFrequency, setRadioParametersMode, setRadioParametersRFLevel } from "../js/api";
|
||||||
import { saveLocalSettingsToConfig, settingsStore } from "../store/settingsStore";
|
import { saveLocalSettingsToConfig, settingsStore } from "../store/settingsStore";
|
||||||
|
|
||||||
import active_heard_stations from "./grid/grid_active_heard_stations.vue";
|
import active_heard_stations from "./grid/grid_active_heard_stations.vue";
|
||||||
|
@ -251,14 +251,22 @@ new gridWidget(
|
||||||
//New new widget ID should be 20
|
//New new widget ID should be 20
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|
||||||
function updateFrequencyAndApply(frequency) {
|
function updateFrequencyAndApply(frequency) {
|
||||||
state.new_frequency = frequency;
|
state.new_frequency = frequency;
|
||||||
set_radio_parameters();
|
set_radio_parameter_frequency();
|
||||||
}
|
}
|
||||||
|
|
||||||
function set_radio_parameters(){
|
function set_radio_parameter_frequency(){
|
||||||
setRadioParameters(state.new_frequency, state.mode, state.rf_level);
|
setRadioParametersFrequency(state.new_frequency)
|
||||||
|
}
|
||||||
|
|
||||||
|
function set_radio_parameter_mode(){
|
||||||
|
setRadioParametersMode(state.mode)
|
||||||
|
}
|
||||||
|
|
||||||
|
function set_radio_parameter_rflevel(){
|
||||||
|
setRadioParametersRFLevel(state.rf_level)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,15 +1,26 @@
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { setActivePinia } from "pinia";
|
import { setActivePinia } from "pinia";
|
||||||
import pinia from "../../store/index";
|
import pinia from "../../store/index";
|
||||||
import { setRadioParameters } from "../../js/api";
|
import { setRadioParametersFrequency, setRadioParametersMode, setRadioParametersRFLevel } from "../../js/api";
|
||||||
setActivePinia(pinia);
|
setActivePinia(pinia);
|
||||||
|
|
||||||
import { useStateStore } from "../../store/stateStore.js";
|
import { useStateStore } from "../../store/stateStore.js";
|
||||||
const state = useStateStore(pinia);
|
const state = useStateStore(pinia);
|
||||||
|
|
||||||
function set_radio_parameters() {
|
function set_radio_parameter_frequency(){
|
||||||
setRadioParameters(state.frequency, state.mode, state.rf_level);
|
setRadioParametersFrequency(state.new_frequency)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function set_radio_parameter_mode(){
|
||||||
|
setRadioParametersMode(state.mode)
|
||||||
|
}
|
||||||
|
|
||||||
|
function set_radio_parameter_rflevel(){
|
||||||
|
setRadioParametersRFLevel(state.rf_level)
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
|
@ -47,18 +58,14 @@ function set_radio_parameters() {
|
||||||
<select
|
<select
|
||||||
class="form-control"
|
class="form-control"
|
||||||
v-model="state.mode"
|
v-model="state.mode"
|
||||||
@click="set_radio_parameters()"
|
@click="set_radio_parameter_mode()"
|
||||||
v-bind:class="{
|
v-bind:class="{
|
||||||
disabled: state.hamlib_status === 'disconnected',
|
disabled: state.hamlib_status === 'disconnected',
|
||||||
}"
|
}"
|
||||||
>
|
>
|
||||||
<option value="USB">USB</option>
|
<option value="USB">USB</option>
|
||||||
<option value="LSB">LSB</option>
|
<option value="USB-D">USB-D</option>
|
||||||
<option value="PKTUSB">PKT-U</option>
|
<option value="PKTUSB">PKT-U</option>
|
||||||
<option value="PKTLSB">PKT-L</option>
|
|
||||||
<option value="AM">AM</option>
|
|
||||||
<option value="FM">FM</option>
|
|
||||||
<option value="PKTFM">PKTFM</option>
|
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -69,7 +76,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_radio_parameters()"
|
@click="set_radio_parameter_rflevel()"
|
||||||
v-bind:class="{
|
v-bind:class="{
|
||||||
disabled: state.hamlib_status === 'disconnected',
|
disabled: state.hamlib_status === 'disconnected',
|
||||||
}"
|
}"
|
||||||
|
|
|
@ -6,16 +6,25 @@ setActivePinia(pinia);
|
||||||
import { useStateStore } from "../store/stateStore.js";
|
import { useStateStore } from "../store/stateStore.js";
|
||||||
const state = useStateStore(pinia);
|
const state = useStateStore(pinia);
|
||||||
|
|
||||||
import { setRadioParameters } from "../js/api";
|
import { setRadioParametersFrequency, setRadioParametersMode, setRadioParametersRFLevel } from "../js/api";
|
||||||
|
|
||||||
function updateFrequencyAndApply(frequency) {
|
function updateFrequencyAndApply(frequency) {
|
||||||
state.new_frequency = frequency;
|
state.new_frequency = frequency;
|
||||||
set_radio_parameters();
|
set_radio_parameter_frequency();
|
||||||
}
|
}
|
||||||
|
|
||||||
function set_radio_parameters() {
|
function set_radio_parameter_frequency(){
|
||||||
setRadioParameters(state.new_frequency, state.mode, state.rf_level);
|
setRadioParametersFrequency(state.new_frequency)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function set_radio_parameter_mode(){
|
||||||
|
setRadioParametersMode(state.mode)
|
||||||
|
}
|
||||||
|
|
||||||
|
function set_radio_parameter_rflevel(){
|
||||||
|
setRadioParametersRFLevel(state.rf_level)
|
||||||
|
}
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
|
@ -207,18 +216,14 @@ function set_radio_parameters() {
|
||||||
<select
|
<select
|
||||||
class="form-control"
|
class="form-control"
|
||||||
v-model="state.mode"
|
v-model="state.mode"
|
||||||
@click="set_radio_parameters()"
|
@click="set_radio_parameter_mode()"
|
||||||
v-bind:class="{
|
v-bind:class="{
|
||||||
disabled: state.hamlib_status === 'disconnected',
|
disabled: state.hamlib_status === 'disconnected',
|
||||||
}"
|
}"
|
||||||
>
|
>
|
||||||
<option value="USB">USB</option>
|
<option value="USB">USB</option>
|
||||||
<option value="LSB">LSB</option>
|
<option value="USB-D">USB-D</option>
|
||||||
<option value="PKTUSB">PKT-U</option>
|
<option value="PKTUSB">PKT-U</option>
|
||||||
<option value="PKTLSB">PKT-L</option>
|
|
||||||
<option value="AM">AM</option>
|
|
||||||
<option value="FM">FM</option>
|
|
||||||
<option value="PKTFM">PKTFM</option>
|
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -229,7 +234,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_radio_parameters()"
|
@click="set_radio_parameter_rf_level()"
|
||||||
v-bind:class="{
|
v-bind:class="{
|
||||||
disabled: state.hamlib_status === 'disconnected',
|
disabled: state.hamlib_status === 'disconnected',
|
||||||
}"
|
}"
|
||||||
|
|
|
@ -142,11 +142,19 @@ export async function getModemState() {
|
||||||
return await apiGet("/modem/state");
|
return await apiGet("/modem/state");
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function setRadioParameters(frequency, mode, rf_level) {
|
export async function setRadioParametersFrequency(frequency) {
|
||||||
return await apiPost("/radio", {
|
return await apiPost("/radio", {
|
||||||
radio_frequency: frequency,
|
radio_frequency: frequency,
|
||||||
radio_mode: mode,
|
});
|
||||||
radio_rf_level: rf_level,
|
}
|
||||||
|
export async function setRadioParametersMode(mode) {
|
||||||
|
return await apiPost("/radio", {
|
||||||
|
radio_mode: mode
|
||||||
|
});
|
||||||
|
}
|
||||||
|
export async function setRadioParametersRFLevel(rf_level) {
|
||||||
|
return await apiPost("/radio", {
|
||||||
|
radio_rf_level: rf_level
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
export async function getRadioStatus() {
|
export async function getRadioStatus() {
|
||||||
|
|
|
@ -233,8 +233,11 @@ def post_modem_send_raw_stop():
|
||||||
@app.route('/radio', methods=['GET', 'POST'])
|
@app.route('/radio', methods=['GET', 'POST'])
|
||||||
def get_post_radio():
|
def get_post_radio():
|
||||||
if request.method in ['POST']:
|
if request.method in ['POST']:
|
||||||
|
if "radio_frequency" in [request.json]:
|
||||||
app.radio_manager.set_frequency(request.json['radio_frequency'])
|
app.radio_manager.set_frequency(request.json['radio_frequency'])
|
||||||
|
if "radio_mode" in [request.json]:
|
||||||
app.radio_manager.set_mode(request.json['radio_mode'])
|
app.radio_manager.set_mode(request.json['radio_mode'])
|
||||||
|
if "radio_rf_level" in [request.json]:
|
||||||
app.radio_manager.set_rf_level(int(request.json['radio_rf_level']))
|
app.radio_manager.set_rf_level(int(request.json['radio_rf_level']))
|
||||||
|
|
||||||
return api_response(request.json)
|
return api_response(request.json)
|
||||||
|
|
Loading…
Reference in a new issue