 
   defp default_port do
     ports = UART.enumerate()
-    results = Enum.find(ports, fn {_k, v} ->
-      Map.get(v, :vendor_id) == @vendor_id and
-      Map.get(v, :product_id) == @product_id
-    end)
+
+    results =
+      Enum.find(ports, fn {_k, v} ->
+        vendor_id = Map.get(v, :vendor_id)
+        product_id = Map.get(v, :product_id)
+
+        vendor_id == @vendor_id and product_id == @product_id
+      end)
 
     case results do
       {path, _details} -> path

    {:noreply, state}
  end

  def handle_info({:nerves_uart, port, message}, state)
    when !Map.has_key?(state, port) do

    {:noreply, state}
  end

  def handle_info({:nerves_uart, port, message}, state)
    when Map.has_key?(state, port) do

    {point_type, new_settings} = next_settings(Map.get(state, port))

    case point_type do
      :crest, :trough ->
        Logger.info(message)

      _ ->
    end

    new_state = Map.put(state, port, new_settings)
    {:noreply, new_state}
  end

  def handle_info(msg, state) do

  end

  defp set_up(port, log_path, sample_rate) do
    with {:ok, settings} <- generate_settings(log_path, sample_rate),
         :ok <- UART.open(uart_pid(), port, @open_options),
         :ok <- UART.flush(uart_pid()),
         :ok <- UART.write(uart_pid(), @on),
