From 8b777a3ad242f40f34cc36d07163c8c36630b5af Mon Sep 17 00:00:00 2001 From: DJ2LS Date: Sat, 11 Nov 2023 20:27:54 +0100 Subject: [PATCH] changed some gui settings....broken settings now I think.. --- gui/src/js/settingsHandler.ts | 29 ++++++++++++++++++++++++++--- modem/audio.py | 4 ++-- 2 files changed, 28 insertions(+), 5 deletions(-) diff --git a/gui/src/js/settingsHandler.ts b/gui/src/js/settingsHandler.ts index c72926d1..e62a6247 100644 --- a/gui/src/js/settingsHandler.ts +++ b/gui/src/js/settingsHandler.ts @@ -116,7 +116,28 @@ export function processModemConfig(data) { // For now its a hardcoded structure until we found a better way console.log(data); +// chatGPT function for iterating through all items and asserting them to a function + for (const category in data) { + if (data.hasOwnProperty(category)) { + for (const setting in data[category]) { + if (data[category].hasOwnProperty(setting)) { + // Create a variable name combining the category and setting name + const variableName = setting; + // Assign the value to the variable + settings[variableName] = data[category][setting]; + console.log(variableName + ': ' + settings[variableName]); + } + } + } +} + + + + + + +/* // STATION SETTINGS // Extract the callsign and SSID if (data.STATION.mycall.includes("-")) { @@ -162,6 +183,8 @@ export function processModemConfig(data) { // MESH SETTINGS settings.enable_mesh_features = data.MESH.enable_protocol; + + */ } export function processModemAudioDevices(data) { @@ -181,7 +204,7 @@ export function getModemConfigAsJSON() { const configData = { AUDIO: { - auto_tune: settings.auto_tune, + enable_auto_tune: settings.auto_tune, input_device: settings.rx_audio, rxaudiolevel: settings.rx_audio_level, output_device: settings.tx_audio, @@ -219,8 +242,8 @@ export function getModemConfigAsJSON() { ssid_list: [], }, TCI: { - ip: settings.tci_ip, - port: settings.tci_port, + tci_ip: settings.tci_ip, + tci_port: settings.tci_port, }, }; diff --git a/modem/audio.py b/modem/audio.py index 34db8808..1a1856a4 100644 --- a/modem/audio.py +++ b/modem/audio.py @@ -148,7 +148,7 @@ def test_audio_devices(input_id: str, output_id: str) -> list: ) test_result[0] = True except (sd.PortAudioError, ValueError) as e: - log.warning(f"[Audio-Test] Input device error ({input_id}) [{str(in_dev_index)}] [{in_dev_name}]:", e=e) + log.warning(f"[Audio-Test] Input device error ({input_id}):", e=e) test_result[0] = False try: result = get_device_index_from_crc(output_id, False) @@ -167,7 +167,7 @@ def test_audio_devices(input_id: str, output_id: str) -> list: except (sd.PortAudioError, ValueError) as e: - log.warning(f"[Audio-Test] Output device error ({output_id}) [{str(out_dev_index)}] [{out_dev_name}]:", e=e) + log.warning(f"[Audio-Test] Output device error ({output_id}):", e=e) test_result[1] = False sd._terminate()