Fix firmware flashing

pull/375/head
Connor Rigby 2017-12-05 20:29:10 -08:00
parent e731e5be35
commit e597e1f726
6 changed files with 9 additions and 6 deletions

View File

@ -69,6 +69,8 @@ config :farmbot, :behaviour,
config :nerves_init_gadget,
address_method: :static
config :nerves_firmware_ssh, authorized_keys: File.exists?(Path.join(System.user_home!(), ".ssh/id_rsa.pub"))
config :bootloader,
init: [:nerves_runtime],
app: :farmbot

View File

@ -96,9 +96,6 @@ defmodule Farmbot.Firmware.Gcode.Parser do
defp report_xyz(position, reporter) when is_bitstring(position),
do: position |> String.split(" ") |> do_parse_pos(reporter)
# This string came in from the arduin and i need to do something about it..
# defp do_parse_pos(["X0.00", "Y0.00", "ZX0.00", "Y0.00", "Z0.00", "Q0"], reporter)
defp do_parse_pos(["X" <> x, "Y" <> y, "Z" <> z, "Q" <> tag], reporter)
when reporter in [:report_current_position, :report_encoder_position_scaled] do
{tag, {reporter, String.to_float(x), String.to_float(y), String.to_float(z)}}

View File

@ -120,7 +120,7 @@ defmodule Farmbot.Firmware.UartHandler.Update do
def avrdude(fw_file, uart, tty) do
close(uart)
case System.cmd("avrdude", ~w"-q -q -patmega2560 -cwiring -P#{tty} -b@uart_speed -D -V -Uflash:w:#{fw_file}:i", [stderr_to_stdout: true, into: IO.stream(:stdio, :line)]) do
case System.cmd("avrdude", ~w"-q -q -patmega2560 -cwiring -P#{tty} -b#{@uart_speed} -D -V -Uflash:w:#{fw_file}:i", [stderr_to_stdout: true, into: IO.stream(:stdio, :line)]) do
{_, 0} -> Logger.success 1, "Firmware flashed!"
{_, err_code} -> Logger.error 1, "Failed to flash Firmware! #{err_code}"
end

View File

@ -21,7 +21,7 @@ defmodule Farmbot.Logger.Console do
@doc false
def start_link do
GenStage.start_link(__MODULE__, [], name: __MODULE__)
GenStage.start_link(__MODULE__, [], [name: __MODULE__])
end
def init([]) do

View File

@ -244,6 +244,10 @@ defmodule Farmbot.Repo do
BotState.set_sync_status(:sync_error)
Logger.error(1, "Failed to apply sync_cmd: (#{repo}) #{inspect(sync_cmd)} (#{e.action})")
fix_repo(repo, sync_cmd)
_ ->
BotState.set_sync_status(:sync_error)
Logger.error(1, "Failed to apply sync_cmd: (#{repo}) #{inspect(sync_cmd)}")
fix_repo(repo, sync_cmd)
end
end

View File

@ -1 +1 @@
iex --sname farmbot --cookie democookie --remsh farmbot@farmbot-eb30
iex --sname farmbot --cookie democookie --remsh farmbot@farmbot-8dac