Skip to content

Commit

Permalink
Fixes for not being able to flash from bootloader
Browse files Browse the repository at this point in the history
  • Loading branch information
obra committed Mar 4, 2024
1 parent c480cd4 commit f692069
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 2 deletions.
5 changes: 4 additions & 1 deletion src/api/focus.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ class Focus {
this.timeout = 30000;
this._request_id = 0;
this.chunked_writes = true;
this.in_bootloader = false;

this.resetDeviceState();
}

Expand All @@ -45,7 +47,6 @@ class Focus {
this._plugins = [];
this._requestQueue = [];
this._processingRequest = false;
this.in_bootloader = false;
}

async checkSerialDevice(focusDeviceDescriptor, usbInfo) {
Expand Down Expand Up @@ -196,6 +197,8 @@ class Focus {
dVid == deviceDescriptor.usb.bootloader.vendorId
) {
this.in_bootloader = true;
} else {
this.in_bootloader = false;
}

this.focusDeviceDescriptor = deviceDescriptor;
Expand Down
4 changes: 4 additions & 0 deletions src/renderer/ActiveDevice.js
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,10 @@ export function ActiveDevice() {
};

this.focusDetected = () => {
if (this.bootloaderDetected()) {
return false;
}

if (!this.focus.isInApplicationMode()) {
return false;
}
Expand Down
2 changes: 1 addition & 1 deletion src/renderer/screens/FirmwareUpdate.js
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,7 @@ const FirmwareUpdate = (props) => {

useEffect(() => {
let steps;
if (focus.in_bootloader) {
if (focusDeviceDescriptor?.bootloader) {
if (factoryReset) {
steps = ["flash", "reconnect", "factoryRestore"];
} else {
Expand Down

0 comments on commit f692069

Please sign in to comment.