Browse Source

remove offset, add minimum scan area

Wurstnase 9 years ago
parent
commit
752c804677
1 changed files with 15 additions and 8 deletions
  1. 15
    8
      Marlin/scripts/g29_auto.py

+ 15
- 8
Marlin/scripts/g29_auto.py View File

14
 
14
 
15
 # maximum number of lines to parse, I don't want to parse the complete file
15
 # maximum number of lines to parse, I don't want to parse the complete file
16
 # only the first plane is we are interested in
16
 # only the first plane is we are interested in
17
-max_g1 = 1000
17
+max_g1 = 100000000
18
 
18
 
19
 # g29 keyword
19
 # g29 keyword
20
 g29_keyword = 'g29'
20
 g29_keyword = 'g29'
25
 # input filename
25
 # input filename
26
 input_file = folder + my_file
26
 input_file = folder + my_file
27
 
27
 
28
-# offset makes the plane a little bit bigger
29
-offset_x = 10
30
-offset_y = 10
28
+# minimum scan size
29
+min_size = 40
31
 probing_points = 3  # points x points
30
 probing_points = 3  # points x points
32
 
31
 
33
 # other stuff
32
 # other stuff
152
 
151
 
153
 print('x_min:{} x_max:{}\ny_min:{} y_max:{}'.format(min_x, max_x, min_y, max_y))
152
 print('x_min:{} x_max:{}\ny_min:{} y_max:{}'.format(min_x, max_x, min_y, max_y))
154
 
153
 
155
-min_x = int(min_x) - offset_x
156
-max_x = int(max_x) + offset_x
157
-min_y = int(min_y) - offset_y
158
-max_y = int(max_y) + offset_y
154
+# resize min/max - values for minimum scan
155
+if max_x - min_x < min_size:
156
+    offset_x = int((min_size - (max_x - min_x)) / 2 + 0.5)  # int round up
157
+    # print('min_x! with {}'.format(int(max_x - min_x)))
158
+    min_x = int(min_x) - offset_x
159
+    max_x = int(max_x) + offset_x
160
+if max_y - min_y < min_size:
161
+    offset_y = int((min_size - (max_y - min_y)) / 2 + 0.5)  # int round up
162
+    # print('min_y! with {}'.format(int(max_y - min_y)))
163
+    min_y = int(min_y) - offset_y
164
+    max_y = int(max_y) + offset_y
165
+
159
 
166
 
160
 new_command = 'G29 L{0} R{1} F{2} B{3} P{4}\n'.format(min_x,
167
 new_command = 'G29 L{0} R{1} F{2} B{3} P{4}\n'.format(min_x,
161
                                                       max_x,
168
                                                       max_x,

Loading…
Cancel
Save