fix: frontend upload bitstream failed

This commit is contained in:
2025-05-19 15:56:23 +08:00
parent 5042bf8ce5
commit ba6ec73b84
6 changed files with 99 additions and 102 deletions

View File

@@ -7,11 +7,16 @@ import { isNumber } from 'mathjs';
export const useEquipments = defineStore('equipments', () => {
const boardAddr = ref("127.0.0.1")
const boardPort = ref(1234)
function setAddr(address: string) {
const jtagBitstream = ref<File>()
function setAddr(address: string | undefined) {
if (isUndefined(address)) return;
if (z.string().ip("4").safeParse(address).success)
boardAddr.value = address;
}
function setPort(port: string | number) {
function setPort(port: string | number | undefined) {
if (isUndefined(port)) return;
if (isString(port) && port.length != 0) {
const portNumber = toNumber(port);
@@ -23,8 +28,6 @@ export const useEquipments = defineStore('equipments', () => {
boardPort.value = port;
}
}
const jtagBitstream = ref<File | undefined>()
const remoteUpdateBitstream = ref<File | undefined>()
return {
boardAddr,
@@ -32,7 +35,6 @@ export const useEquipments = defineStore('equipments', () => {
setAddr,
setPort,
jtagBitstream,
remoteUpdateBitstream,
}
})