Skip to content

Commit

Permalink
added flash device SM route and checks to fix flashing (#445)
Browse files Browse the repository at this point in the history
Signed-off-by: Alejandro Parcet <[email protected]>
  • Loading branch information
AlexDygma authored Jun 21, 2023
1 parent dd03f85 commit 043dfca
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 4 deletions.
21 changes: 17 additions & 4 deletions src/renderer/controller/FlashingSM/FlashDevice.js
Original file line number Diff line number Diff line change
Expand Up @@ -426,6 +426,7 @@ const FlashDevice = createMachine(
entry: [
(context, event) => {
console.log("Selecting upgrade path");
console.log("context of device", context.device);
},
assign({
stateblock: (context, event) => 1
Expand All @@ -434,7 +435,8 @@ const FlashDevice = createMachine(
raise("flashingPath")
],
on: [
{ event: "*", target: "flashDefyWired", cond: "doNotFlashSides" },
{ event: "*", target: "flashDefyWired", cond: "doNotFlashSidesW" },
{ event: "*", target: "resetDefyWireless", cond: "doNotFlashSidesWi" },
{ event: "*", target: "resetRaiseNeuron", cond: "flashRaise" },
{ event: "*", target: "flashRightSide", cond: "flashSides" }
]
Expand Down Expand Up @@ -862,13 +864,24 @@ const FlashDevice = createMachine(
{
guards: {
flashSides: (context, event) => {
return !context.device.bootloader == true && context.device.info.product !== "Raise";
return context.device.bootloader !== true && context.device.info.product !== "Raise";
},
flashRaise: (context, event) => {
return context.device.info.product === "Raise";
},
doNotFlashSides: (context, event) => {
return context.device.bootloader == true && context.device.info.product !== "Raise";
doNotFlashSidesW: (context, event) => {
return (
context.device.bootloader === true &&
context.device.info.product !== "Raise" &&
context.device.info.keyboardType === "wired"
);
},
doNotFlashSidesWi: (context, event) => {
return (
context.device.bootloader === true &&
context.device.info.product !== "Raise" &&
context.device.info.keyboardType === "wireless"
);
},
doNotWaitForESC: (context, event) => {
return context.device.bootloader == true || context.sideLeftBL == true;
Expand Down
1 change: 1 addition & 0 deletions src/renderer/modules/NavigationMenu/NavigationMenu.js
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,7 @@ class NavigationMenu extends Component {

contextUpdater = async () => {
const focus = new Focus();
if (focus.device.bootloader) return;
let parts = await focus.command("version");
parts = parts.split(" ");
let versions = {
Expand Down

0 comments on commit 043dfca

Please sign in to comment.