farmbot-serial 0.3.5 → 0.4.0
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/lib/arduino.rb +6 -3
- data/spec/lib/arduino_spec.rb +4 -2
- data/spec/spec_helper.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f4349eb566899227dc4a17f353070503c670f5ab
|
4
|
+
data.tar.gz: d71e9c5485c8161971cd631dc8f07f8d5f907546
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 467e87b8a6d8184054fc160545763e66359821127f26f8cbdd3332c1801f0c86dcccb61908a9640a46ea4c54cb4edf591acc60385e61d795160b3c530b5f7a27
|
7
|
+
data.tar.gz: 34ba8fca6d587b689058311303803503d6d1bac118fabe5b354d295e125fef3fff5966d2811e2a352716571262fce9ab9592d124a14d6775601228edcabc2e49
|
data/lib/arduino.rb
CHANGED
@@ -24,8 +24,6 @@ module FB
|
|
24
24
|
@commands = FB::OutgoingHandler.new(self)
|
25
25
|
@inputs = FB::IncomingHandler.new(self)
|
26
26
|
@status = FB::Status.new
|
27
|
-
|
28
|
-
start_event_listeners
|
29
27
|
end
|
30
28
|
|
31
29
|
# Log to screen/file/IO stream
|
@@ -79,7 +77,6 @@ module FB
|
|
79
77
|
end
|
80
78
|
|
81
79
|
def start_event_listeners
|
82
|
-
EM.tick_loop { maybe_execute_command } # A noble experiment.
|
83
80
|
status.onchange { |diff| @onchange.call(diff) if @onchange }
|
84
81
|
inbound_queue.subscribe do |gcodes|
|
85
82
|
Array(gcodes).each do |gcode|
|
@@ -89,6 +86,12 @@ module FB
|
|
89
86
|
end
|
90
87
|
end
|
91
88
|
|
89
|
+
def start
|
90
|
+
# A noble experiment.
|
91
|
+
EventMachine::PeriodicTimer.new(0.1) { maybe_execute_command }
|
92
|
+
start_event_listeners
|
93
|
+
end
|
94
|
+
|
92
95
|
private
|
93
96
|
|
94
97
|
# Highest priority method for processing incoming Gcode. Use for system
|
data/spec/lib/arduino_spec.rb
CHANGED
@@ -67,7 +67,9 @@ describe FB::Arduino do
|
|
67
67
|
bot.outbound_queue.push(command)
|
68
68
|
expect(bot.outbound_queue.length).to eq(1)
|
69
69
|
bot.status[:BUSY] = 0
|
70
|
-
within_event_loop {
|
70
|
+
within_event_loop {
|
71
|
+
bot.start
|
72
|
+
bot.maybe_execute_command }
|
71
73
|
expect(bot.outbound_queue.length).to eq(0)
|
72
74
|
expect(serial_port.message).to eq('A1 B2 C3')
|
73
75
|
expect(bot.status.ready?).to be_falsey
|
@@ -88,7 +90,7 @@ describe FB::Arduino do
|
|
88
90
|
called_onchange += 1
|
89
91
|
end
|
90
92
|
|
91
|
-
within_event_loop { bot }
|
93
|
+
within_event_loop { bot.start }
|
92
94
|
|
93
95
|
expect(called_onmessage).to eq(1)
|
94
96
|
expect(called_onchange).to eq(1)
|
data/spec/spec_helper.rb
CHANGED