fix: 尝试修复示波器与旋转编码器无法工作的问题
This commit is contained in:
@@ -84,7 +84,7 @@ const [useProvideOscilloscope, useOscilloscopeState] = createInjectionState(
|
||||
clearHub();
|
||||
});
|
||||
|
||||
function initHub() {
|
||||
async function initHub() {
|
||||
if (oscilloscopeHub.value) return;
|
||||
|
||||
const connection = AuthManager.createHubConnection("OscilloscopeHub");
|
||||
@@ -96,7 +96,7 @@ const [useProvideOscilloscope, useOscilloscopeState] = createInjectionState(
|
||||
connection,
|
||||
oscilloscopeReceiver,
|
||||
);
|
||||
connection.start();
|
||||
await connection.start();
|
||||
oscilloscopeHub.value = { connection, proxy };
|
||||
}
|
||||
|
||||
@@ -252,12 +252,12 @@ const [useProvideOscilloscope, useOscilloscopeState] = createInjectionState(
|
||||
alert.warn("当前没有正在进行的捕获操作", 2000);
|
||||
return;
|
||||
}
|
||||
isCapturing.value = false;
|
||||
const release = await operationMutex.acquire();
|
||||
try {
|
||||
const proxy = getHubProxy();
|
||||
const stopped = await proxy.stopCapture();
|
||||
if (!stopped) throw new Error("无法停止捕获");
|
||||
isCapturing.value = false;
|
||||
alert.info("捕获已停止", 2000);
|
||||
} catch (error) {
|
||||
alert.error("停止捕获失败", 3000);
|
||||
|
||||
@@ -30,7 +30,7 @@ export const useRotaryEncoder = defineStore("RotaryEncoder", () => {
|
||||
clearHub();
|
||||
});
|
||||
|
||||
function initHub() {
|
||||
async function initHub() {
|
||||
if (rotaryEncoderHub.value) return;
|
||||
const connection = AuthManager.createHubConnection("RotaryEncoderHub");
|
||||
const proxy =
|
||||
@@ -39,7 +39,7 @@ export const useRotaryEncoder = defineStore("RotaryEncoder", () => {
|
||||
connection,
|
||||
rotaryEncoderReceiver,
|
||||
);
|
||||
connection.start();
|
||||
await connection.start();
|
||||
rotaryEncoderHub.value = { connection, proxy };
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user