Compare commits
4 Commits
staging
...
qa/homing_
Author | SHA1 | Date |
---|---|---|
gabrielburnworth | 2a201bcfd5 | |
gabrielburnworth | c33d984073 | |
gabrielburnworth | b4b994006b | |
gabrielburnworth | 84f3746248 |
|
@ -1,5 +1,9 @@
|
|||
# Changelog
|
||||
|
||||
# 10.0.1
|
||||
|
||||
* Genesis v1.5 and Express v1.0 firmware updates.
|
||||
|
||||
# 10.0.0
|
||||
|
||||
* Deprecate `resource_update` RPC
|
||||
|
|
|
@ -11,7 +11,7 @@ defmodule FarmbotCore.FirmwareSideEffects do
|
|||
end
|
||||
|
||||
@impl FarmbotFirmware.SideEffects
|
||||
def handle_load(x: x, y: y, z: z) do
|
||||
def handle_load([u, x, v, y, w, z]) do
|
||||
:ok = BotState.set_load(x, y, z)
|
||||
end
|
||||
|
||||
|
|
|
@ -57,7 +57,7 @@ defmodule FarmbotFirmware.GCODE.Decoder do
|
|||
|
||||
def do_decode("R87", []), do: {:report_emergency_lock, []}
|
||||
def do_decode("R88", []), do: {:report_no_config, []}
|
||||
def do_decode("R89", xyz), do: {:report_load, decode_floats(xyz)}
|
||||
def do_decode("R89", uxvywz), do: {:report_load, decode_uxvywz(uxvywz)}
|
||||
|
||||
def do_decode("R99", debug),
|
||||
do: {:report_debug_message, [Enum.join(debug, " ")]}
|
||||
|
@ -200,6 +200,23 @@ defmodule FarmbotFirmware.GCODE.Decoder do
|
|||
[{param, value}]
|
||||
end
|
||||
|
||||
def decode_uxvywz([
|
||||
"U" <> u_value,
|
||||
"X" <> x_value,
|
||||
"V" <> v_value,
|
||||
"Y" <> y_value,
|
||||
"W" <> w_value,
|
||||
"Z" <> z_value
|
||||
]) do
|
||||
{u, ""} = Integer.parse(u_value)
|
||||
{x, ""} = Integer.parse(x_value)
|
||||
{v, ""} = Integer.parse(v_value)
|
||||
{y, ""} = Integer.parse(y_value)
|
||||
{w, ""} = Integer.parse(w_value)
|
||||
{z, ""} = Integer.parse(z_value)
|
||||
[u, x, v, y, w, z]
|
||||
end
|
||||
|
||||
def decode_ints(pvm, acc \\ [])
|
||||
|
||||
def decode_ints([<<arg::binary-1, val::binary>> | rest], acc) do
|
||||
|
|
|
@ -59,7 +59,7 @@ defmodule FarmbotFirmware.GCODE.Encoder do
|
|||
|
||||
def do_encode(:report_emergency_lock, []), do: "R87"
|
||||
def do_encode(:report_no_config, []), do: "R88"
|
||||
def do_encode(:report_load, xyz), do: "R89 " <> encode_floats(xyz)
|
||||
def do_encode(:report_load, uxvywz), do: "R89 " <> encode_uxvywz(uxvywz)
|
||||
def do_encode(:report_debug_message, [message]), do: "R99 " <> message
|
||||
|
||||
def do_encode(:command_movement, xyzs), do: "G00 " <> encode_floats(xyzs)
|
||||
|
@ -156,6 +156,16 @@ defmodule FarmbotFirmware.GCODE.Encoder do
|
|||
"P#{param_id} V#{binary_float}"
|
||||
end
|
||||
|
||||
def encode_uxvywz([u_value, x_value, v_value, y_value, w_value, z_value]) do
|
||||
u_int = to_string(u_value)
|
||||
x_int = to_string(x_value)
|
||||
v_int = to_string(v_value)
|
||||
y_int = to_string(y_value)
|
||||
w_int = to_string(w_value)
|
||||
z_int = to_string(z_value)
|
||||
"U#{u_int} X#{x_int} V#{v_int} Y#{y_int} W#{w_int} Z#{z_int}"
|
||||
end
|
||||
|
||||
defp encode_error(error) do
|
||||
case error do
|
||||
:no_error -> "V0"
|
||||
|
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
@ -12,11 +12,15 @@ defmodule FarmbotFirmware.GCODE.DecoderTest do
|
|||
assert [param_config_ok: 3.0] == Decoder.decode_pv(["P2", "V3"])
|
||||
end
|
||||
|
||||
test "Decoder.decode_uxvywz" do
|
||||
assert [1, 2, 3, 4, 5, 6] ==
|
||||
Decoder.decode_uxvywz(["U1", "X2", "V3", "Y4", "W5", "Z6"])
|
||||
end
|
||||
|
||||
# NOTE: Theese values are totally random and may
|
||||
# not represent real-world use of the GCode.
|
||||
test "Decoder.decode_floats" do
|
||||
assert {:command_movement, []} == Decoder.do_decode("G00", ["XA0.0"])
|
||||
assert {:report_load, [x: 0.0]} == Decoder.do_decode("R89", ["X0.0"])
|
||||
assert {:report_encoders_raw, [x: 0.0]} == Decoder.do_decode("R85", ["X0"])
|
||||
assert {:report_encoders_scaled, []} == Decoder.do_decode("R84", ["XA-0.0"])
|
||||
assert {:report_position, []} == Decoder.do_decode("R82", ["XA-0"])
|
||||
|
@ -29,7 +33,6 @@ defmodule FarmbotFirmware.GCODE.DecoderTest do
|
|||
|
||||
assert {:report_position_change, []} == Decoder.do_decode("R16", ["YA1"])
|
||||
assert {:command_movement, []} == Decoder.do_decode("G00", ["YB1"])
|
||||
assert {:report_load, []} == Decoder.do_decode("R89", ["ZA1"])
|
||||
assert {:report_position, []} == Decoder.do_decode("R82", ["ZB1"])
|
||||
end
|
||||
end
|
||||
|
|
|
@ -0,0 +1,11 @@
|
|||
defmodule FarmbotFirmware.GCODE.EncoderTest do
|
||||
use ExUnit.Case
|
||||
use Mimic
|
||||
setup :verify_on_exit!
|
||||
alias FarmbotFirmware.GCODE.Encoder
|
||||
|
||||
test "Encoder.encode_uxvywz" do
|
||||
assert "U1 X2 V3 Y4 W5 Z6" ==
|
||||
Encoder.encode_uxvywz([1, 2, 3, 4, 5, 6])
|
||||
end
|
||||
end
|
|
@ -448,9 +448,9 @@ defmodule FarmbotFirmware.GCODETest do
|
|||
assert "R85 X1.40 Y2.30 Z3.20" ==
|
||||
GCODE.encode({nil, {:report_encoders_raw, params}})
|
||||
|
||||
params = [x: 1.4, y: 2.3, z: 3.2]
|
||||
params = [1, 2, 3, 4, 5, 6]
|
||||
|
||||
assert "R89 X1.40 Y2.30 Z3.20" ==
|
||||
assert "R89 U1 X2 V3 Y4 W5 Z6" ==
|
||||
GCODE.encode({nil, {:report_load, params}})
|
||||
|
||||
assert "G00 X0.00" ==
|
||||
|
|
Loading…
Reference in New Issue