Fix serial device ignore

This commit is contained in:
Mashintime 2023-12-19 20:19:22 -05:00
parent 1027ea1b98
commit 1f38a59bb8

View file

@ -3,8 +3,6 @@ import { getAudioDevices, getSerialDevices } from "./api";
let audioDevices = await getAudioDevices();
let serialDevices = await getSerialDevices();
//Add an ignore option for rig and ptt for transceivers that don't require them
serialDevices.push({ description: "-- ignore --", port: "ignore" });
//Dummy device data sent if unable to get devices from modem to prevent GUI crash
const skel = JSON.parse(`
@ -43,5 +41,14 @@ export function audioOutputOptions() {
}
export function serialDeviceOptions() {
//Return ignore option if no serialDevices
if (serialDevices === undefined)
return [{ description: "-- ignore --", port: "ignore" }];
if (serialDevices.findIndex((device) => device.port == 'ignore') == -1) {
//Add an ignore option for rig and ptt for transceivers that don't require them
serialDevices.push({ description: "-- ignore --", port: "ignore" })
}
return serialDevices;
}