Browse Source

3 Step Allen Key Probe

Richard Wackerbarth 10 years ago
parent
commit
ad09d6a60f
1 changed files with 85 additions and 28 deletions
  1. 85
    28
      Marlin/Marlin_main.cpp

+ 85
- 28
Marlin/Marlin_main.cpp View File

@@ -1296,32 +1296,73 @@ static void setup_for_endstop_move() {
1296 1296
       }
1297 1297
 
1298 1298
     #elif defined(Z_PROBE_ALLEN_KEY)
1299
+      feedrate = Z_PROBE_ALLEN_KEY_DEPLOY_1_FEEDRATE;
1299 1300
 
1300
-      feedrate = homing_feedrate[X_AXIS];
1301
+      // If endstop is already false, the probe is deployed
1302
+      #ifdef Z_PROBE_ENDSTOP
1303
+        bool z_probe_endstop = (READ(Z_PROBE_PIN) != Z_PROBE_ENDSTOP_INVERTING);
1304
+        if (z_probe_endstop)
1305
+      #else
1306
+        bool z_min_endstop = (READ(Z_MIN_PIN) != Z_MIN_ENDSTOP_INVERTING);
1307
+        if (z_min_endstop)
1308
+      #endif
1309
+        {
1301 1310
 
1302
-      // Move to the start position to initiate deployment
1303
-      destination[X_AXIS] = Z_PROBE_ALLEN_KEY_DEPLOY_X;
1304
-      destination[Y_AXIS] = Z_PROBE_ALLEN_KEY_DEPLOY_Y;
1305
-      destination[Z_AXIS] = Z_PROBE_ALLEN_KEY_DEPLOY_Z;
1306
-      prepare_move_raw(); // this will also set_current_to_destination
1311
+          // Move to the start position to initiate deployment
1312
+          destination[X_AXIS] = Z_PROBE_ALLEN_KEY_DEPLOY_1_X;
1313
+          destination[Y_AXIS] = Z_PROBE_ALLEN_KEY_DEPLOY_1_Y;
1314
+          destination[Z_AXIS] = Z_PROBE_ALLEN_KEY_DEPLOY_1_Z;
1315
+          prepare_move_raw(); // this will also set_current_to_destination
1307 1316
 
1308
-      // Home X to touch the belt
1309
-      feedrate = homing_feedrate[X_AXIS]/10;
1310
-      destination[X_AXIS] = 0;
1311
-      prepare_move_raw(); // this will also set_current_to_destination
1312
-      
1313
-      // Home Y for safety
1314
-      feedrate = homing_feedrate[X_AXIS]/2;
1315
-      destination[Y_AXIS] = 0;
1317
+          // Move to engage deployment
1318
+          if (Z_PROBE_ALLEN_KEY_DEPLOY_2_FEEDRATE != Z_PROBE_ALLEN_KEY_DEPLOY_1_FEEDRATE) {
1319
+            feedrate = Z_PROBE_ALLEN_KEY_DEPLOY_2_FEEDRATE;
1320
+          }
1321
+          if (Z_PROBE_ALLEN_KEY_DEPLOY_2_X != Z_PROBE_ALLEN_KEY_DEPLOY_1_X) {
1322
+            destination[X_AXIS] = Z_PROBE_ALLEN_KEY_DEPLOY_2_X;
1323
+          }
1324
+          if (Z_PROBE_ALLEN_KEY_DEPLOY_2_Y != Z_PROBE_ALLEN_KEY_DEPLOY_1_Y) {
1325
+            destination[Y_AXIS] = Z_PROBE_ALLEN_KEY_DEPLOY_2_Y;
1326
+          }
1327
+          if (Z_PROBE_ALLEN_KEY_DEPLOY_2_Z != Z_PROBE_ALLEN_KEY_DEPLOY_1_Z) {
1328
+            destination[Z_AXIS] = Z_PROBE_ALLEN_KEY_DEPLOY_2_Z;
1329
+          }
1330
+          prepare_move_raw();
1331
+
1332
+          #ifdef Z_PROBE_ALLEN_KEY_DEPLOY_3_X
1333
+            if (Z_PROBE_ALLEN_KEY_DEPLOY_3_FEEDRATE != Z_PROBE_ALLEN_KEY_DEPLOY_2_FEEDRATE) {
1334
+              feedrate = Z_PROBE_ALLEN_KEY_DEPLOY_3_FEEDRATE;
1335
+            }
1336
+
1337
+            // Move to trigger deployment
1338
+            if (Z_PROBE_ALLEN_KEY_DEPLOY_3_FEEDRATE != Z_PROBE_ALLEN_KEY_DEPLOY_2_FEEDRATE) {
1339
+              feedrate = Z_PROBE_ALLEN_KEY_DEPLOY_3_FEEDRATE;
1340
+            }
1341
+            if (Z_PROBE_ALLEN_KEY_DEPLOY_3_X != Z_PROBE_ALLEN_KEY_DEPLOY_2_X) {
1342
+              destination[X_AXIS] = Z_PROBE_ALLEN_KEY_DEPLOY_3_X;
1343
+            }
1344
+            if (Z_PROBE_ALLEN_KEY_DEPLOY_3_Y != Z_PROBE_ALLEN_KEY_DEPLOY_2_Y) {
1345
+              destination[Y_AXIS] = Z_PROBE_ALLEN_KEY_DEPLOY_3_Y;
1346
+            }
1347
+            if (Z_PROBE_ALLEN_KEY_DEPLOY_3_Z != Z_PROBE_ALLEN_KEY_DEPLOY_2_Z) {
1348
+              destination[Z_AXIS] = Z_PROBE_ALLEN_KEY_DEPLOY_3_Z;
1349
+            }
1350
+            prepare_move_raw();
1351
+          #endif
1352
+      }
1353
+
1354
+      // Partially Home X,Y for safety
1355
+      destination[X_AXIS] = destination[X_AXIS]*0.75;
1356
+      destination[Y_AXIS] = destination[Y_AXIS]*0.75;
1316 1357
       prepare_move_raw(); // this will also set_current_to_destination
1317
-      
1358
+
1318 1359
       st_synchronize();
1319 1360
 
1320 1361
       #ifdef Z_PROBE_ENDSTOP
1321
-        bool z_probe_endstop = (READ(Z_PROBE_PIN) != Z_PROBE_ENDSTOP_INVERTING);
1362
+        z_probe_endstop = (READ(Z_PROBE_PIN) != Z_PROBE_ENDSTOP_INVERTING);
1322 1363
         if (z_probe_endstop)
1323 1364
       #else
1324
-        bool z_min_endstop = (READ(Z_MIN_PIN) != Z_MIN_ENDSTOP_INVERTING);
1365
+        z_min_endstop = (READ(Z_MIN_PIN) != Z_MIN_ENDSTOP_INVERTING);
1325 1366
         if (z_min_endstop)
1326 1367
       #endif
1327 1368
         {
@@ -1366,25 +1407,41 @@ static void setup_for_endstop_move() {
1366 1407
     #elif defined(Z_PROBE_ALLEN_KEY)
1367 1408
 
1368 1409
       // Move up for safety
1369
-      feedrate = homing_feedrate[X_AXIS];
1410
+      feedrate = Z_PROBE_ALLEN_KEY_STOW_1_FEEDRATE;
1370 1411
       destination[Z_AXIS] = current_position[Z_AXIS] + Z_RAISE_AFTER_PROBING;
1371 1412
       prepare_move_raw(); // this will also set_current_to_destination
1372 1413
 
1373 1414
       // Move to the start position to initiate retraction
1374
-      destination[X_AXIS] = Z_PROBE_ALLEN_KEY_STOW_X;
1375
-      destination[Y_AXIS] = Z_PROBE_ALLEN_KEY_STOW_Y;
1376
-      destination[Z_AXIS] = Z_PROBE_ALLEN_KEY_STOW_Z;
1377
-      prepare_move_raw(); // this will also set_current_to_destination
1415
+      destination[X_AXIS] = Z_PROBE_ALLEN_KEY_STOW_1_X;
1416
+      destination[Y_AXIS] = Z_PROBE_ALLEN_KEY_STOW_1_Y;
1417
+      destination[Z_AXIS] = Z_PROBE_ALLEN_KEY_STOW_1_Z;
1418
+      prepare_move_raw();
1378 1419
 
1379 1420
       // Move the nozzle down to push the probe into retracted position
1380
-      feedrate = homing_feedrate[Z_AXIS]/10;
1381
-      destination[Z_AXIS] = current_position[Z_AXIS] - Z_PROBE_ALLEN_KEY_STOW_DEPTH;
1382
-      prepare_move_raw(); // this will also set_current_to_destination
1421
+      if (Z_PROBE_ALLEN_KEY_STOW_2_FEEDRATE != Z_PROBE_ALLEN_KEY_STOW_1_FEEDRATE) {
1422
+        feedrate = Z_PROBE_ALLEN_KEY_STOW_2_FEEDRATE;
1423
+      }
1424
+      if (Z_PROBE_ALLEN_KEY_STOW_2_X != Z_PROBE_ALLEN_KEY_STOW_1_X) {
1425
+        destination[X_AXIS] = Z_PROBE_ALLEN_KEY_STOW_2_X;
1426
+      }
1427
+      if (Z_PROBE_ALLEN_KEY_STOW_2_Y != Z_PROBE_ALLEN_KEY_STOW_1_Y) {
1428
+        destination[Y_AXIS] = Z_PROBE_ALLEN_KEY_STOW_2_Y;
1429
+      }
1430
+      destination[Z_AXIS] = Z_PROBE_ALLEN_KEY_STOW_2_Z;
1431
+      prepare_move_raw();
1383 1432
       
1384 1433
       // Move up for safety
1385
-      feedrate = homing_feedrate[Z_AXIS]/2;
1386
-      destination[Z_AXIS] = current_position[Z_AXIS] + Z_PROBE_ALLEN_KEY_STOW_DEPTH * 2;
1387
-      prepare_move_raw(); // this will also set_current_to_destination
1434
+      if (Z_PROBE_ALLEN_KEY_STOW_3_FEEDRATE != Z_PROBE_ALLEN_KEY_STOW_2_FEEDRATE) {
1435
+        feedrate = Z_PROBE_ALLEN_KEY_STOW_2_FEEDRATE;
1436
+      }
1437
+      if (Z_PROBE_ALLEN_KEY_STOW_3_X != Z_PROBE_ALLEN_KEY_STOW_2_X) {
1438
+        destination[X_AXIS] = Z_PROBE_ALLEN_KEY_STOW_3_X;
1439
+      }
1440
+      if (Z_PROBE_ALLEN_KEY_STOW_3_Y != Z_PROBE_ALLEN_KEY_STOW_2_Y) {
1441
+        destination[Y_AXIS] = Z_PROBE_ALLEN_KEY_STOW_3_Y;
1442
+      }
1443
+      destination[Z_AXIS] = Z_PROBE_ALLEN_KEY_STOW_3_Z;
1444
+      prepare_move_raw();
1388 1445
       
1389 1446
       // Home XY for safety
1390 1447
       feedrate = homing_feedrate[X_AXIS]/2;

Loading…
Cancel
Save