rotor 0.1.7 → 0.1.9

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: 514bde73c602619ea83893fca22097539fbb8e95
4
- data.tar.gz: b948b19e6d5faa4b1abcfadfaa0d4c7bc0d12aab
3
+ metadata.gz: 50f2b68c317d9cb0d9b000f8d082c1372c3cab25
4
+ data.tar.gz: ba40643e271f161807e12782e30c0ecd8b0edc63
5
5
  SHA512:
6
- metadata.gz: 766ce6e59e93fd306361d83d8fcbbf02ebf2d59235422feb6e34cc7dffbb3b2e3b5c6691d10957a6bbe7344ec83d2bf6f5fafb24bdf261631228fca156c14f0a
7
- data.tar.gz: 01203a2ce658cc37374ae69ce9e6fe7ea937ad7be6d8fe670befb4b865ce0c60828fbb2b1b4421989f5fb0b71d557f6471b6fe8e1bf78114dd272b0c62501413
6
+ metadata.gz: 18bf94a2ebec5eb2c47ad03756f8b59fe4e773b9b8009da8d6fc8733f167e441f37d6fac60c4bc110e9009b2114a2c8eefce5573d294dd56ff80c470cdfc65e4
7
+ data.tar.gz: 11d6bf222f6ee4d8ea3b989d347f900dbf8937c1078e8d495f75702e9dd8d6a1346be45e80469881f1ca69af371ce94c5873d1f9f75c4d6f7ee5bc07e3abe39e
data/CHANGELOG.md CHANGED
@@ -1,6 +1,16 @@
1
1
  Rotor (Ruby Motor)
2
2
  ==================
3
3
 
4
+ Version 0.1.9
5
+ -------------
6
+
7
+ Fixed bug on various movement delays.
8
+
9
+ Version 0.1.8
10
+ -------------
11
+
12
+ Fixed bug on various movement delays.
13
+
4
14
  Version 0.1.7
5
15
  -------------
6
16
 
data/lib/rotor/gcode.rb CHANGED
@@ -42,16 +42,21 @@ module Rotor
42
42
  y_start = @y
43
43
  y_end = parsed_line[:y]
44
44
 
45
- if parsed_line[:i] && parsed_line[:j] && parsed_line[:r].nil?
45
+ z_start = @z
46
+ z_end = parsed_line[:z]
47
+
48
+ if (parsed_line[:i] || parsed_line[:j] || parsed_line[:k]) && parsed_line[:r].nil?
46
49
  x_offset = parsed_line[:i]
47
50
  y_offset = parsed_line[:j]
51
+ z_offset = parsed_line[:k]
48
52
 
49
53
  x_origin = x_offset + x_start
50
54
  y_origin = y_offset + y_start
55
+ # z_origin = z_offset + z_start
51
56
 
52
57
  radius = Math.sqrt((x_start - x_origin) ** 2 + (y_start - y_origin) ** 2)
53
58
 
54
- elsif parsed_line[:i].nil? && parsed_line[:j].nil? && parsed_line[:r]
59
+ elsif parsed_line[:i].nil? && parsed_line[:j].nil? && parsed_line[:k].nil? && parsed_line[:r]
55
60
  ignore = true
56
61
  end
57
62
 
@@ -116,7 +121,6 @@ module Rotor
116
121
  @x_move ||= 0
117
122
  @x_move *= @scale
118
123
  @x_movement = (@x_move - @x).abs
119
- @x = @x_move
120
124
  end
121
125
 
122
126
  @y_move = nil
@@ -125,7 +129,6 @@ module Rotor
125
129
  @y_move ||= 0
126
130
  @y_move *= @scale
127
131
  @y_movement = (@y_move - @y).abs
128
- @y = @y_move
129
132
  end
130
133
 
131
134
  @z_move = nil
@@ -134,48 +137,46 @@ module Rotor
134
137
  @z_move ||= 0
135
138
  @z_move *= @scale
136
139
  @z_movement = (@z_move - @z).abs
137
- @z = @z_move
138
140
  end
139
141
 
140
- comp_delay_calc = [@x_movement,@y_movement,@z_movement].max
141
142
 
142
143
  if parsed_line[:x]
143
- x_delay = comp_delay_calc * delay / @x_movement
144
144
  if @x_move.to_f < @x #move to the right
145
145
  if @stepper_x # && @stepper_x.at_safe_area?
146
- threads << Thread.new { @stepper_x.forward(x_delay, @x_movement) }
146
+ threads << Thread.new { @stepper_x.forward(delay, @x_movement) }
147
147
  end
148
148
  elsif @x_move.to_f > @x #move to the left
149
149
  if @stepper_x # && @stepper_x.at_safe_area?
150
- threads << Thread.new { @stepper_x.backwards(x_delay, @x_movement) }
150
+ threads << Thread.new { @stepper_x.backwards(delay, @x_movement) }
151
151
  end
152
152
  end unless @x_movement == 0
153
+ @x = @x_move
153
154
  end
154
155
 
155
156
  if parsed_line[:y]
156
- y_delay = comp_delay_calc * delay / @y_movement
157
157
  if @y_move.to_f < @y #move to the right
158
158
  if @stepper_y # && @stepper_y.at_safe_area?
159
- threads << Thread.new { @stepper_y.forward(y_delay, @y_movement) }
159
+ threads << Thread.new { @stepper_y.forward(delay, @y_movement) }
160
160
  end
161
161
  elsif @y_move.to_f > @y #move to the left
162
162
  if @stepper_y # && @stepper_y.at_safe_area?
163
- threads << Thread.new { @stepper_y.backwards(y_delay, @y_movement) }
163
+ threads << Thread.new { @stepper_y.backwards(delay, @y_movement) }
164
164
  end
165
165
  end unless @y_movement == 0
166
+ @y = @y_move
166
167
  end
167
168
 
168
169
  if parsed_line[:z]
169
- z_delay = comp_delay_calc * delay / @z_movement
170
170
  if @z_move.to_f > @z #move to the right
171
171
  if @stepper_z # && @stepper_z.at_safe_area?
172
- threads << Thread.new { @stepper_z.forward(z_delay, @z_movement) }
172
+ threads << Thread.new { @stepper_z.forward(delay, @z_movement) }
173
173
  end
174
174
  elsif @z_move.to_f < @z #move to the left
175
175
  if @stepper_z # && @stepper_z.at_safe_area?
176
- threads << Thread.new { @stepper_z.backwards(z_delay, @z_movement) }
176
+ threads << Thread.new { @stepper_z.backwards(delay, @z_movement) }
177
177
  end
178
178
  end unless @z_movement == 0
179
+ @z = @z_move
179
180
  end
180
181
  puts "Moving to G#{parsed_line[:g]} #{@x_move}(#{@x_movement}), #{@y_move}(#{@y_movement}), #{@z_move}(#{@z_movement})"
181
182
  sleep (delay * 500) if @x_move == 0.0 && @y_move == 0.0 && @z_move > 0.0
data/lib/rotor/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Rotor
2
- VERSION = "0.1.7"
2
+ VERSION = "0.1.9"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rotor
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.7
4
+ version: 0.1.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - kobaltz
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-02-04 00:00:00.000000000 Z
11
+ date: 2015-02-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler