mirror of
https://github.com/DJ2LS/FreeDATA
synced 2024-05-14 08:04:33 +00:00
work on swr/tuner
This commit is contained in:
parent
ffb82ae01f
commit
bd8c8f2685
2 changed files with 8 additions and 12 deletions
|
@ -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"];
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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]:
|
||||
|
|
Loading…
Reference in a new issue