remove timezone requirement, and fix redis
parent
2944e4c80c
commit
3f85408114
|
@ -16,7 +16,6 @@ defmodule Farmbot.BotState.Configuration do
|
|||
user_env: %{},
|
||||
os_auto_update: false,
|
||||
fw_auto_update: false,
|
||||
timezone: nil,
|
||||
steps_per_mm_x: 10,
|
||||
steps_per_mm_y: 10,
|
||||
steps_per_mm_z: 50,
|
||||
|
@ -47,7 +46,6 @@ defmodule Farmbot.BotState.Configuration do
|
|||
user_env: map,
|
||||
os_auto_update: boolean,
|
||||
fw_auto_update: boolean,
|
||||
timezone: String.t,
|
||||
steps_per_mm_x: integer,
|
||||
steps_per_mm_y: integer,
|
||||
steps_per_mm_z: integer,
|
||||
|
@ -79,7 +77,6 @@ defmodule Farmbot.BotState.Configuration do
|
|||
with {:ok, user_env} <- get_config("user_env"),
|
||||
{:ok, os_a_u} <- get_config("os_auto_update"),
|
||||
{:ok, fw_a_u} <- get_config("fw_auto_update"),
|
||||
{:ok, timezone} <- get_config("timezone"),
|
||||
{:ok, spm_x} <- get_config("steps_per_mm_x"),
|
||||
{:ok, spm_y} <- get_config("steps_per_mm_y"),
|
||||
{:ok, spm_z} <- get_config("steps_per_mm_z"),
|
||||
|
@ -92,7 +89,6 @@ defmodule Farmbot.BotState.Configuration do
|
|||
user_env: user_env,
|
||||
os_auto_update: os_a_u,
|
||||
fw_auto_update: fw_a_u,
|
||||
timezone: timezone,
|
||||
steps_per_mm_x: spm_x,
|
||||
steps_per_mm_y: spm_y,
|
||||
steps_per_mm_z: spm_z,
|
||||
|
@ -132,14 +128,6 @@ defmodule Farmbot.BotState.Configuration do
|
|||
dispatch true, new_state
|
||||
end
|
||||
|
||||
def handle_call({:update_config, "timezone", value}, _from, %State{} = state)
|
||||
when is_binary(value) do
|
||||
new_config = Map.put(state.configuration, :timezone, value)
|
||||
new_state = %State{state | configuration: new_config}
|
||||
put_config("timezone", value)
|
||||
dispatch true, new_state
|
||||
end
|
||||
|
||||
def handle_call({:update_config, "steps_per_mm_x", val}, _, state) do
|
||||
config = state.configuration
|
||||
new_config = %{config | steps_per_mm_x: val}
|
||||
|
|
|
@ -14,6 +14,10 @@ defmodule Mix.Tasks.Farmbot.Upload do
|
|||
raise "Could not find Firmware!"
|
||||
end
|
||||
ip_address = List.first(args)
|
||||
Push.run([ip_address, "--firmware", "#{fw_file}", "--reboot", "true"])
|
||||
if Code.ensure_loaded?(Push) do
|
||||
Push.run([ip_address, "--firmware", "#{fw_file}", "--reboot", "true"])
|
||||
else
|
||||
Mix.raise("ERRRRR?")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -7,6 +7,7 @@ defmodule Redis.Client do
|
|||
# 15 minutes
|
||||
@save_time 900_000
|
||||
@port Application.get_env(:farmbot, :redis_port)
|
||||
@config Application.get_all_env(:farmbot)[:redis]
|
||||
|
||||
@doc """
|
||||
Start the redis server.
|
||||
|
@ -22,7 +23,7 @@ defmodule Redis.Client do
|
|||
:hide,
|
||||
:use_stdio,
|
||||
:stderr_to_stdout,
|
||||
args: ["-p", "#{@port}"]])
|
||||
args: ["-p", "#{@config[:port]}"]])
|
||||
Process.send_after(self(), :save, @save_time)
|
||||
{:ok, %{cli: port, queue: :queue.new(), blah: nil}}
|
||||
end
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
defmodule Module.concat([Farmbot,System,"host"]) do
|
||||
@moduledoc false
|
||||
@halt_on_exit Application.get_env(:farmbot, :halt_on_reset, true)
|
||||
@behaviour Farmbot.System
|
||||
def reboot, do: :ok
|
||||
def power_off, do: :ok
|
||||
|
|
|
@ -7,7 +7,6 @@
|
|||
"user_env": {},
|
||||
"os_auto_update": false,
|
||||
"fw_auto_update": false,
|
||||
"timezone": null,
|
||||
"first_party_farmware": false,
|
||||
"steps_per_mm_x": 5,
|
||||
"steps_per_mm_y": 5,
|
||||
|
|
|
@ -16,7 +16,6 @@
|
|||
"user_env": {},
|
||||
"os_auto_update": false,
|
||||
"fw_auto_update": false,
|
||||
"timezone": null,
|
||||
"first_party_farmware": false,
|
||||
"steps_per_mm_x": 5,
|
||||
"steps_per_mm_y": 5,
|
||||
|
|
|
@ -16,7 +16,6 @@
|
|||
"user_env": {},
|
||||
"os_auto_update": false,
|
||||
"fw_auto_update": false,
|
||||
"timezone": null,
|
||||
"first_party_farmware": false,
|
||||
"steps_per_mm_x": 5,
|
||||
"steps_per_mm_y": 5,
|
||||
|
|
|
@ -23,7 +23,6 @@
|
|||
"user_env": {},
|
||||
"os_auto_update": false,
|
||||
"fw_auto_update": false,
|
||||
"timezone": null,
|
||||
"first_party_farmware": false,
|
||||
"steps_per_mm_x": 5,
|
||||
"steps_per_mm_y": 5,
|
||||
|
|
|
@ -0,0 +1,11 @@
|
|||
defmodule RemoveTimeZone do
|
||||
def run(json) do
|
||||
configuration = json["configuration"]
|
||||
new_config = if configuration["timezone"] do
|
||||
Map.delete(configuration, "timezone")
|
||||
else
|
||||
configuration
|
||||
end
|
||||
%{json | "configuration" => new_config}
|
||||
end
|
||||
end
|
|
@ -53,10 +53,6 @@ defmodule Farmbot.BotStateTest do
|
|||
fw_auto_update = Farmbot.BotState.get_config(:fw_auto_update)
|
||||
assert(fw_auto_update == false)
|
||||
|
||||
true = Farmbot.BotState.update_config("timezone", "we dont even check this")
|
||||
timezone = Farmbot.BotState.get_config(:timezone)
|
||||
assert(timezone == "we dont even check this")
|
||||
|
||||
true = Farmbot.BotState.update_config("steps_per_mm_x", 123)
|
||||
true = Farmbot.BotState.update_config("steps_per_mm_y", 456)
|
||||
true = Farmbot.BotState.update_config("steps_per_mm_z", 789)
|
||||
|
|
Loading…
Reference in New Issue