Commit 58c4ac4b authored by MagoKimbra's avatar MagoKimbra

Add G28 M

Bed level manual
parent 39da0e9f
......@@ -88,6 +88,14 @@ const bool Z_MAX_ENDSTOP_INVERTING = false; // set to true to invert the logic o
#define Y_MAX_LENGTH (Y_MAX_POS - Y_MIN_POS)
#define Z_MAX_LENGTH (Z_MAX_POS - Z_MIN_POS)
// set the rectangle in which to probe in manual or automatic
#define LEFT_PROBE_BED_POSITION 15
#define RIGHT_PROBE_BED_POSITION 185
#define BACK_PROBE_BED_POSITION 185
#define FRONT_PROBE_BED_POSITION 15
#define XY_TRAVEL_SPEED 10000 // X and Y axis travel speed between probes, in mm/min
//============================= Bed Auto Leveling ===========================
//#define ENABLE_AUTO_BED_LEVELING // Delete the comment to enable (remove // at the start of the line)
......@@ -113,18 +121,10 @@ const bool Z_MAX_ENDSTOP_INVERTING = false; // set to true to invert the logic o
// and least squares solution is calculated
// Note: this feature occupies 10'206 byte
#ifdef AUTO_BED_LEVELING_GRID
// set the rectangle in which to probe
#define LEFT_PROBE_BED_POSITION 15
#define RIGHT_PROBE_BED_POSITION 185
#define BACK_PROBE_BED_POSITION 185
#define FRONT_PROBE_BED_POSITION 15
// set the number of grid points per dimension
// I wouldn't see a reason to go above 3 (=9 probing points on the bed)
#define AUTO_BED_LEVELING_GRID_POINTS 2
#else // not AUTO_BED_LEVELING_GRID
// with no grid, just probe 3 arbitrary points. A simple cross-product
// is used to esimate the plane of the print bed
......@@ -142,13 +142,11 @@ const bool Z_MAX_ENDSTOP_INVERTING = false; // set to true to invert the logic o
// these are the offsets to the probe relative to the extruder tip (Hotend - Probe)
#define X_PROBE_OFFSET_FROM_EXTRUDER 0
#define Y_PROBE_OFFSET_FROM_EXTRUDER 20
#define Z_PROBE_OFFSET_FROM_EXTRUDER -3.65
#define Z_PROBE_OFFSET_FROM_EXTRUDER -3.35
#define Z_RAISE_BEFORE_HOMING 10 // (in mm) Raise Z before homing (G28) for Probe Clearance.
// Be sure you have this distance over your Z_MAX_POS in case
#define XY_TRAVEL_SPEED 10000 // X and Y axis travel speed between probes, in mm/min
#define Z_RAISE_BEFORE_PROBING 10 //How much the extruder will be raised before traveling to the first probing point.
#define Z_RAISE_BETWEEN_PROBINGS 4 //How much the extruder will be raised when traveling from between next probing points
......@@ -159,7 +157,7 @@ const bool Z_MAX_ENDSTOP_INVERTING = false; // set to true to invert the logic o
//The value is the delay to turn the servo off after powered on - depends on the servo speed; 300ms is good value, but you can try lower it.
// You MUST HAVE the SERVO_ENDSTOPS defined to use here a value higher than zero otherwise your code will not compile.
//#define PROBE_SERVO_DEACTIVATION_DELAY 300
#define PROBE_SERVO_DEACTIVATION_DELAY 300
//If you have enabled the Bed Auto Leveling and are using the same Z Probe for Z Homing,
......
......@@ -2039,7 +2039,7 @@ void process_commands()
current_position[Y_AXIS] = destination[Y_AXIS];
#ifndef SCARA
current_position[Z_AXIS] = destination[Z_AXIS];
#endif
#endif
}
#endif // QUICK_HOME
......@@ -2087,7 +2087,70 @@ void process_commands()
#if Z_HOME_DIR < 0 // If homing towards BED do Z last
#ifndef Z_SAFE_HOMING
if((home_all_axis) || (code_seen(axis_codes[Z_AXIS]))) {
if (code_seen('M')) { // Manual G28
#ifdef ULTIPANEL
if(home_all_axis) {
boolean zig = true;
int xGridSpacing = (RIGHT_PROBE_BED_POSITION - LEFT_PROBE_BED_POSITION);
int yGridSpacing = (BACK_PROBE_BED_POSITION - FRONT_PROBE_BED_POSITION);
for (int yProbe=FRONT_PROBE_BED_POSITION; yProbe <= BACK_PROBE_BED_POSITION; yProbe += yGridSpacing) {
int xProbe, xInc;
if (zig) {
xProbe = LEFT_PROBE_BED_POSITION;
xInc = xGridSpacing;
zig = false;
} else { // zag
xProbe = RIGHT_PROBE_BED_POSITION;
xInc = -xGridSpacing;
zig = true;
}
for (int xCount=0; xCount < 2; xCount++) {
destination[X_AXIS] = xProbe;
destination[Y_AXIS] = yProbe;
destination[Z_AXIS] = 5 * home_dir(Z_AXIS) * (-1);
feedrate = XY_TRAVEL_SPEED;
current_position[Z_AXIS] = 0;
plan_set_position(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS]);
plan_buffer_line(destination[X_AXIS], destination[Y_AXIS], destination[Z_AXIS], destination[E_AXIS], feedrate/60, active_extruder, active_driver);
st_synchronize();
current_position[X_AXIS] = destination[X_AXIS];
current_position[Y_AXIS] = destination[Y_AXIS];
HOMEAXIS(Z);
lcd_setstatus("Press button ");
boolean beepbutton=true;
while(!lcd_clicked()) {
manage_heater();
manage_inactivity();
lcd_update();
if(beepbutton) {
#if BEEPER > 0
SET_OUTPUT(BEEPER);
WRITE(BEEPER,HIGH);
delay(100);
WRITE(BEEPER,LOW);
delay(3);
#else
#if !defined(LCD_FEEDBACK_FREQUENCY_HZ) || !defined(LCD_FEEDBACK_FREQUENCY_DURATION_MS)
lcd_buzz(1000/6,100);
#else
lcd_buzz(LCD_FEEDBACK_FREQUENCY_DURATION_MS,LCD_FEEDBACK_FREQUENCY_HZ);
#endif
#endif
beepbutton=false;
}
}
xProbe += xInc;
}
}
lcd_setstatus("Finish ");
enquecommand("G28 X0 Y0");
enquecommand("G4 P0");
enquecommand("G4 P0");
enquecommand("G4 P0");
}
#endif // ULTIPANEL
}
else if((home_all_axis) || (code_seen(axis_codes[Z_AXIS]))) {
#if defined (Z_RAISE_BEFORE_HOMING) && (Z_RAISE_BEFORE_HOMING > 0)
destination[Z_AXIS] = Z_RAISE_BEFORE_HOMING * home_dir(Z_AXIS) * (-1); // Set destination away from bed
feedrate = max_feedrate[Z_AXIS];
......@@ -4679,7 +4742,7 @@ case 404: //M404 Enter the nominal filament width (3mm, 1.75mm ) N<3.0> or disp
#endif // CUSTOM_M_CODE_SET_Z_PROBE_OFFSET
#ifdef FILAMENTCHANGEENABLE
case 600: //Pause for filament change X[pos] Y[pos] Z[relative lift] E[initial retract] L[later retract distance for removal]
case 600: //M600 - Pause for filament change X[pos] Y[pos] Z[relative lift] E[initial retract] L[later retract distance for removal]
{
float target[4];
target[X_AXIS]=current_position[X_AXIS];
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment