Remove references to old `reset` logic. TODO: Add new reset system based on `firmware_hardware` rather than platform

qa/firmware_reset_rewrite
Rick Carlino 2020-05-03 09:07:30 -05:00
parent 4a30a75cac
commit 471b9f2543
7 changed files with 0 additions and 67 deletions

View File

@ -2,8 +2,6 @@ use Mix.Config
config :logger, handle_otp_reports: true, handle_sasl_reports: true
config :farmbot_firmware, FarmbotFirmware, reset: FarmbotFirmware.NullReset
# TODO(Rick) We probably don't need to use this anymore now that Mox is a thing.
config :farmbot_celery_script, FarmbotCeleryScript.SysCalls,
sys_calls: FarmbotCeleryScript.SysCalls.Stubs

View File

@ -1,15 +0,0 @@
defmodule FarmbotFirmware.NullReset do
@moduledoc """
Does nothing in reference to resetting the firmware port
"""
@behaviour FarmbotFirmware.Reset
use GenServer
@impl FarmbotFirmware.Reset
def reset(), do: :ok
@impl GenServer
def init(_args) do
{:ok, %{}}
end
end

View File

@ -1,8 +0,0 @@
defmodule FarmbotFirmware.Reset do
@moduledoc """
Behaviour to reset the UART connection into
bootloader mode for firmware upgrades.
"""
@callback reset :: :ok | {:error, Stirng.t()}
end

View File

@ -80,8 +80,6 @@ config :farmbot, FarmbotOS.Platform.Supervisor,
FarmbotOS.Platform.Host.Configurator
]
config :farmbot_firmware, FarmbotFirmware, reset: FarmbotFirmware.NullReset
config :logger,
handle_sasl_reports: false,
handle_otp_reports: false,

View File

@ -1,8 +1,5 @@
use Mix.Config
config :farmbot_firmware, FarmbotFirmware,
reset: FarmbotOS.Platform.Target.FirmwareReset.GPIO
config :farmbot, FarmbotOS.Init.Supervisor,
init_children: [
FarmbotOS.Platform.Target.RTCWorker

View File

@ -2,9 +2,6 @@ use Mix.Config
config :farmbot_core, FarmbotCore.FirmwareOpenTask, attempt_threshold: 50
config :farmbot_firmware, FarmbotFirmware,
reset: FarmbotOS.Platform.Target.FirmwareReset.GPIO
# :farmbot_firmware, FarmbotFirmware changes too much.
# Needed one that would stay stable, so I duplicated it here:
config :farmbot, FarmbotOS.SysCalls.FlashFirmware, gpio: Circuits.GPIO

View File

@ -1,34 +0,0 @@
defmodule FarmbotOS.Platform.Target.FirmwareReset.GPIO do
@moduledoc """
Uses GPIO pin 19 to reset the firmware.
"""
@behaviour FarmbotFirmware.Reset
use GenServer
require Logger
@impl FarmbotFirmware.Reset
def reset(server \\ __MODULE__) do
Logger.debug("calling gpio reset/0")
GenServer.call(server, :reset)
end
@impl GenServer
def init(_args) do
Logger.debug("initializing gpio thing for firmware reset")
{:ok, gpio} = Circuits.GPIO.open(19, :output)
{:ok, %{gpio: gpio}}
end
@impl GenServer
def handle_call(:reset, _from, state) do
Logger.warn("doing firmware gpio reset")
with :ok <- Circuits.GPIO.write(state.gpio, 1),
:ok <- Circuits.GPIO.write(state.gpio, 0) do
{:reply, :ok, state}
else
error -> {:reply, error, state}
end
end
end