fix: matrix key not work

This commit is contained in:
2025-05-20 18:11:04 +08:00
parent e4791b41a8
commit f8163be98b
3 changed files with 51 additions and 94 deletions

View File

@@ -38,16 +38,6 @@ export const useEquipments = defineStore('equipments', () => {
if (true === enableJtagBoundaryScan.value) jtagBoundaryScan();
});
watchPostEffect(async () => {
if (true === enableMatrixKey.value) {
const ret = await matrixKeypadSetKeyStates(matrixKeyStates)
if (!ret) {
dialog.error("设置矩阵键盘失败")
enableMatrixKey.value = false;
}
}
})
// Parse and Set
function setAddr(address: string | undefined): boolean {
if (isString(address) && z.string().ip("4").safeParse(address).success) {
@@ -76,7 +66,6 @@ export const useEquipments = defineStore('equipments', () => {
}
function setMatrixKey(keyNum: number | string | undefined, keyValue: boolean): boolean {
let _keyNum: number;
if (isString(keyNum)) {
_keyNum = toNumber(keyNum);
@@ -180,11 +169,12 @@ export const useEquipments = defineStore('equipments', () => {
async function matrixKeypadSetKeyStates(keyStates: boolean[]) {
const release = await matrixKeypadClientMutex.acquire();
console.log("set Key !!!!!!!!!!!!");
try {
const resp = await matrixKeypadClient.setMatrixKeyStatus(
boardAddr.value,
boardPort.value,
matrixKeyStates
keyStates
);
return resp;
} catch (e) {