Преглед изворни кода

Merge pull request #1666 from maverikou/fix_1507

Fix 1507
Scott Lahteine пре 10 година
родитељ
комит
e0a42d3f9a
1 измењених фајлова са 19 додато и 10 уклоњено
  1. 19
    10
      Marlin/Marlin_main.cpp

+ 19
- 10
Marlin/Marlin_main.cpp Прегледај датотеку

@@ -1309,7 +1309,13 @@ static void engage_z_probe() {
1309 1309
 static void retract_z_probe() {
1310 1310
   // Retract Z Servo endstop if enabled
1311 1311
   #ifdef SERVO_ENDSTOPS
1312
-    if (servo_endstops[Z_AXIS] > -1) {
1312
+    if (servo_endstops[Z_AXIS] > -1)
1313
+    {
1314
+      #if Z_RAISE_AFTER_PROBING > 0
1315
+        do_blocking_move_to(current_position[X_AXIS], current_position[Y_AXIS], Z_RAISE_AFTER_PROBING);
1316
+        st_synchronize();
1317
+      #endif
1318
+    
1313 1319
       #if SERVO_LEVELING
1314 1320
         servos[servo_endstops[Z_AXIS]].attach(0);
1315 1321
       #endif
@@ -1322,7 +1328,7 @@ static void retract_z_probe() {
1322 1328
   #elif defined(Z_PROBE_ALLEN_KEY)
1323 1329
     // Move up for safety
1324 1330
     feedrate = homing_feedrate[X_AXIS];
1325
-    destination[Z_AXIS] = current_position[Z_AXIS] + 20;
1331
+    destination[Z_AXIS] = current_position[Z_AXIS] + Z_RAISE_AFTER_PROBING;
1326 1332
     prepare_move_raw();
1327 1333
 
1328 1334
     // Move to the start position to initiate retraction
@@ -1364,10 +1370,16 @@ static void retract_z_probe() {
1364 1370
 
1365 1371
 }
1366 1372
 
1367
-enum ProbeAction { ProbeStay, ProbeEngage, ProbeRetract, ProbeEngageRetract };
1373
+enum ProbeAction
1374
+{
1375
+    ProbeStay             = 0,
1376
+    ProbeEngage           = (1 << 0),
1377
+    ProbeRetract          = (1 << 1),
1378
+    ProbeEngageAndRetract = (ProbeEngage | ProbeRetract),
1379
+};
1368 1380
 
1369 1381
 /// Probe bed height at position (x,y), returns the measured z value
1370
-static float probe_pt(float x, float y, float z_before, ProbeAction retract_action=ProbeEngageRetract, int verbose_level=1) {
1382
+static float probe_pt(float x, float y, float z_before, ProbeAction retract_action=ProbeEngageAndRetract, int verbose_level=1) {
1371 1383
   // move to right place
1372 1384
   do_blocking_move_to(current_position[X_AXIS], current_position[Y_AXIS], z_before);
1373 1385
   do_blocking_move_to(x - X_PROBE_OFFSET_FROM_EXTRUDER, y - Y_PROBE_OFFSET_FROM_EXTRUDER, current_position[Z_AXIS]);
@@ -2221,7 +2233,7 @@ inline void gcode_G28() {
2221 2233
 
2222 2234
     #ifdef Z_PROBE_SLED
2223 2235
       dock_sled(false); // engage (un-dock) the probe
2224
-    #elif not defined(SERVO_ENDSTOPS)
2236
+    #elif defined(Z_PROBE_ALLEN_KEY)
2225 2237
       engage_z_probe();
2226 2238
     #endif
2227 2239
 
@@ -2330,7 +2342,7 @@ inline void gcode_G28() {
2330 2342
               act = ProbeStay;
2331 2343
           }
2332 2344
           else
2333
-            act = ProbeEngageRetract;
2345
+            act = ProbeEngageAndRetract;
2334 2346
 
2335 2347
           measured_z = probe_pt(xProbe, yProbe, z_before, act, verbose_level);
2336 2348
 
@@ -2445,9 +2457,6 @@ inline void gcode_G28() {
2445 2457
 
2446 2458
     #endif // !AUTO_BED_LEVELING_GRID
2447 2459
 
2448
-    do_blocking_move_to(current_position[X_AXIS], current_position[Y_AXIS], Z_RAISE_AFTER_PROBING);
2449
-    st_synchronize();
2450
-
2451 2460
   #ifndef DELTA
2452 2461
     if (verbose_level > 0)
2453 2462
       plan_bed_level_matrix.debug(" \n\nBed Level Correction Matrix:");
@@ -2467,7 +2476,7 @@ inline void gcode_G28() {
2467 2476
 
2468 2477
   #ifdef Z_PROBE_SLED
2469 2478
     dock_sled(true, -SLED_DOCKING_OFFSET); // dock the probe, correcting for over-travel
2470
-  #elif not defined(SERVO_ENDSTOPS)
2479
+  #elif defined(Z_PROBE_ALLEN_KEY)
2471 2480
     retract_z_probe();
2472 2481
   #endif
2473 2482
     

Loading…
Откажи
Сачувај