Skip to content

Instantly share code, notes, and snippets.

@matthewjberger
Created June 2, 2022 22:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save matthewjberger/a428b06b36a0fbad2153fd295d82e05a to your computer and use it in GitHub Desktop.
Save matthewjberger/a428b06b36a0fbad2153fd295d82e05a to your computer and use it in GitHub Desktop.
import DeleteForeverIcon from "@mui/icons-material/DeleteForever"
import HomeIcon from "@mui/icons-material/Home"
import PauseIcon from "@mui/icons-material/Pause"
import PlayArrowIcon from "@mui/icons-material/PlayArrow"
import RefreshIcon from "@mui/icons-material/Refresh"
import StopIcon from "@mui/icons-material/Stop"
import { ReactNode } from "react"
import { ZoneControlState } from "../../db/makeline-health"
interface Item {
command: string,
description: string,
icon: ReactNode,
buttonText: string,
mqttCommand: string,
state: ZoneControlState,
enabledStates: ZoneControlState[],
}
export const items: Item[] = [
{
command: "Run automation",
description: "Activates the automated machinery and order processing.",
icon: <PlayArrowIcon />,
buttonText: "Run automation",
mqttCommand: "Run",
state: ZoneControlState.Running,
enabledStates: [ZoneControlState.Idle, ZoneControlState.Stopped, ZoneControlState.Paused],
},
{
command: "Pause",
description: "All machinery will stop after finishing a cycle, orders will stop processing.",
icon: <PauseIcon />,
buttonText: "Pause activity",
mqttCommand: "Pause",
state: ZoneControlState.Paused,
enabledStates: [ZoneControlState.Running],
},
{
command: "Stop",
description:
"Stops the machinery from moving immediately. Order processing continues and existing queue remains untouched.",
icon: <StopIcon />,
buttonText: "Stop makeline",
mqttCommand: "Stop",
state: ZoneControlState.Stopped,
enabledStates: [],
},
{
command: "Reset",
description: "Re-attempts the action that caused the alarm, or moves machinery back to a starting position.",
icon: <RefreshIcon />,
buttonText: "Reset",
mqttCommand: "Reset",
state: ZoneControlState.Unknown,
enabledStates: [
ZoneControlState.Idle,
ZoneControlState.Paused,
ZoneControlState.PurgeComplete,
ZoneControlState.Stopped,
],
},
{
command: "Home",
description: "Resets machinery and primes them for order processing.",
icon: <HomeIcon />,
buttonText: "Home system",
mqttCommand: "Home",
state: ZoneControlState.Unknown,
enabledStates: [ZoneControlState.Paused],
},
{
command: "Purge",
description:
"Clears all orders from the queue and those being assembled, removes all physical bowls, and completes all partial disables.",
icon: <DeleteForeverIcon />,
buttonText: "Purge system",
mqttCommand: "Purge",
state: ZoneControlState.PurgeComplete,
enabledStates: [ZoneControlState.Running],
},
]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment