From c299c3e82b18d65e4debdb94379889f7b11154a4 Mon Sep 17 00:00:00 2001 From: DJ2LS Date: Thu, 26 Oct 2023 11:19:21 +0200 Subject: [PATCH] set tx audio level --- gui/src/components/main.vue | 3 --- gui/src/components/main_modals.vue | 12 +++++++++--- gui/src/js/settingsHandler.ts | 1 + gui/src/js/sock.js | 8 ++++++++ gui/src/store/settingsStore.js | 3 +++ gui/src/store/stateStore.js | 4 ++-- 6 files changed, 23 insertions(+), 8 deletions(-) diff --git a/gui/src/components/main.vue b/gui/src/components/main.vue index 495e76d3..9290638e 100644 --- a/gui/src/components/main.vue +++ b/gui/src/components/main.vue @@ -3,9 +3,6 @@ import { setActivePinia } from "pinia"; import pinia from "../store/index"; setActivePinia(pinia); -import { useStateStore } from "../store/stateStore.js"; -const state = useStateStore(pinia); - import main_modals from "./main_modals.vue"; import main_top_navbar from "./main_top_navbar.vue"; import main_audio from "./main_audio.vue"; diff --git a/gui/src/components/main_modals.vue b/gui/src/components/main_modals.vue index cd47990b..5cea2388 100644 --- a/gui/src/components/main_modals.vue +++ b/gui/src/components/main_modals.vue @@ -4,6 +4,7 @@ import { setActivePinia } from "pinia"; import pinia from "../store/index"; setActivePinia(pinia); +import { saveSettingsToFile } from "../js/settingsHandler"; import { useStateStore } from "../store/stateStore.js"; const state = useStateStore(pinia); @@ -11,6 +12,10 @@ const state = useStateStore(pinia); import { useChatStore } from "../store/chatStore.js"; const chat = useChatStore(pinia); + +import { useSettingsStore } from "../store/settingsStore.js"; +const settings = useSettingsStore(pinia); + import { deleteChatByCallsign, getNewMessagesByDXCallsign, @@ -23,7 +28,8 @@ function tuneAudio() { } function set_audio_level() { - setTxAudioLevel(state.audio_level); + saveSettingsToFile() + setTxAudioLevel(settings.tx_audio_level); } function deleteChat() { @@ -1194,7 +1200,7 @@ const transmissionSpeedChartDataMessageInfo = computed(() => ({
TX Level - {{ state.audio_level }} + {{ settings.tx_audio_level }} ({ step="1" id="audioLevelTX" @click="set_audio_level()" - v-model="state.audio_level" + v-model="settings.tx_audio_level " />
diff --git a/gui/src/js/settingsHandler.ts b/gui/src/js/settingsHandler.ts index 5b9d545e..d18464f7 100644 --- a/gui/src/js/settingsHandler.ts +++ b/gui/src/js/settingsHandler.ts @@ -55,6 +55,7 @@ const configDefaultSettings = "daemon_port": 3001,\ "rx_audio" : "",\ "tx_audio" : "",\ + "tx_audio_level" : 100,\ "mycall": "AA0AA-0",\ "myssid": "0",\ "mygrid": "JN40aa",\ diff --git a/gui/src/js/sock.js b/gui/src/js/sock.js index dca93f07..d0982fe9 100644 --- a/gui/src/js/sock.js +++ b/gui/src/js/sock.js @@ -171,6 +171,14 @@ client.on("data", function (socketdata) { stateStore.arq_state = data["arq_state"]; stateStore.mode = data["mode"]; stateStore.bandwidth = data["bandwidth"]; + stateStore.tx_audio_level = data["audio_level"]; + + // if audio level is different from config one, send new audio level to modem + if (parseInt(stateStore.audio_level) !== parseInt(settings.tx_audio_level)){ + setTxAudioLevel(settings.tx_audio_level); + } + + stateStore.dbfs_level = data["audio_dbfs"]; stateStore.ptt_state = data["ptt_state"]; stateStore.speed_level = data["speed_level"]; diff --git a/gui/src/store/settingsStore.js b/gui/src/store/settingsStore.js index 00787ff2..3dc7c0a8 100644 --- a/gui/src/store/settingsStore.js +++ b/gui/src/store/settingsStore.js @@ -5,6 +5,7 @@ export const useSettingsStore = defineStore("settingsStore", () => { // audio var tx_audio = ref(); var rx_audio = ref(); + var tx_audio_level = ref(); // network var modem_host = ref("127.0.0.1"); @@ -157,6 +158,7 @@ export const useSettingsStore = defineStore("settingsStore", () => { enable_mesh_features: enable_mesh_features.value, tx_audio: tx_audio.value, rx_audio: rx_audio.value, + tx_audio_level: tx_audio_level.value, }; return config_export; @@ -224,5 +226,6 @@ export const useSettingsStore = defineStore("settingsStore", () => { rx_audio, getSerialDevices, serial_devices, + tx_audio_level, }; }); diff --git a/gui/src/store/stateStore.js b/gui/src/store/stateStore.js index 8d7041e8..235b5c68 100644 --- a/gui/src/store/stateStore.js +++ b/gui/src/store/stateStore.js @@ -40,7 +40,7 @@ export const useStateStore = defineStore("stateStore", () => { var audio_recording = ref(""); var hamlib_status = ref(""); - var audio_level = ref(""); + var tx_audio_level = ref(""); var alc = ref(""); var is_codec2_traffic = ref(""); @@ -158,7 +158,7 @@ export const useStateStore = defineStore("stateStore", () => { arq_total_bytes, audio_recording, hamlib_status, - audio_level, + tx_audio_level, alc, updateTncState, arq_transmission_percent,