From 12ee219ba69aaa1c1b9a2cc2a7822a3212fccb77 Mon Sep 17 00:00:00 2001 From: Rick Carlino Date: Sat, 16 May 2020 19:02:10 -0500 Subject: [PATCH] 10.0.0-rc33: Add debug points --- VERSION | 2 +- .../compilers/update_resource_compiler.ex | 5 +++++ farmbot_ext/lib/farmbot_ext/api/dirty_worker.ex | 2 +- .../lib/farmbot_os/sys_calls/resource_update.ex | 15 +++++++++++++++ 4 files changed, 22 insertions(+), 2 deletions(-) diff --git a/VERSION b/VERSION index 6b046e3a..e254286a 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -10.0.0-rc32 +10.0.0-rc33 diff --git a/farmbot_celery_script/lib/farmbot_celery_script/compilers/update_resource_compiler.ex b/farmbot_celery_script/lib/farmbot_celery_script/compilers/update_resource_compiler.ex index 0ecb4ce7..ee0c7b3d 100644 --- a/farmbot_celery_script/lib/farmbot_celery_script/compilers/update_resource_compiler.ex +++ b/farmbot_celery_script/lib/farmbot_celery_script/compilers/update_resource_compiler.ex @@ -6,6 +6,11 @@ defmodule FarmbotCeleryScript.Compiler.UpdateResource do me = unquote(__MODULE__) variable = unquote(Map.fetch!(args, :resource)) update = unquote(unpair(body, %{})) + + if update["y"] do + IO.puts(" In update_resource_compiler y is #{inspect(update["y"])}") + end + # Go easy on the API... case variable do %AST{kind: :identifier} -> diff --git a/farmbot_ext/lib/farmbot_ext/api/dirty_worker.ex b/farmbot_ext/lib/farmbot_ext/api/dirty_worker.ex index 49445eff..19e0f733 100644 --- a/farmbot_ext/lib/farmbot_ext/api/dirty_worker.ex +++ b/farmbot_ext/lib/farmbot_ext/api/dirty_worker.ex @@ -8,7 +8,7 @@ defmodule FarmbotExt.API.DirtyWorker do require Logger require FarmbotCore.Logger use GenServer - @timeout 100 + @timeout 1 # these resources can't be accessed by `id`. @singular [ diff --git a/farmbot_os/lib/farmbot_os/sys_calls/resource_update.ex b/farmbot_os/lib/farmbot_os/sys_calls/resource_update.ex index c0ffa9f9..bcfd6e93 100644 --- a/farmbot_os/lib/farmbot_os/sys_calls/resource_update.ex +++ b/farmbot_os/lib/farmbot_os/sys_calls/resource_update.ex @@ -69,6 +69,21 @@ defmodule FarmbotOS.SysCalls.ResourceUpdate do def point_update_resource(type, id, params) do with %{} = point <- Asset.get_point(id: id), {:ok, point} <- Asset.update_point(point, params) do + real_y = point.y + + if params["y"] do + {desired_y, _} = Float.parse(params["y"]) + + if real_y != desired_y do + FarmbotCore.Logger.error(3, "Y does not match up #{__MODULE__}") + raise "Y WAS NOT Correct #{inspect({real_y, desired_y})} @@@@" + else + IO.puts( + " point.y = \"#{real_y}\"" + ) + end + end + _ = Private.mark_dirty!(point) :ok else