farmbot-serial 0.0.8 → 0.0.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/example.rb +2 -1
- data/lib/arduino.rb +1 -1
- data/lib/arduino/incoming_handler.rb +15 -10
- data/lib/arduino/outgoing_handler.rb +8 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a2c907d7ba555f07c9f184e46ad7c4c1ba37a8b4
|
4
|
+
data.tar.gz: bf0a8d8e136cf24a30fc5ce12f562fd0104b500d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a119eebffdefd06529159ae97308e8084d62515482fbc4ccbf9ffdc611f7ff385befd77ac57301c371e213b62858cc5ed7e112b0d831cb5462a4c6d7bb0121f0
|
7
|
+
data.tar.gz: 7ee15a9a02692998383c41b6d93d136eca611e1f6c159ae563f53213e7d87c48984cbd78e4f7e0261706827c93956415430385386ad359e772058c1f7f39530b
|
data/example.rb
CHANGED
@@ -15,7 +15,8 @@ $commands = {
|
|
15
15
|
"t" => "bot.commands.home_z",
|
16
16
|
"y" => "bot.commands.home_all",
|
17
17
|
"u" => "bot.commands.read_parameter(8)",
|
18
|
-
"i" => "bot.commands.write_parameter",
|
18
|
+
"i" => "bot.commands.write_parameter('x', 0)",
|
19
|
+
"o" => "bot.commands.write_pin(pin: 8, value: 1, mode: 1)",
|
19
20
|
"p" => "bot.commands.read_status(8)",
|
20
21
|
}
|
21
22
|
|
data/lib/arduino.rb
CHANGED
@@ -9,7 +9,7 @@ module FB
|
|
9
9
|
class Arduino
|
10
10
|
class EmergencyStop < StandardError; end # Not yet used.
|
11
11
|
|
12
|
-
|
12
|
+
attr_accessor :serial_port, :logger, :commands, :inbound_queue, :status,
|
13
13
|
:inputs, :outbound_queue
|
14
14
|
|
15
15
|
# Initialize and provide a serial object, as well as an IO object to send
|
@@ -19,12 +19,9 @@ module FB
|
|
19
19
|
bot.log "Don't know how to parse incoming GCode: #{gcode}"
|
20
20
|
end
|
21
21
|
|
22
|
-
def
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
def idle(gcode)
|
27
|
-
bot.status[:busy] = 0
|
22
|
+
def report_parameter_value(gcode)
|
23
|
+
# This is not correct. We need to store pin values in an array somewhere.
|
24
|
+
bot.status.gcode_update(gcode)
|
28
25
|
end
|
29
26
|
|
30
27
|
def reporting_end_stops(gcode)
|
@@ -35,6 +32,18 @@ module FB
|
|
35
32
|
bot.status.gcode_update(gcode)
|
36
33
|
end
|
37
34
|
|
35
|
+
def report_status_value(gcode)
|
36
|
+
bot.status.gcode_update(gcode)
|
37
|
+
end
|
38
|
+
|
39
|
+
def received(gcode)
|
40
|
+
bot.status[:busy] = 1
|
41
|
+
end
|
42
|
+
|
43
|
+
def idle(gcode)
|
44
|
+
bot.status[:busy] = 0
|
45
|
+
end
|
46
|
+
|
38
47
|
def done(gcode)
|
39
48
|
bot.status[:busy] = 0
|
40
49
|
end
|
@@ -43,10 +52,6 @@ module FB
|
|
43
52
|
bot.status[:busy] = 1
|
44
53
|
end
|
45
54
|
|
46
|
-
def report_status_value(gcode)
|
47
|
-
bot.status.gcode_update(gcode)
|
48
|
-
end
|
49
|
-
|
50
55
|
def report_software_version(gcode)
|
51
56
|
nil # Don't need the info right now.
|
52
57
|
end
|
@@ -19,6 +19,10 @@ module FB
|
|
19
19
|
write "G00 X#{x} Y#{y} Z#{z}"
|
20
20
|
end
|
21
21
|
|
22
|
+
def move_absolute(x: 0, y: 0, z: 0, s: 100)
|
23
|
+
write "G00 X#{x} Y#{y} Z#{z}"
|
24
|
+
end
|
25
|
+
|
22
26
|
def home_x
|
23
27
|
write "F11"
|
24
28
|
end
|
@@ -47,6 +51,10 @@ module FB
|
|
47
51
|
write "F31 P#{pin}"
|
48
52
|
end
|
49
53
|
|
54
|
+
def pin_write(pin:, value:, mode:)
|
55
|
+
write "F41 P#{pin} V#{value} M#{mode}"
|
56
|
+
end
|
57
|
+
|
50
58
|
private
|
51
59
|
|
52
60
|
def write(str)
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: farmbot-serial
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.9
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tim Evers
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2015-04-
|
12
|
+
date: 2015-04-04 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: bundler
|