     * busy reports
 
   # State machine
-  The firmware starts in a `:boot` state. It then loads all paramaters
-  writes all paramaters, and goes to idle if all params were loaded successfully.
+  The firmware starts in a `:transport_boot` state, moving to `:boot`. It then
+  loads all paramaters writes all paramaters, and goes to idle if all params
+  were loaded successfully.
 
   State machine flows go as follows:
   ## Boot
-      :boot
+      :transport_boot
+      |> :boot
       |> :no_config
       |> :configuration
       |> :idle

  """
  defdelegate request(server \\ __MODULE__, code), to: Request

  def close_transport(server \\ __MODULE__) do
    _ = command(server, {nil, {:emergency_lock, []}})
    GenServer.call(server, :close_transport)
  end

  def open_transport(server \\ __MODULE__) do
  end

  @doc """

  def init(args) do
    transport = Keyword.fetch!(args, :transport)
    side_effects = Keyword.get(args, :side_effects)

    # Add an anon function that transport implementations should call.
    fw = self()
    fun = fn {_, _} = code -> GenServer.cast(fw, code) end
    transport_args = Keyword.put(args, :handle_gcode, fun)

    state = %State{
      transport_pid: nil,
      transport_ref: nil,
      transport: transport,
      transport_args: transport_args,
      side_effects: side_effects,
      status: :transport_boot,
      command_queue: [],
      configuration_queue: []
    }

    send(self(), :timeout)
    {:ok, state}
  end

  def terminate(reason, state) do
    for {pid, _code} <- state.command_queue, do: send(pid, reason)
  end

  # This will be the first message received right after `init/1`
  # It should try to open a transport every `transport_init_error_retry_ms`
  # until success.
  # TODO(Connor) maybe make this timer back off over time.
  def handle_info(:timeout, %{status: :transport_boot} = state) do
    case GenServer.start_link(state.transport, state.transport_args) do
      {:ok, pid} ->
        ref = Process.monitor(pid)

        Logger.debug(
          "Firmware Transport #{state.transport} started. #{inspect(state.transport_args)}"
        )

        state = goto(%{state | transport_pid: pid, transport_ref: ref}, :boot)
        {:noreply, state}

      error ->
        Logger.error("Error starting Firmware: #{inspect(error)}")
        Process.send_after(self(), :timeout, @transport_init_error_retry_ms)
        {:noreply, state}
    end
  end

  # @spec handle_info(:timeout, state) :: {:noreply, state}
