Skip to content

Commit

Permalink
reorganize a bit of code for clarity
Browse files Browse the repository at this point in the history
  • Loading branch information
obra committed Feb 6, 2024
1 parent ef0b557 commit 2906e30
Showing 1 changed file with 11 additions and 8 deletions.
19 changes: 11 additions & 8 deletions src/renderer/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -179,21 +179,24 @@ const App = (props) => {
const newActiveDevice = new ActiveDevice();
setActiveDevice(newActiveDevice);

if (!focus.focusDeviceDescriptor?.bootloader) {
console.info("Probing for focus support...");
focus.setLayerSize(focus.focusDeviceDescriptor);
console.info("Set the layer size", focus.focusDeviceDescriptor);
if (focus.focusDeviceDescriptor?.bootloader) {
setConnected(true);

await navigate("/focus-not-detected");
return true;
}

console.info("Probing for focus support...");
focus.setLayerSize(focus.focusDeviceDescriptor);
console.info("Set the layer size", focus.focusDeviceDescriptor);

i18n.refreshHardware(focus.focusDeviceDescriptor);
setFocusDeviceDescriptor(null);

if (!focus.focusDeviceDescriptor?.bootloader) {
await newActiveDevice.loadConfigFromDevice();
}
await newActiveDevice.loadConfigFromDevice();
setConnected(true);

await navigate(newActiveDevice.focusDetected() ? "/editor" : "/focus-not-detected");
await navigate("/editor");
return true;
};

Expand Down

0 comments on commit 2906e30

Please sign in to comment.