|
@@ -78,6 +78,8 @@
|
78
|
78
|
// G28 - Home all Axis
|
79
|
79
|
// G29 - Detailed Z-Probe, probes the bed at 3 or more points. Will fail if you haven't homed yet.
|
80
|
80
|
// G30 - Single Z Probe, probes bed at current XY location.
|
|
81
|
+// G31 - Dock sled (Z_PROBE_SLED only)
|
|
82
|
+// G32 - Undock sled (Z_PROBE_SLED only)
|
81
|
83
|
// G90 - Use Absolute Coordinates
|
82
|
84
|
// G91 - Use Relative Coordinates
|
83
|
85
|
// G92 - Set current position to coordinates given
|
|
@@ -548,6 +550,10 @@ void setup()
|
548
|
550
|
#ifdef DIGIPOT_I2C
|
549
|
551
|
digipot_i2c_init();
|
550
|
552
|
#endif
|
|
553
|
+#ifdef Z_PROBE_SLED
|
|
554
|
+ pinMode(SERVO0_PIN, OUTPUT);
|
|
555
|
+ digitalWrite(SERVO0_PIN, LOW); // turn it off
|
|
556
|
+#endif // Z_PROBE_SLED
|
551
|
557
|
}
|
552
|
558
|
|
553
|
559
|
|
|
@@ -1035,10 +1041,14 @@ static float probe_pt(float x, float y, float z_before) {
|
1035
|
1041
|
do_blocking_move_to(current_position[X_AXIS], current_position[Y_AXIS], z_before);
|
1036
|
1042
|
do_blocking_move_to(x - X_PROBE_OFFSET_FROM_EXTRUDER, y - Y_PROBE_OFFSET_FROM_EXTRUDER, current_position[Z_AXIS]);
|
1037
|
1043
|
|
|
1044
|
+#ifndef Z_PROBE_SLED
|
1038
|
1045
|
engage_z_probe(); // Engage Z Servo endstop if available
|
|
1046
|
+#endif // Z_PROBE_SLED
|
1039
|
1047
|
run_z_probe();
|
1040
|
1048
|
float measured_z = current_position[Z_AXIS];
|
|
1049
|
+#ifndef Z_PROBE_SLED
|
1041
|
1050
|
retract_z_probe();
|
|
1051
|
+#endif // Z_PROBE_SLED
|
1042
|
1052
|
|
1043
|
1053
|
SERIAL_PROTOCOLPGM(MSG_BED);
|
1044
|
1054
|
SERIAL_PROTOCOLPGM(" x: ");
|
|
@@ -1071,6 +1081,7 @@ static void homeaxis(int axis) {
|
1071
|
1081
|
plan_set_position(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS]);
|
1072
|
1082
|
|
1073
|
1083
|
|
|
1084
|
+#ifndef Z_PROBE_SLED
|
1074
|
1085
|
// Engage Servo endstop if enabled
|
1075
|
1086
|
#ifdef SERVO_ENDSTOPS
|
1076
|
1087
|
#if defined (ENABLE_AUTO_BED_LEVELING) && (PROBE_SERVO_DEACTIVATION_DELAY > 0)
|
|
@@ -1083,7 +1094,7 @@ static void homeaxis(int axis) {
|
1083
|
1094
|
servos[servo_endstops[axis]].write(servo_endstop_angles[axis * 2]);
|
1084
|
1095
|
}
|
1085
|
1096
|
#endif
|
1086
|
|
-
|
|
1097
|
+#endif // Z_PROBE_SLED
|
1087
|
1098
|
destination[axis] = 1.5 * max_length(axis) * axis_home_dir;
|
1088
|
1099
|
feedrate = homing_feedrate[axis];
|
1089
|
1100
|
plan_buffer_line(destination[X_AXIS], destination[Y_AXIS], destination[Z_AXIS], destination[E_AXIS], feedrate/60, active_extruder);
|
|
@@ -1125,7 +1136,7 @@ static void homeaxis(int axis) {
|
1125
|
1136
|
}
|
1126
|
1137
|
#endif
|
1127
|
1138
|
#if defined (ENABLE_AUTO_BED_LEVELING) && (PROBE_SERVO_DEACTIVATION_DELAY > 0)
|
1128
|
|
- if (axis==Z_AXIS) retract_z_probe();
|
|
1139
|
+// if (axis==Z_AXIS) retract_z_probe();
|
1129
|
1140
|
#endif
|
1130
|
1141
|
|
1131
|
1142
|
}
|
|
@@ -1180,6 +1191,42 @@ void refresh_cmd_timeout(void)
|
1180
|
1191
|
} //retract
|
1181
|
1192
|
#endif //FWRETRACT
|
1182
|
1193
|
|
|
1194
|
+#ifdef ENABLE_AUTO_BED_LEVELING
|
|
1195
|
+//
|
|
1196
|
+// Method to dock/undock a sled designed by Charles Bell.
|
|
1197
|
+//
|
|
1198
|
+// dock[in] If true, move to MAX_X and engage the electromagnet
|
|
1199
|
+// offset[in] The additional distance to move to adjust docking location
|
|
1200
|
+//
|
|
1201
|
+static void dock_sled(bool dock, int offset=0) {
|
|
1202
|
+ int z_loc;
|
|
1203
|
+
|
|
1204
|
+ if (!((axis_known_position[X_AXIS]) && (axis_known_position[Y_AXIS]))) {
|
|
1205
|
+ LCD_MESSAGEPGM(MSG_POSITION_UNKNOWN);
|
|
1206
|
+ SERIAL_ECHO_START;
|
|
1207
|
+ SERIAL_ECHOLNPGM(MSG_POSITION_UNKNOWN);
|
|
1208
|
+ return;
|
|
1209
|
+ }
|
|
1210
|
+
|
|
1211
|
+ if (dock) {
|
|
1212
|
+ do_blocking_move_to(X_MAX_POS + SLED_DOCKING_OFFSET + offset,
|
|
1213
|
+ current_position[Y_AXIS],
|
|
1214
|
+ current_position[Z_AXIS]);
|
|
1215
|
+ // turn off magnet
|
|
1216
|
+ digitalWrite(SERVO0_PIN, LOW);
|
|
1217
|
+ } else {
|
|
1218
|
+ if (current_position[Z_AXIS] < (Z_RAISE_BEFORE_PROBING + 5))
|
|
1219
|
+ z_loc = Z_RAISE_BEFORE_PROBING;
|
|
1220
|
+ else
|
|
1221
|
+ z_loc = current_position[Z_AXIS];
|
|
1222
|
+ do_blocking_move_to(X_MAX_POS + SLED_DOCKING_OFFSET + offset,
|
|
1223
|
+ Y_PROBE_OFFSET_FROM_EXTRUDER, z_loc);
|
|
1224
|
+ // turn on magnet
|
|
1225
|
+ digitalWrite(SERVO0_PIN, HIGH);
|
|
1226
|
+ }
|
|
1227
|
+}
|
|
1228
|
+#endif
|
|
1229
|
+
|
1183
|
1230
|
void process_commands()
|
1184
|
1231
|
{
|
1185
|
1232
|
unsigned long codenum; //throw away variable
|
|
@@ -1490,6 +1537,9 @@ void process_commands()
|
1490
|
1537
|
break; // abort G29, since we don't know where we are
|
1491
|
1538
|
}
|
1492
|
1539
|
|
|
1540
|
+#ifdef Z_PROBE_SLED
|
|
1541
|
+ dock_sled(false);
|
|
1542
|
+#endif // Z_PROBE_SLED
|
1493
|
1543
|
st_synchronize();
|
1494
|
1544
|
// make sure the bed_level_rotation_matrix is identity or the planner will get it incorectly
|
1495
|
1545
|
//vector_3 corrected_position = plan_get_position_mm();
|
|
@@ -1615,13 +1665,15 @@ void process_commands()
|
1615
|
1665
|
apply_rotation_xyz(plan_bed_level_matrix, x_tmp, y_tmp, z_tmp); //Apply the correction sending the probe offset
|
1616
|
1666
|
current_position[Z_AXIS] = z_tmp - real_z + current_position[Z_AXIS]; //The difference is added to current position and sent to planner.
|
1617
|
1667
|
plan_set_position(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS]);
|
|
1668
|
+#ifdef Z_PROBE_SLED
|
|
1669
|
+ dock_sled(true, -SLED_DOCKING_OFFSET); // correct for over travel.
|
|
1670
|
+#endif // Z_PROBE_SLED
|
1618
|
1671
|
}
|
1619
|
1672
|
break;
|
1620
|
|
-
|
|
1673
|
+#ifndef Z_PROBE_SLED
|
1621
|
1674
|
case 30: // G30 Single Z Probe
|
1622
|
1675
|
{
|
1623
|
1676
|
engage_z_probe(); // Engage Z Servo endstop if available
|
1624
|
|
-
|
1625
|
1677
|
st_synchronize();
|
1626
|
1678
|
// TODO: make sure the bed_level_rotation_matrix is identity or the planner will get set incorectly
|
1627
|
1679
|
setup_for_endstop_move();
|
|
@@ -1639,10 +1691,17 @@ void process_commands()
|
1639
|
1691
|
SERIAL_PROTOCOLPGM("\n");
|
1640
|
1692
|
|
1641
|
1693
|
clean_up_after_endstop_move();
|
1642
|
|
-
|
1643
|
1694
|
retract_z_probe(); // Retract Z Servo endstop if available
|
1644
|
1695
|
}
|
1645
|
1696
|
break;
|
|
1697
|
+#else
|
|
1698
|
+ case 31: // dock the sled
|
|
1699
|
+ dock_sled(true);
|
|
1700
|
+ break;
|
|
1701
|
+ case 32: // undock the sled
|
|
1702
|
+ dock_sled(false);
|
|
1703
|
+ break;
|
|
1704
|
+#endif // Z_PROBE_SLED
|
1646
|
1705
|
#endif // ENABLE_AUTO_BED_LEVELING
|
1647
|
1706
|
case 90: // G90
|
1648
|
1707
|
relative_mode = false;
|
|
@@ -1982,7 +2041,7 @@ void process_commands()
|
1982
|
2041
|
|
1983
|
2042
|
/* See if we are heating up or cooling down */
|
1984
|
2043
|
target_direction = isHeatingHotend(tmp_extruder); // true if heating, false if cooling
|
1985
|
|
-
|
|
2044
|
+
|
1986
|
2045
|
cancel_heatup = false;
|
1987
|
2046
|
|
1988
|
2047
|
#ifdef TEMP_RESIDENCY_TIME
|
|
@@ -2758,7 +2817,7 @@ void process_commands()
|
2758
|
2817
|
st_synchronize();
|
2759
|
2818
|
}
|
2760
|
2819
|
break;
|
2761
|
|
-#if defined(ENABLE_AUTO_BED_LEVELING) && defined(SERVO_ENDSTOPS)
|
|
2820
|
+#if defined(ENABLE_AUTO_BED_LEVELING) && defined(SERVO_ENDSTOPS) && not defined(Z_PROBE_SLED)
|
2762
|
2821
|
case 401:
|
2763
|
2822
|
{
|
2764
|
2823
|
engage_z_probe(); // Engage Z Servo endstop if available
|