Fix regimens hanging erlang nif

This commit is contained in:
connor rigby 2018-01-04 14:52:07 -08:00
parent 539e950edc
commit 00e8faeeb4
2 changed files with 3 additions and 3 deletions

View file

@ -52,8 +52,8 @@ config :farmbot, Farmbot.System.ConfigStorage,
config :farmbot, :behaviour,
authorization: Farmbot.Bootstrap.Authorization,
system_tasks: Farmbot.Host.SystemTasks,
update_handler: Farmbot.Host.UpdateHandler,
firmware_handler: Farmbot.Firmware.UartHandler
update_handler: Farmbot.Host.UpdateHandler
# firmware_handler: Farmbot.Firmware.UartHandler
config :farmbot, :uart_handler, tty: "/dev/ttyACM0"

View file

@ -66,6 +66,7 @@ defmodule Farmbot.Repo.FarmEvent do
@compile {:inline, [build_calendar: 1]}
def build_calendar(%__MODULE__{calendar: nil} = fe), do: fe
def build_calendar(%__MODULE__{time_unit: "never"} = fe), do: fe
def build_calendar(%__MODULE__{calendar: calendar} = fe) when is_list(calendar) do
current_time_seconds = :os.system_time(:second)
start_time_seconds = DateTime.from_iso8601(fe.start_time) |> elem(1) |> DateTime.to_unix(:second)
@ -96,7 +97,6 @@ defmodule Farmbot.Repo.FarmEvent do
end
@compile {:inline, [time_unit_to_seconds: 1]}
defp time_unit_to_seconds("never"), do: 0
defp time_unit_to_seconds("minutely"), do: 60
defp time_unit_to_seconds("hourly"), do: 60 * 60
defp time_unit_to_seconds("daily"), do: 60 * 60 * 24