🎉 It updates points. TODO: `meta` attributes.

mark_as
Rick Carlino 2020-04-30 14:37:56 -05:00
parent 539f19c360
commit 8b48613783
3 changed files with 8 additions and 5 deletions

View File

@ -14,8 +14,8 @@ defmodule FarmbotCeleryScript.Compiler.UpdateResource do
def do_update(%AST{kind: :identifier} = res, update, env) do
{name, environ, nil} = Compiler.compile_ast(res, env)
value = Keyword.fetch!(environ, name)
IO.inspect(%{res: res, update: update, value: value}, label: "QQQ")
raise "Update sequence compiler. `value` missing resource kind / ID"
%{resource_id: id, resource_type: kind} = value
FarmbotCeleryScript.SysCalls.update_resource(kind, id, update)
end
def do_update(%AST{kind: :resource} = res, update, _) do

View File

@ -11,15 +11,18 @@ defmodule FarmbotOS.SysCalls.PointLookup do
nil ->
{:error, "#{kind || "point?"} #{id} not found"}
%{name: name, x: x, y: y, z: z} ->
%{name: name, x: x, y: y, z: z, pointer_type: type} ->
%{
name: name,
resource_type: "Point",
resource_type: type,
resource_id: id,
x: x,
y: y,
z: z
}
other ->
Logger.debug("Point error: Please notify support #{inspect(other)}")
end
end

View File

@ -10,7 +10,7 @@ defmodule FarmbotOS.SysCalls.ResourceUpdate do
alias FarmbotOS.SysCalls.SendMessage
@point_kinds ~w(Plant GenericPointer)
@point_kinds ~w(Plant GenericPointer ToolSlot Weed)
def update_resource("Device", 0, params) do
params