fix update checker and replace Logger.debug with Logger.info
parent
db82a788db
commit
589061b5c6
|
@ -26,14 +26,14 @@ Instalation should be fairly straight forward, you will need a computer for this
|
||||||
0. Plug your SD Card into your RPi3
|
0. Plug your SD Card into your RPi3
|
||||||
0. Plug your Arduino into your RPi3
|
0. Plug your Arduino into your RPi3
|
||||||
0. Plug your power into your RPi3
|
0. Plug your power into your RPi3
|
||||||
0. From a WiFi enabled device*, search for the SSID `FarmbotConfigurator`
|
0. From a WiFi enabled device*, search for the SSID `farmbot-XXXX`
|
||||||
0. Connect to that and open a web browser to [http://192.168.24.1/](http://192.168.24.1)
|
0. Connect to that and open a web browser to [http://192.168.24.1/](http://192.168.24.1)
|
||||||
0. Follow the on screen instructions to configure your FarmBot. Once you save your configuration FarmBot will connect to your home WiFi network and to the FarmBot web application.
|
0. Follow the on screen instructions to configure your FarmBot. Once you save your configuration FarmBot will connect to your home WiFi network and to the FarmBot web application.
|
||||||
|
|
||||||
\* If you are using a smartphone you may need to disable cellular data to allow your phone's browser to connect to the configurator.
|
\* If you are using a smartphone you may need to disable cellular data to allow your phone's browser to connect to the configurator.
|
||||||
|
|
||||||
## Updating the firmware
|
## Updating the firmware
|
||||||
To update the firmware on the Raspberry Pi (Only version 3 for now) and the Arduino (on any rpi), simply use the "update" buttons on the web application. There is no need to reinstall the entire OS.
|
To update the firmware on the Raspberry Pi simply use the "update" button on the web application. There is no need to reinstall the entire OS.
|
||||||
|
|
||||||
|
|
||||||
# Problems?
|
# Problems?
|
||||||
|
|
|
@ -6,7 +6,7 @@ config :farmbot,
|
||||||
config :tzdata, :data_dir, "/tmp"
|
config :tzdata, :data_dir, "/tmp"
|
||||||
config :tzdata, :autoupdate, :disabled
|
config :tzdata, :autoupdate, :disabled
|
||||||
|
|
||||||
config :quantum, cron: [ "5 1 * * *": {Farmbot.Updates.Handler, :do_update_check}]
|
config :quantum, cron: [ "5 1 * * *": {FFarmbot.System.Updates, :do_update_check}]
|
||||||
|
|
||||||
config :nerves_interim_wifi, regulatory_domain: "US" #FIXME
|
config :nerves_interim_wifi, regulatory_domain: "US" #FIXME
|
||||||
|
|
||||||
|
|
|
@ -48,7 +48,7 @@ defmodule Farmbot.BotState.Hardware do
|
||||||
|
|
||||||
if !Farmbot.Serial.Handler.available? do
|
if !Farmbot.Serial.Handler.available? do
|
||||||
# UGHHHHHH
|
# UGHHHHHH
|
||||||
Logger.debug "Waiting for Serial..."
|
Logger.info "Waiting for Serial..."
|
||||||
Process.sleep(100)
|
Process.sleep(100)
|
||||||
set_initial_params(state)
|
set_initial_params(state)
|
||||||
end
|
end
|
||||||
|
@ -56,11 +56,11 @@ defmodule Farmbot.BotState.Hardware do
|
||||||
Farmbot.CeleryScript.Command.read_param(%{label: "param_version"}, [])
|
Farmbot.CeleryScript.Command.read_param(%{label: "param_version"}, [])
|
||||||
|
|
||||||
if Enum.empty?(state.mcu_params) do
|
if Enum.empty?(state.mcu_params) do
|
||||||
Logger.debug "reading all mcu params."
|
Logger.info "reading all mcu params."
|
||||||
Farmbot.CeleryScript.Command.read_all_params(%{}, [])
|
Farmbot.CeleryScript.Command.read_all_params(%{}, [])
|
||||||
{:ok, :no_params}
|
{:ok, :no_params}
|
||||||
else
|
else
|
||||||
Logger.debug "setting previous mcu commands."
|
Logger.info "setting previous mcu commands."
|
||||||
config_pairs = Enum.map(state.mcu_params, fn({param, val}) ->
|
config_pairs = Enum.map(state.mcu_params, fn({param, val}) ->
|
||||||
%Farmbot.CeleryScript.Ast{kind: "pair",
|
%Farmbot.CeleryScript.Ast{kind: "pair",
|
||||||
args: %{label: param, value: val}, body: []}
|
args: %{label: param, value: val}, body: []}
|
||||||
|
|
|
@ -207,13 +207,13 @@ defmodule Farmbot.Configurator.Router do
|
||||||
GenServer.cast(Farmbot.Serial.Handler, {:update_fw, file, self()})
|
GenServer.cast(Farmbot.Serial.Handler, {:update_fw, file, self()})
|
||||||
errrm.(conn)
|
errrm.(conn)
|
||||||
else
|
else
|
||||||
Logger.debug "doing some magic..."
|
Logger.info "doing some magic..."
|
||||||
herp = Nerves.UART.enumerate()
|
herp = Nerves.UART.enumerate()
|
||||||
|> Map.drop(["ttyS0","ttyAMA0"])
|
|> Map.drop(["ttyS0","ttyAMA0"])
|
||||||
|> Map.keys
|
|> Map.keys
|
||||||
case herp do
|
case herp do
|
||||||
[tty] ->
|
[tty] ->
|
||||||
Logger.debug "magic complete!"
|
Logger.info "magic complete!"
|
||||||
Farmbot.Serial.Handler.flash_firmware(tty, file, self())
|
Farmbot.Serial.Handler.flash_firmware(tty, file, self())
|
||||||
errrm.(conn)
|
errrm.(conn)
|
||||||
_ ->
|
_ ->
|
||||||
|
|
|
@ -60,7 +60,7 @@ defmodule Syncable do
|
||||||
|
|
||||||
@doc false
|
@doc false
|
||||||
def terminate(_reason, _state) do
|
def terminate(_reason, _state) do
|
||||||
Logger.debug "#{unquote(module)} differ died"
|
Logger.info "#{unquote(module)} differ died"
|
||||||
end
|
end
|
||||||
|
|
||||||
# HANDLE_CALL
|
# HANDLE_CALL
|
||||||
|
|
|
@ -37,7 +37,7 @@ defmodule RegimenRunner do
|
||||||
first_dt = Timex.shift(epoch, milliseconds: first_item.time_offset)
|
first_dt = Timex.shift(epoch, milliseconds: first_item.time_offset)
|
||||||
timestr = "#{first_dt.month}/#{first_dt.day}/#{first_dt.year} " <>
|
timestr = "#{first_dt.month}/#{first_dt.day}/#{first_dt.year} " <>
|
||||||
"at: #{first_dt.hour}:#{first_dt.minute}"
|
"at: #{first_dt.hour}:#{first_dt.minute}"
|
||||||
Logger.debug "your fist item will execute on #{timestr}"
|
Logger.info "your fist item will execute on #{timestr}"
|
||||||
millisecond_offset = Timex.diff(first_dt, Timex.now(), :milliseconds)
|
millisecond_offset = Timex.diff(first_dt, Timex.now(), :milliseconds)
|
||||||
Process.send_after(self(), :execute, millisecond_offset)
|
Process.send_after(self(), :execute, millisecond_offset)
|
||||||
{:ok, %{epoch: epoch, regimen: %{regimen | regimen_items: items}, next_execution: first_dt}}
|
{:ok, %{epoch: epoch, regimen: %{regimen | regimen_items: items}, next_execution: first_dt}}
|
||||||
|
@ -58,19 +58,19 @@ defmodule RegimenRunner do
|
||||||
if next_item do
|
if next_item do
|
||||||
next_dt = Timex.shift(state.epoch, milliseconds: next_item.time_offset)
|
next_dt = Timex.shift(state.epoch, milliseconds: next_item.time_offset)
|
||||||
timestr = "#{next_dt.month}/#{next_dt.day}/#{next_dt.year} at: #{next_dt.hour}:#{next_dt.minute}"
|
timestr = "#{next_dt.month}/#{next_dt.day}/#{next_dt.year} at: #{next_dt.hour}:#{next_dt.minute}"
|
||||||
Logger.debug "your next item will execute on #{timestr}"
|
Logger.info "your next item will execute on #{timestr}"
|
||||||
millisecond_offset = Timex.diff(next_dt, Timex.now(), :milliseconds)
|
millisecond_offset = Timex.diff(next_dt, Timex.now(), :milliseconds)
|
||||||
Process.send_after(self(), :execute, millisecond_offset)
|
Process.send_after(self(), :execute, millisecond_offset)
|
||||||
{:ok, %{state | regimen: regimen, next_execution: next_dt}}
|
{:ok, %{state | regimen: regimen, next_execution: next_dt}}
|
||||||
else
|
else
|
||||||
Logger.debug ">> #{regimen.name} is complete!"
|
Logger.info ">> #{regimen.name} is complete!"
|
||||||
spawn fn() ->
|
spawn fn() ->
|
||||||
Elixir.Regimen.Supervisor.remove_child(regimen)
|
Elixir.Regimen.Supervisor.remove_child(regimen)
|
||||||
end
|
end
|
||||||
{:noreply, :finished}
|
{:noreply, :finished}
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
Logger.debug ">> #{regimen.name} is complete!"
|
Logger.info ">> #{regimen.name} is complete!"
|
||||||
spawn fn() ->
|
spawn fn() ->
|
||||||
Elixir.Regimen.Supervisor.remove_child(regimen)
|
Elixir.Regimen.Supervisor.remove_child(regimen)
|
||||||
end
|
end
|
||||||
|
|
|
@ -60,12 +60,12 @@ defmodule Sequence.Supervisor do
|
||||||
case state.running do
|
case state.running do
|
||||||
{_pid, _sequence} ->
|
{_pid, _sequence} ->
|
||||||
# queue up a sequence
|
# queue up a sequence
|
||||||
Logger.debug ">> is queing up a sequence"
|
Logger.info ">> is queing up a sequence"
|
||||||
q = :queue.in(sequence, state.q)
|
q = :queue.in(sequence, state.q)
|
||||||
{:reply, {:ok, :queued}, %{state | q: q}}
|
{:reply, {:ok, :queued}, %{state | q: q}}
|
||||||
_ ->
|
_ ->
|
||||||
# start it now
|
# start it now
|
||||||
Logger.debug ">> is starting a sequence"
|
Logger.info ">> is starting a sequence"
|
||||||
{:ok, pid} = SequenceRunner.start_link(sequence)
|
{:ok, pid} = SequenceRunner.start_link(sequence)
|
||||||
{:reply, {:ok, pid}, %{state | running: {pid, sequence}}}
|
{:reply, {:ok, pid}, %{state | running: {pid, sequence}}}
|
||||||
end
|
end
|
||||||
|
@ -109,7 +109,7 @@ defmodule Sequence.Supervisor do
|
||||||
Logger.info ">> no more sequences to run right now."
|
Logger.info ">> no more sequences to run right now."
|
||||||
{:noreply, %{state | q: q, running: nil}}
|
{:noreply, %{state | q: q, running: nil}}
|
||||||
{{:value, sequence}, q} ->
|
{{:value, sequence}, q} ->
|
||||||
Logger.debug ">> is starting a sequence"
|
Logger.info ">> is starting a sequence"
|
||||||
{:ok, pid} = SequenceRunner.start_link(sequence)
|
{:ok, pid} = SequenceRunner.start_link(sequence)
|
||||||
{:noreply, %{state | q: q, running: {pid, sequence}}}
|
{:noreply, %{state | q: q, running: {pid, sequence}}}
|
||||||
end
|
end
|
||||||
|
|
|
@ -114,14 +114,14 @@ defmodule Farmbot.Serial.Handler do
|
||||||
@spec init({nerves, binary}) :: {:ok, state} | :ignore
|
@spec init({nerves, binary}) :: {:ok, state} | :ignore
|
||||||
def init({nerves, tty}) do
|
def init({nerves, tty}) do
|
||||||
Process.link(nerves)
|
Process.link(nerves)
|
||||||
Logger.debug "Starting serial handler: #{tty}"
|
Logger.info "Starting serial handler: #{tty}"
|
||||||
|
|
||||||
:ok = open_tty(nerves, tty)
|
:ok = open_tty(nerves, tty)
|
||||||
update_default(self())
|
update_default(self())
|
||||||
|
|
||||||
# generate a handshake
|
# generate a handshake
|
||||||
handshake = generate_handshake()
|
handshake = generate_handshake()
|
||||||
Logger.debug "doing handshaking: #{handshake}"
|
Logger.info "doing handshaking: #{handshake}"
|
||||||
|
|
||||||
if do_handshake(nerves, tty, handshake) do
|
if do_handshake(nerves, tty, handshake) do
|
||||||
UART.write(nerves, "F83 #{handshake}") # ???
|
UART.write(nerves, "F83 #{handshake}") # ???
|
||||||
|
@ -151,7 +151,7 @@ defmodule Farmbot.Serial.Handler do
|
||||||
defp do_handshake(nerves, tty, handshake, retries \\ 5)
|
defp do_handshake(nerves, tty, handshake, retries \\ 5)
|
||||||
|
|
||||||
defp do_handshake(_, _, _, 0) do
|
defp do_handshake(_, _, _, 0) do
|
||||||
Logger.debug "Could not handshake: to many retries."
|
Logger.info "Could not handshake: to many retries."
|
||||||
false
|
false
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -177,7 +177,7 @@ defmodule Farmbot.Serial.Handler do
|
||||||
# if it contains our handshake, check if its the right command.
|
# if it contains our handshake, check if its the right command.
|
||||||
# flush the buffer and return
|
# flush the buffer and return
|
||||||
if String.contains?(str, handshake) do
|
if String.contains?(str, handshake) do
|
||||||
Logger.debug "Successfully completed handshake!"
|
Logger.info "Successfully completed handshake!"
|
||||||
"R83 " <> version = String.trim(str, " " <> handshake)
|
"R83 " <> version = String.trim(str, " " <> handshake)
|
||||||
Farmbot.BotState.set_fw_version(version)
|
Farmbot.BotState.set_fw_version(version)
|
||||||
UART.flush(nerves)
|
UART.flush(nerves)
|
||||||
|
@ -213,7 +213,7 @@ defmodule Farmbot.Serial.Handler do
|
||||||
|
|
||||||
# if one existst, unregister it.
|
# if one existst, unregister it.
|
||||||
if old_pid do
|
if old_pid do
|
||||||
Logger.debug "Deregistering #{inspect old_pid} from default Serial Handler"
|
Logger.info "Deregistering #{inspect old_pid} from default Serial Handler"
|
||||||
Process.unregister(__MODULE__)
|
Process.unregister(__MODULE__)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -415,7 +415,7 @@ defmodule Farmbot.Serial.Handler do
|
||||||
end
|
end
|
||||||
|
|
||||||
defp log({_, 0}, pid) do
|
defp log({_, 0}, pid) do
|
||||||
Logger.debug "FLASHED FIRMWARE!"
|
Logger.info "FLASHED FIRMWARE!"
|
||||||
send pid, :done
|
send pid, :done
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -16,6 +16,17 @@ defmodule Farmbot.System.Updates do
|
||||||
@spec mod(atom) :: atom
|
@spec mod(atom) :: atom
|
||||||
defp mod(target), do: Module.concat([Farmbot, System, target, Updates])
|
defp mod(target), do: Module.concat([Farmbot, System, target, Updates])
|
||||||
|
|
||||||
|
@doc """
|
||||||
|
Checks for updates if the bot says so
|
||||||
|
"""
|
||||||
|
def do_update_check do
|
||||||
|
if Farmbot.BotState.get_config(:os_auto_update) do
|
||||||
|
check_and_download_updates()
|
||||||
|
else
|
||||||
|
Logger.warn ">> Will not do update check!"
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
@doc """
|
@doc """
|
||||||
Checks for updates, and if there is an update, downloads, and applies it.
|
Checks for updates, and if there is an update, downloads, and applies it.
|
||||||
"""
|
"""
|
||||||
|
|
|
@ -17,7 +17,7 @@ defmodule Farmbot.LoggerTest do
|
||||||
Logger.flush
|
Logger.flush
|
||||||
use_cassette "good_log_upload" do
|
use_cassette "good_log_upload" do
|
||||||
for i <- 0..51 do
|
for i <- 0..51 do
|
||||||
Logger.debug "Farmbot can count to: #{i}"
|
Logger.info "Farmbot can count to: #{i}"
|
||||||
end
|
end
|
||||||
Process.sleep(3000)
|
Process.sleep(3000)
|
||||||
|
|
||||||
|
@ -30,7 +30,7 @@ defmodule Farmbot.LoggerTest do
|
||||||
test "gets the logger state" do
|
test "gets the logger state" do
|
||||||
Logger.flush
|
Logger.flush
|
||||||
|
|
||||||
Logger.debug "hey world"
|
Logger.info "hey world"
|
||||||
state = GenEvent.call(Logger, Farmbot.Logger, :get_state)
|
state = GenEvent.call(Logger, Farmbot.Logger, :get_state)
|
||||||
assert is_list(state.logs)
|
assert is_list(state.logs)
|
||||||
[log] = state.logs
|
[log] = state.logs
|
||||||
|
|
Loading…
Reference in New Issue