From 8ab55f411d33bc6dcb613de46dec49eb84d98acc Mon Sep 17 00:00:00 2001 From: SikongJueluo Date: Wed, 20 Aug 2025 21:04:54 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E7=BC=96=E7=A0=81?= =?UTF-8?q?=E5=99=A8=E9=9C=80=E8=A6=81=E9=87=8D=E6=96=B0=E5=BC=80=E5=85=B3?= =?UTF-8?q?=E6=89=8D=E8=83=BD=E4=BD=BF=E7=94=A8=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/Oscilloscope/OscilloscopeManager.ts | 5 ++++- src/stores/Peripherals/RotaryEncoder.ts | 5 ++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/components/Oscilloscope/OscilloscopeManager.ts b/src/components/Oscilloscope/OscilloscopeManager.ts index 23f79ad..c932ad2 100644 --- a/src/components/Oscilloscope/OscilloscopeManager.ts +++ b/src/components/Oscilloscope/OscilloscopeManager.ts @@ -112,7 +112,10 @@ const [useProvideOscilloscope, useOscilloscopeState] = createInjectionState( } function getHubProxy() { - if (!oscilloscopeHub.value) throw new Error("Hub not initialized"); + if (!oscilloscopeHub.value) { + reinitializeHub(); + throw new Error("Hub not initialized"); + } return oscilloscopeHub.value.proxy; } diff --git a/src/stores/Peripherals/RotaryEncoder.ts b/src/stores/Peripherals/RotaryEncoder.ts index 7dd11b7..79dc748 100644 --- a/src/stores/Peripherals/RotaryEncoder.ts +++ b/src/stores/Peripherals/RotaryEncoder.ts @@ -55,7 +55,10 @@ export const useRotaryEncoder = defineStore("RotaryEncoder", () => { } function getHubProxy() { - if (!rotaryEncoderHub.value) throw new Error("Hub not initialized"); + if (!rotaryEncoderHub.value) { + reinitializeHub(); + throw new Error("Hub not initialized"); + } return rotaryEncoderHub.value.proxy; }