Skip to content

Commit

Permalink
Fix the display of flashing state
Browse files Browse the repository at this point in the history
  • Loading branch information
obra committed Sep 27, 2023
1 parent 58c5ec6 commit 7363381
Showing 1 changed file with 14 additions and 8 deletions.
22 changes: 14 additions & 8 deletions src/renderer/screens/FirmwareUpdate.js
Original file line number Diff line number Diff line change
Expand Up @@ -231,27 +231,33 @@ const FirmwareUpdate = (props) => {
};

const onStepChange = async (desiredState) => {
console.info("executing step", { step: desiredState });
console.info("executing step", {
step: desiredState,
flashSteps: flashSteps,
});
setActiveStep(Math.min(activeStep + 1, flashSteps.length));
flashSteps.forEach((step, index) => {
console.log("Considering ", { step, index });
if (step == desiredState) {
console.log("Found the step we're looking for:" + step);
setActiveStep(index);
}
});
};

const setFlashingProcessSteps = () => {
useEffect(() => {
let steps;
if (focusDeviceDescriptor?.bootloader) {
if (factoryReset) {
return ["flash", "reconnect", "factoryRestore"];
steps = ["flash", "reconnect", "factoryRestore"];
} else {
return ["flash"];
steps["flash"];
}
} else {
if (factoryReset) {
return ["bootloader", "flash", "reconnect", "factoryRestore"];
steps = ["bootloader", "flash", "reconnect", "factoryRestore"];
} else {
return [
steps = [
"saveEEPROM",
"bootloader",
"flash",
Expand All @@ -260,11 +266,11 @@ const FirmwareUpdate = (props) => {
];
}
}
};
setFlashSteps(steps);
}, [factoryReset, focusDeviceDescriptor]);

const upload = async () => {
setConfirmationOpen(false);
setFlashSteps(setFlashingProcessSteps());

await props.toggleFlashing();
setProgress("flashing");
Expand Down

0 comments on commit 7363381

Please sign in to comment.