From f6920694450a0f405eb44898b3c99270ac327218 Mon Sep 17 00:00:00 2001 From: Jesse Vincent Date: Sun, 3 Mar 2024 22:08:16 -0800 Subject: [PATCH] Fixes for not being able to flash from bootloader --- src/api/focus.js | 5 ++++- src/renderer/ActiveDevice.js | 4 ++++ src/renderer/screens/FirmwareUpdate.js | 2 +- 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/src/api/focus.js b/src/api/focus.js index 979980674..bddc1dea0 100644 --- a/src/api/focus.js +++ b/src/api/focus.js @@ -33,6 +33,8 @@ class Focus { this.timeout = 30000; this._request_id = 0; this.chunked_writes = true; + this.in_bootloader = false; + this.resetDeviceState(); } @@ -45,7 +47,6 @@ class Focus { this._plugins = []; this._requestQueue = []; this._processingRequest = false; - this.in_bootloader = false; } async checkSerialDevice(focusDeviceDescriptor, usbInfo) { @@ -196,6 +197,8 @@ class Focus { dVid == deviceDescriptor.usb.bootloader.vendorId ) { this.in_bootloader = true; + } else { + this.in_bootloader = false; } this.focusDeviceDescriptor = deviceDescriptor; diff --git a/src/renderer/ActiveDevice.js b/src/renderer/ActiveDevice.js index d8e0375d0..9cbfc9aa2 100644 --- a/src/renderer/ActiveDevice.js +++ b/src/renderer/ActiveDevice.js @@ -92,6 +92,10 @@ export function ActiveDevice() { }; this.focusDetected = () => { + if (this.bootloaderDetected()) { + return false; + } + if (!this.focus.isInApplicationMode()) { return false; } diff --git a/src/renderer/screens/FirmwareUpdate.js b/src/renderer/screens/FirmwareUpdate.js index a00509c5c..7c997f855 100644 --- a/src/renderer/screens/FirmwareUpdate.js +++ b/src/renderer/screens/FirmwareUpdate.js @@ -294,7 +294,7 @@ const FirmwareUpdate = (props) => { useEffect(() => { let steps; - if (focus.in_bootloader) { + if (focusDeviceDescriptor?.bootloader) { if (factoryReset) { steps = ["flash", "reconnect", "factoryRestore"]; } else {