farmbot-serial 0.3.5 → 0.4.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 9814e7945963d41edb78b97969bac32d1f551ba2
4
- data.tar.gz: 267607eb384a3c676d7fb0d079f4d739ed2119d2
3
+ metadata.gz: f4349eb566899227dc4a17f353070503c670f5ab
4
+ data.tar.gz: d71e9c5485c8161971cd631dc8f07f8d5f907546
5
5
  SHA512:
6
- metadata.gz: 40c1834a9727e23b93da62767de109bb95b05274fbcc73489cf5772b5f3bc97e811d68183b727df1722b2d00544e4c6c34fea245aa1c0e779e0714dbc9539f2f
7
- data.tar.gz: f7d001d3d43026d26ce181feb2e50ccf2ba1c1efaa8e3fdb2e843110bb3c53a701e34e210cb7605bf92ce23481778e5b3a9f896d7a1e505b8eb6929825695f93
6
+ metadata.gz: 467e87b8a6d8184054fc160545763e66359821127f26f8cbdd3332c1801f0c86dcccb61908a9640a46ea4c54cb4edf591acc60385e61d795160b3c530b5f7a27
7
+ data.tar.gz: 34ba8fca6d587b689058311303803503d6d1bac118fabe5b354d295e125fef3fff5966d2811e2a352716571262fce9ab9592d124a14d6775601228edcabc2e49
@@ -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
@@ -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 { bot.maybe_execute_command }
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)
@@ -31,7 +31,7 @@ end
31
31
  # observe / make assertions on side effects.
32
32
  def within_event_loop(ticks_remaining = 1)
33
33
  EM.run do
34
- EventMachine::PeriodicTimer.new(0.1) { EM.stop }
35
34
  yield
35
+ EventMachine::PeriodicTimer.new(0.25) { EM.stop }
36
36
  end
37
37
  end
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.3.5
4
+ version: 0.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tim Evers