diff --git a/apps/farmbot/lib/bot_state/trackers/configuration_tracker.ex b/apps/farmbot/lib/bot_state/trackers/configuration_tracker.ex index 88a2eeee..fe5ffea3 100644 --- a/apps/farmbot/lib/bot_state/trackers/configuration_tracker.ex +++ b/apps/farmbot/lib/bot_state/trackers/configuration_tracker.ex @@ -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} diff --git a/apps/farmbot/lib/mix/tasks/upload.ex b/apps/farmbot/lib/mix/tasks/upload.ex index 44e34209..9b185aea 100644 --- a/apps/farmbot/lib/mix/tasks/upload.ex +++ b/apps/farmbot/lib/mix/tasks/upload.ex @@ -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 diff --git a/apps/farmbot/lib/system/redis/redis_client.ex b/apps/farmbot/lib/system/redis/redis_client.ex index 016f53a3..d8bb1674 100644 --- a/apps/farmbot/lib/system/redis/redis_client.ex +++ b/apps/farmbot/lib/system/redis/redis_client.ex @@ -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 diff --git a/apps/farmbot/lib/system/targets/host/system.exs b/apps/farmbot/lib/system/targets/host/system.exs index c20a962e..03214ee4 100644 --- a/apps/farmbot/lib/system/targets/host/system.exs +++ b/apps/farmbot/lib/system/targets/host/system.exs @@ -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 diff --git a/apps/farmbot/priv/configs/default_config.json b/apps/farmbot/priv/configs/default_config.json index 29c7bbaf..b11c49a1 100644 --- a/apps/farmbot/priv/configs/default_config.json +++ b/apps/farmbot/priv/configs/default_config.json @@ -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, diff --git a/apps/farmbot/priv/configs/default_config_rpi.json b/apps/farmbot/priv/configs/default_config_rpi.json index 3814f61b..4d614340 100644 --- a/apps/farmbot/priv/configs/default_config_rpi.json +++ b/apps/farmbot/priv/configs/default_config_rpi.json @@ -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, diff --git a/apps/farmbot/priv/configs/default_config_rpi2.json b/apps/farmbot/priv/configs/default_config_rpi2.json index 3814f61b..4d614340 100644 --- a/apps/farmbot/priv/configs/default_config_rpi2.json +++ b/apps/farmbot/priv/configs/default_config_rpi2.json @@ -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, diff --git a/apps/farmbot/priv/configs/default_config_rpi3.json b/apps/farmbot/priv/configs/default_config_rpi3.json index 21678abb..58f714b3 100644 --- a/apps/farmbot/priv/configs/default_config_rpi3.json +++ b/apps/farmbot/priv/configs/default_config_rpi3.json @@ -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, diff --git a/apps/farmbot/priv/migrations/1488384131746986079-remove_timezone_migration.exs b/apps/farmbot/priv/migrations/1488384131746986079-remove_timezone_migration.exs new file mode 100644 index 00000000..2bcce74c --- /dev/null +++ b/apps/farmbot/priv/migrations/1488384131746986079-remove_timezone_migration.exs @@ -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 diff --git a/apps/farmbot/test/bot_state/bot_state_test.exs b/apps/farmbot/test/bot_state/bot_state_test.exs index e1ba5a48..f820ebb6 100644 --- a/apps/farmbot/test/bot_state/bot_state_test.exs +++ b/apps/farmbot/test/bot_state/bot_state_test.exs @@ -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)