feat:为边界扫描添加自动重复扫描
This commit is contained in:
parent
27c8ceb1db
commit
5103145d01
|
@ -22,6 +22,8 @@ export const useEquipments = defineStore("equipments", () => {
|
||||||
// Jtag
|
// Jtag
|
||||||
const jtagBitstream = ref<File>();
|
const jtagBitstream = ref<File>();
|
||||||
const jtagBoundaryScanFreq = ref(100);
|
const jtagBoundaryScanFreq = ref(100);
|
||||||
|
const jtagBoundaryScanErrorCount = ref(0); // 边界扫描连续错误计数
|
||||||
|
const maxJtagBoundaryScanErrors = 5; // 最大允许连续错误次数
|
||||||
const jtagClientMutex = withTimeout(
|
const jtagClientMutex = withTimeout(
|
||||||
new Mutex(),
|
new Mutex(),
|
||||||
1000,
|
1000,
|
||||||
|
@ -50,7 +52,11 @@ export const useEquipments = defineStore("equipments", () => {
|
||||||
|
|
||||||
// Watch
|
// Watch
|
||||||
watchPostEffect(async () => {
|
watchPostEffect(async () => {
|
||||||
if (true === enableJtagBoundaryScan.value) jtagBoundaryScan();
|
if (true === enableJtagBoundaryScan.value) {
|
||||||
|
// 重新启用时重置错误计数器
|
||||||
|
jtagBoundaryScanErrorCount.value = 0;
|
||||||
|
jtagBoundaryScan();
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// Parse and Set
|
// Parse and Set
|
||||||
|
@ -109,10 +115,20 @@ export const useEquipments = defineStore("equipments", () => {
|
||||||
);
|
);
|
||||||
|
|
||||||
constrainsts.batchSetConstraintStates(portStates);
|
constrainsts.batchSetConstraintStates(portStates);
|
||||||
|
|
||||||
|
// 扫描成功,重置错误计数器
|
||||||
|
jtagBoundaryScanErrorCount.value = 0;
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
dialog.error("边界扫描发生错误");
|
jtagBoundaryScanErrorCount.value++;
|
||||||
console.error(error);
|
|
||||||
enableJtagBoundaryScan.value = false;
|
console.error(`边界扫描错误 (${jtagBoundaryScanErrorCount.value}/${maxJtagBoundaryScanErrors}):`, error);
|
||||||
|
|
||||||
|
// 如果错误次数超过最大允许次数,才停止扫描并显示错误
|
||||||
|
if (jtagBoundaryScanErrorCount.value >= maxJtagBoundaryScanErrors) {
|
||||||
|
dialog.error("边界扫描发生连续错误,已自动停止");
|
||||||
|
enableJtagBoundaryScan.value = false;
|
||||||
|
jtagBoundaryScanErrorCount.value = 0; // 重置错误计数器
|
||||||
|
}
|
||||||
} finally {
|
} finally {
|
||||||
release();
|
release();
|
||||||
|
|
||||||
|
@ -267,6 +283,7 @@ export const useEquipments = defineStore("equipments", () => {
|
||||||
enableJtagBoundaryScan,
|
enableJtagBoundaryScan,
|
||||||
jtagBitstream,
|
jtagBitstream,
|
||||||
jtagBoundaryScanFreq,
|
jtagBoundaryScanFreq,
|
||||||
|
jtagBoundaryScanErrorCount,
|
||||||
jtagClientMutex,
|
jtagClientMutex,
|
||||||
jtagUploadBitstream,
|
jtagUploadBitstream,
|
||||||
jtagDownloadBitstream,
|
jtagDownloadBitstream,
|
||||||
|
|
Loading…
Reference in New Issue