farmbot-serial 0.3.4 → 0.3.5

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: 1862cbda19a675f4b191ee9f57ab331adead3a62
4
- data.tar.gz: dde99359f69f32e5fe59ecb7912734d02ca76f6a
3
+ metadata.gz: 9814e7945963d41edb78b97969bac32d1f551ba2
4
+ data.tar.gz: 267607eb384a3c676d7fb0d079f4d739ed2119d2
5
5
  SHA512:
6
- metadata.gz: 7ef93d09fb5dcbb0f12c8c72c7da1dfecfc851a51192daa5978773b448f4f70c9833f0777b502b18c8447649391a8b8e80e45c07d056dda5d3db57d1efb7a814
7
- data.tar.gz: f9572d86dc2cfa615f77a46ed028f07e1ac64ce6f46a4941b04ed9f73592516c03a8e7c657ed3d3949481f5f24ba0192d8397f6875b24c709a5190ad253a83bc
6
+ metadata.gz: 40c1834a9727e23b93da62767de109bb95b05274fbcc73489cf5772b5f3bc97e811d68183b727df1722b2d00544e4c6c34fea245aa1c0e779e0714dbc9539f2f
7
+ data.tar.gz: f7d001d3d43026d26ce181feb2e50ccf2ba1c1efaa8e3fdb2e843110bb3c53a701e34e210cb7605bf92ce23481778e5b3a9f896d7a1e505b8eb6929825695f93
data/lib/arduino.rb CHANGED
@@ -61,17 +61,14 @@ module FB
61
61
  Position.new(status[:X], status[:Y], status[:Z])
62
62
  end
63
63
 
64
- def maybe_execute_command
65
- pop_gcode_off_queue if status.ready?
66
- end
67
-
68
64
  def next_cmd
69
65
  outbound_queue.first
70
66
  end
71
67
 
72
- def pop_gcode_off_queue
68
+ def maybe_execute_command
73
69
  gcode = @outbound_queue.pop
74
- if gcode.is_a?(FB::Gcode)
70
+ return unless gcode
71
+ if status.ready? && gcode.is_a?(FB::Gcode) # Flip flop order for performance?
75
72
  serial_port.puts gcode
76
73
  status[:last] = gcode.name
77
74
  status[:BUSY] = 1 # If not, pi will race arduino and "talk too fast"
@@ -66,7 +66,8 @@ describe FB::Arduino do
66
66
  it 'pops gcode off queue' do
67
67
  bot.outbound_queue.push(command)
68
68
  expect(bot.outbound_queue.length).to eq(1)
69
- within_event_loop { bot.pop_gcode_off_queue }
69
+ bot.status[:BUSY] = 0
70
+ within_event_loop { bot.maybe_execute_command }
70
71
  expect(bot.outbound_queue.length).to eq(0)
71
72
  expect(serial_port.message).to eq('A1 B2 C3')
72
73
  expect(bot.status.ready?).to be_falsey
@@ -95,7 +96,7 @@ describe FB::Arduino do
95
96
 
96
97
  it 'Flips out if a message is not a GCode object.' do
97
98
  bot.outbound_queue.push "I don't think so!"
98
- bot.pop_gcode_off_queue
99
+ bot.maybe_execute_command
99
100
  expect(logger.message).to eq("Outbound messages must be GCode objects. "\
100
101
  "Use of String:\"I don't think so!\" is not permitted.")
101
102
  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.4
4
+ version: 0.3.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tim Evers