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; }