From bd8c8f26858cf4fe137e5f981d42b6e379a300c5 Mon Sep 17 00:00:00 2001 From: DJ2LS Date: Fri, 26 Apr 2024 15:30:56 +0200 Subject: [PATCH] work on swr/tuner --- freedata_gui/src/js/eventHandler.js | 13 +++++-------- freedata_server/state_manager.py | 7 +++---- 2 files changed, 8 insertions(+), 12 deletions(-) diff --git a/freedata_gui/src/js/eventHandler.js b/freedata_gui/src/js/eventHandler.js index b5d8a212..e5c2e561 100644 --- a/freedata_gui/src/js/eventHandler.js +++ b/freedata_gui/src/js/eventHandler.js @@ -9,7 +9,7 @@ import { */ import { toRaw } from "vue"; import { displayToast } from "./popupHandler"; -import { getFreedataMessages, getModemState, getAudioDevices } from "./api"; +import { getFreedataMessages, getModemState, getAudioDevices, getRadioStatus } from "./api"; import { processFreedataMessages } from "./messagesHandler.ts"; import { processRadioStatus } from "./radioHandler.ts"; @@ -35,6 +35,9 @@ export async function loadAllData() { let stateData = await getModemState(); console.log(stateData); + let radioData = await getRadioStatus(); + console.log(stateData); + getRemote(); getOverallHealth(); audioStore.loadAudioDevices(); @@ -50,7 +53,7 @@ export function connectionFailed(endpoint, event) { export function stateDispatcher(data) { data = JSON.parse(data); //Leave commented when not needed, otherwise can lead to heap overflows due to the amount of data logged - //console.debug(data); + console.log(data); if (data["type"] == "state-change" || data["type"] == "state") { stateStore.modem_connection = "connected"; stateStore.busy_state = data["is_modem_busy"]; @@ -62,9 +65,7 @@ export function stateDispatcher(data) { Math.pow(10, data["audio_dbfs"] / 20) * 100, ); - stateStore.channel_busy_slot = data["channel_busy_slot"]; - stateStore.beacon_state = data["is_beacon_running"]; stateStore.is_away_from_key = data["is_away_from_key"]; @@ -74,20 +75,16 @@ export function stateDispatcher(data) { } if (data["type"] == "radio-change" || data["type"] == "radio") { - stateStore.s_meter_strength_raw = Math.round(data["s_meter_strength"]); stateStore.s_meter_strength_percent = Math.round( Math.pow(10, data["s_meter_strength"] / 20) * 100, ); - stateStore.radio_status = data["radio_status"]; stateStore.frequency = data["radio_frequency"]; stateStore.mode = data["radio_mode"]; stateStore.swr = data["radio_swr"]; stateStore.tuner = data["radio_tuner"]; - - } } diff --git a/freedata_server/state_manager.py b/freedata_server/state_manager.py index 44d195d1..f0a450ea 100644 --- a/freedata_server/state_manager.py +++ b/freedata_server/state_manager.py @@ -7,7 +7,7 @@ class StateManager: # state related settings self.statequeue = statequeue self.newstate = None - self.new_radio = None + self.newradio = None self.last = time.time() # freedata_server related states @@ -76,11 +76,10 @@ class StateManager: #print(f"State ==> Setting {key} to value {value}") # only process data if changed new_radio = self.get_radio_event(True) - if new_radio != self.new_radio: - self.new_radio = new_radio + if new_radio != self.newradio: + self.newradio = new_radio self.sendStateUpdate() - def set_channel_slot_busy(self, array): for i in range(0,len(array),1): if not array[i] == self.channel_busy_slot[i]: