Revert "Change Auto_Bed_Leveling to Auto_Bed_Compensation"

This commit is contained in:
alexborro 2014-12-21 10:06:05 -02:00
parent 60628864ca
commit d74aabf259
12 changed files with 113 additions and 113 deletions

View File

@ -340,12 +340,12 @@ const bool Z_MAX_ENDSTOP_INVERTING = true; // set to true to invert the logic of
#define X_MAX_LENGTH (X_MAX_POS - X_MIN_POS)
#define Y_MAX_LENGTH (Y_MAX_POS - Y_MIN_POS)
#define Z_MAX_LENGTH (Z_MAX_POS - Z_MIN_POS)
//============================= Bed Auto Compensation ===========================
//============================= Bed Auto Leveling ===========================
//#define ENABLE_AUTO_BED_COMPENSATION // Delete the comment to enable (remove // at the start of the line)
#define Z_PROBE_REPEATABILITY_TEST // If not commented out, Z-Probe Repeatability test will be included if Auto Bed Compensation is Enabled.
//#define ENABLE_AUTO_BED_LEVELING // Delete the comment to enable (remove // at the start of the line)
#define Z_PROBE_REPEATABILITY_TEST // If not commented out, Z-Probe Repeatability test will be included if Auto Bed Leveling is Enabled.
#ifdef ENABLE_AUTO_BED_COMPENSATION
#ifdef ENABLE_AUTO_BED_LEVELING
// There are 2 different ways to pick the X and Y locations to probe:
@ -353,18 +353,18 @@ const bool Z_MAX_ENDSTOP_INVERTING = true; // set to true to invert the logic of
// Probe every point in a rectangular grid
// You must specify the rectangle, and the density of sample points
// This mode is preferred because there are more measurements.
// It used to be called ACCURATE_BED_COMPENSATION but "grid" is more descriptive
// It used to be called ACCURATE_BED_LEVELING but "grid" is more descriptive
// - "3-point" mode
// Probe 3 arbitrary points on the bed (that aren't colinear)
// You must specify the X & Y coordinates of all 3 points
#define AUTO_BED_COMPENSATION_GRID
// with AUTO_BED_COMPENSATION_GRID, the bed is sampled in a
// AUTO_BED_COMPENSATION_GRID_POINTSxAUTO_BED_COMPENSATION_GRID_POINTS grid
#define AUTO_BED_LEVELING_GRID
// with AUTO_BED_LEVELING_GRID, the bed is sampled in a
// AUTO_BED_LEVELING_GRID_POINTSxAUTO_BED_LEVELING_GRID_POINTS grid
// and least squares solution is calculated
// Note: this feature occupies 10'206 byte
#ifdef AUTO_BED_COMPENSATION_GRID
#ifdef AUTO_BED_LEVELING_GRID
// set the rectangle in which to probe
#define LEFT_PROBE_BED_POSITION 15
@ -374,10 +374,10 @@ const bool Z_MAX_ENDSTOP_INVERTING = true; // set to true to invert the logic of
// 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_COMPENSATION_GRID_POINTS 2
#define AUTO_BED_LEVELING_GRID_POINTS 2
#else // not AUTO_BED_COMPENSATION_GRID
#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
@ -388,7 +388,7 @@ const bool Z_MAX_ENDSTOP_INVERTING = true; // set to true to invert the logic of
#define ABL_PROBE_PT_3_X 170
#define ABL_PROBE_PT_3_Y 20
#endif // AUTO_BED_COMPENSATION_GRID
#endif // AUTO_BED_LEVELING_GRID
// these are the offsets to the probe relative to the extruder tip (Hotend - Probe)
@ -414,7 +414,7 @@ const bool Z_MAX_ENDSTOP_INVERTING = true; // set to true to invert the logic of
// #define PROBE_SERVO_DEACTIVATION_DELAY 300
//If you have enabled the Bed Auto Compensation and are using the same Z Probe for Z Homing,
//If you have enabled the Bed Auto Leveling and are using the same Z Probe for Z Homing,
//it is highly recommended you let this Z_SAFE_HOMING enabled!!!
#define Z_SAFE_HOMING // This feature is meant to avoid Z homing with probe outside the bed area.
@ -431,7 +431,7 @@ const bool Z_MAX_ENDSTOP_INVERTING = true; // set to true to invert the logic of
#endif
#endif // ENABLE_AUTO_BED_COMPENSATION
#endif // ENABLE_AUTO_BED_LEVELING
// The position of the homing switches

View File

@ -319,7 +319,7 @@ void Config_ResetDefault()
absPreheatHPBTemp = ABS_PREHEAT_HPB_TEMP;
absPreheatFanSpeed = ABS_PREHEAT_FAN_SPEED;
#endif
#ifdef ENABLE_AUTO_BED_COMPENSATION
#ifdef ENABLE_AUTO_BED_LEVELING
zprobe_zoffset = -Z_PROBE_OFFSET_FROM_EXTRUDER;
#endif
#ifdef DOGLCD

View File

@ -29,12 +29,12 @@
#include "Marlin.h"
#ifdef ENABLE_AUTO_BED_COMPENSATION
#ifdef ENABLE_AUTO_BED_LEVELING
#include "vector_3.h"
#ifdef AUTO_BED_COMPENSATION_GRID
#ifdef AUTO_BED_LEVELING_GRID
#include "qr_solve.h"
#endif
#endif // ENABLE_AUTO_BED_COMPENSATION
#endif // ENABLE_AUTO_BED_LEVELING
#include "ultralcd.h"
#include "planner.h"
@ -525,7 +525,7 @@ void servo_init()
}
#endif
#if defined (ENABLE_AUTO_BED_COMPENSATION) && (PROBE_SERVO_DEACTIVATION_DELAY > 0)
#if defined (ENABLE_AUTO_BED_LEVELING) && (PROBE_SERVO_DEACTIVATION_DELAY > 0)
delay(PROBE_SERVO_DEACTIVATION_DELAY);
servos[servo_endstops[Z_AXIS]].detach();
#endif
@ -967,16 +967,16 @@ static void axis_is_at_home(int axis) {
#endif
}
#ifdef ENABLE_AUTO_BED_COMPENSATION
#ifdef AUTO_BED_COMPENSATION_GRID
static void set_bed_compensation_equation_lsq(double *plane_equation_coefficients)
#ifdef ENABLE_AUTO_BED_LEVELING
#ifdef AUTO_BED_LEVELING_GRID
static void set_bed_level_equation_lsq(double *plane_equation_coefficients)
{
vector_3 planeNormal = vector_3(-plane_equation_coefficients[0], -plane_equation_coefficients[1], 1);
planeNormal.debug("planeNormal");
plan_bed_compensation_matrix = matrix_3x3::create_look_at(planeNormal);
//bedCompensation.debug("bedCompensation");
plan_bed_level_matrix = matrix_3x3::create_look_at(planeNormal);
//bedLevel.debug("bedLevel");
//plan_bed_compensation_matrix.debug("bed compensation before");
//plan_bed_level_matrix.debug("bed level before");
//vector_3 uncorrected_position = plan_get_position_mm();
//uncorrected_position.debug("position before");
@ -992,11 +992,11 @@ static void set_bed_compensation_equation_lsq(double *plane_equation_coefficient
plan_set_position(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS]);
}
#else // not AUTO_BED_COMPENSATION_GRID
#else // not AUTO_BED_LEVELING_GRID
static void set_bed_compensation_equation_3pts(float z_at_pt_1, float z_at_pt_2, float z_at_pt_3) {
static void set_bed_level_equation_3pts(float z_at_pt_1, float z_at_pt_2, float z_at_pt_3) {
plan_bed_compensation_matrix.set_to_identity();
plan_bed_level_matrix.set_to_identity();
vector_3 pt1 = vector_3(ABL_PROBE_PT_1_X, ABL_PROBE_PT_1_Y, z_at_pt_1);
vector_3 pt2 = vector_3(ABL_PROBE_PT_2_X, ABL_PROBE_PT_2_Y, z_at_pt_2);
@ -1007,7 +1007,7 @@ static void set_bed_compensation_equation_3pts(float z_at_pt_1, float z_at_pt_2,
vector_3 planeNormal = vector_3::cross(from_2_to_1, from_2_to_3).get_normal();
planeNormal = vector_3(planeNormal.x, planeNormal.y, abs(planeNormal.z));
plan_bed_compensation_matrix = matrix_3x3::create_look_at(planeNormal);
plan_bed_level_matrix = matrix_3x3::create_look_at(planeNormal);
vector_3 corrected_position = plan_get_position();
current_position[X_AXIS] = corrected_position.x;
@ -1021,10 +1021,10 @@ static void set_bed_compensation_equation_3pts(float z_at_pt_1, float z_at_pt_2,
}
#endif // AUTO_BED_COMPENSATION_GRID
#endif // AUTO_BED_LEVELING_GRID
static void run_z_probe() {
plan_bed_compensation_matrix.set_to_identity();
plan_bed_level_matrix.set_to_identity();
feedrate = homing_feedrate[Z_AXIS];
// move down until you find the bed
@ -1098,11 +1098,11 @@ static void engage_z_probe() {
// Engage Z Servo endstop if enabled
#ifdef SERVO_ENDSTOPS
if (servo_endstops[Z_AXIS] > -1) {
#if defined (ENABLE_AUTO_BED_COMPENSATION) && (PROBE_SERVO_DEACTIVATION_DELAY > 0)
#if defined (ENABLE_AUTO_BED_LEVELING) && (PROBE_SERVO_DEACTIVATION_DELAY > 0)
servos[servo_endstops[Z_AXIS]].attach(0);
#endif
servos[servo_endstops[Z_AXIS]].write(servo_endstop_angles[Z_AXIS * 2]);
#if defined (ENABLE_AUTO_BED_COMPENSATION) && (PROBE_SERVO_DEACTIVATION_DELAY > 0)
#if defined (ENABLE_AUTO_BED_LEVELING) && (PROBE_SERVO_DEACTIVATION_DELAY > 0)
delay(PROBE_SERVO_DEACTIVATION_DELAY);
servos[servo_endstops[Z_AXIS]].detach();
#endif
@ -1114,11 +1114,11 @@ static void retract_z_probe() {
// Retract Z Servo endstop if enabled
#ifdef SERVO_ENDSTOPS
if (servo_endstops[Z_AXIS] > -1) {
#if defined (ENABLE_AUTO_BED_COMPENSATION) && (PROBE_SERVO_DEACTIVATION_DELAY > 0)
#if defined (ENABLE_AUTO_BED_LEVELING) && (PROBE_SERVO_DEACTIVATION_DELAY > 0)
servos[servo_endstops[Z_AXIS]].attach(0);
#endif
servos[servo_endstops[Z_AXIS]].write(servo_endstop_angles[Z_AXIS * 2 + 1]);
#if defined (ENABLE_AUTO_BED_COMPENSATION) && (PROBE_SERVO_DEACTIVATION_DELAY > 0)
#if defined (ENABLE_AUTO_BED_LEVELING) && (PROBE_SERVO_DEACTIVATION_DELAY > 0)
delay(PROBE_SERVO_DEACTIVATION_DELAY);
servos[servo_endstops[Z_AXIS]].detach();
#endif
@ -1152,7 +1152,7 @@ static float probe_pt(float x, float y, float z_before) {
return measured_z;
}
#endif // #ifdef ENABLE_AUTO_BED_COMPENSATION
#endif // #ifdef ENABLE_AUTO_BED_LEVELING
static void homeaxis(int axis) {
#define HOMEAXIS_DO(LETTER) \
@ -1175,7 +1175,7 @@ static void homeaxis(int axis) {
#ifndef Z_PROBE_SLED
// Engage Servo endstop if enabled
#ifdef SERVO_ENDSTOPS
#if defined (ENABLE_AUTO_BED_COMPENSATION) && (PROBE_SERVO_DEACTIVATION_DELAY > 0)
#if defined (ENABLE_AUTO_BED_LEVELING) && (PROBE_SERVO_DEACTIVATION_DELAY > 0)
if (axis==Z_AXIS) {
engage_z_probe();
}
@ -1226,7 +1226,7 @@ static void homeaxis(int axis) {
servos[servo_endstops[axis]].write(servo_endstop_angles[axis * 2 + 1]);
}
#endif
#if defined (ENABLE_AUTO_BED_COMPENSATION) && (PROBE_SERVO_DEACTIVATION_DELAY > 0)
#if defined (ENABLE_AUTO_BED_LEVELING) && (PROBE_SERVO_DEACTIVATION_DELAY > 0)
#ifndef Z_PROBE_SLED
if (axis==Z_AXIS) retract_z_probe();
#endif
@ -1335,7 +1335,7 @@ void process_commands()
{
unsigned long codenum; //throw away variable
char *starpos = NULL;
#ifdef ENABLE_AUTO_BED_COMPENSATION
#ifdef ENABLE_AUTO_BED_LEVELING
float x_tmp, y_tmp, z_tmp, real_z;
#endif
if(code_seen('G'))
@ -1409,9 +1409,9 @@ void process_commands()
break;
#endif //FWRETRACT
case 28: //G28 Home all Axis one at a time
#ifdef ENABLE_AUTO_BED_COMPENSATION
plan_bed_compensation_matrix.set_to_identity(); //Reset the plane ("erase" all compensation data)
#endif //ENABLE_AUTO_BED_COMPENSATION
#ifdef ENABLE_AUTO_BED_LEVELING
plan_bed_level_matrix.set_to_identity(); //Reset the plane ("erase" all leveling data)
#endif //ENABLE_AUTO_BED_LEVELING
saved_feedrate = feedrate;
saved_feedmultiply = feedmultiply;
@ -1615,7 +1615,7 @@ void process_commands()
current_position[Z_AXIS]=code_value()+add_homing[Z_AXIS];
}
}
#ifdef ENABLE_AUTO_BED_COMPENSATION
#ifdef ENABLE_AUTO_BED_LEVELING
if((home_all_axis) || (code_seen(axis_codes[Z_AXIS]))) {
current_position[Z_AXIS] += zprobe_zoffset; //Add Z_Probe offset (the distance is negative)
}
@ -1638,11 +1638,11 @@ void process_commands()
endstops_hit_on_purpose();
break;
#ifdef ENABLE_AUTO_BED_COMPENSATION
#ifdef ENABLE_AUTO_BED_LEVELING
case 29: // G29 Detailed Z-Probe, probes the bed at 3 or more points.
{
#if Z_MIN_PIN == -1
#error "You must have a Z_MIN endstop in order to enable Auto Bed Compensation feature!!! Z_MIN_PIN must point to a valid hardware pin."
#error "You must have a Z_MIN endstop in order to enable Auto Bed Leveling feature!!! Z_MIN_PIN must point to a valid hardware pin."
#endif
// Prevent user from running a G29 without first homing in X and Y
@ -1658,10 +1658,10 @@ void process_commands()
dock_sled(false);
#endif // Z_PROBE_SLED
st_synchronize();
// make sure the bed_compensation_rotation_matrix is identity or the planner will get it incorectly
// make sure the bed_level_rotation_matrix is identity or the planner will get it incorectly
//vector_3 corrected_position = plan_get_position_mm();
//corrected_position.debug("position before G29");
plan_bed_compensation_matrix.set_to_identity();
plan_bed_level_matrix.set_to_identity();
vector_3 uncorrected_position = plan_get_position();
//uncorrected_position.debug("position durring G29");
current_position[X_AXIS] = uncorrected_position.x;
@ -1671,11 +1671,11 @@ void process_commands()
setup_for_endstop_move();
feedrate = homing_feedrate[Z_AXIS];
#ifdef AUTO_BED_COMPENSATION_GRID
#ifdef AUTO_BED_LEVELING_GRID
// probe at the points of a lattice grid
int xGridSpacing = (RIGHT_PROBE_BED_POSITION - LEFT_PROBE_BED_POSITION) / (AUTO_BED_COMPENSATION_GRID_POINTS-1);
int yGridSpacing = (BACK_PROBE_BED_POSITION - FRONT_PROBE_BED_POSITION) / (AUTO_BED_COMPENSATION_GRID_POINTS-1);
int xGridSpacing = (RIGHT_PROBE_BED_POSITION - LEFT_PROBE_BED_POSITION) / (AUTO_BED_LEVELING_GRID_POINTS-1);
int yGridSpacing = (BACK_PROBE_BED_POSITION - FRONT_PROBE_BED_POSITION) / (AUTO_BED_LEVELING_GRID_POINTS-1);
// solve the plane equation ax + by + d = z
@ -1685,9 +1685,9 @@ void process_commands()
// so Vx = -a Vy = -b Vz = 1 (we want the vector facing towards positive Z
// "A" matrix of the linear system of equations
double eqnAMatrix[AUTO_BED_COMPENSATION_GRID_POINTS*AUTO_BED_COMPENSATION_GRID_POINTS*3];
double eqnAMatrix[AUTO_BED_LEVELING_GRID_POINTS*AUTO_BED_LEVELING_GRID_POINTS*3];
// "B" vector of Z points
double eqnBVector[AUTO_BED_COMPENSATION_GRID_POINTS*AUTO_BED_COMPENSATION_GRID_POINTS];
double eqnBVector[AUTO_BED_LEVELING_GRID_POINTS*AUTO_BED_LEVELING_GRID_POINTS];
int probePointCounter = 0;
@ -1710,7 +1710,7 @@ void process_commands()
zig = true;
}
for (int xCount=0; xCount < AUTO_BED_COMPENSATION_GRID_POINTS; xCount++)
for (int xCount=0; xCount < AUTO_BED_LEVELING_GRID_POINTS; xCount++)
{
float z_before;
if (probePointCounter == 0)
@ -1727,9 +1727,9 @@ void process_commands()
eqnBVector[probePointCounter] = measured_z;
eqnAMatrix[probePointCounter + 0*AUTO_BED_COMPENSATION_GRID_POINTS*AUTO_BED_COMPENSATION_GRID_POINTS] = xProbe;
eqnAMatrix[probePointCounter + 1*AUTO_BED_COMPENSATION_GRID_POINTS*AUTO_BED_COMPENSATION_GRID_POINTS] = yProbe;
eqnAMatrix[probePointCounter + 2*AUTO_BED_COMPENSATION_GRID_POINTS*AUTO_BED_COMPENSATION_GRID_POINTS] = 1;
eqnAMatrix[probePointCounter + 0*AUTO_BED_LEVELING_GRID_POINTS*AUTO_BED_LEVELING_GRID_POINTS] = xProbe;
eqnAMatrix[probePointCounter + 1*AUTO_BED_LEVELING_GRID_POINTS*AUTO_BED_LEVELING_GRID_POINTS] = yProbe;
eqnAMatrix[probePointCounter + 2*AUTO_BED_LEVELING_GRID_POINTS*AUTO_BED_LEVELING_GRID_POINTS] = 1;
probePointCounter++;
xProbe += xInc;
}
@ -1737,7 +1737,7 @@ void process_commands()
clean_up_after_endstop_move();
// solve lsq problem
double *plane_equation_coefficients = qr_solve(AUTO_BED_COMPENSATION_GRID_POINTS*AUTO_BED_COMPENSATION_GRID_POINTS, 3, eqnAMatrix, eqnBVector);
double *plane_equation_coefficients = qr_solve(AUTO_BED_LEVELING_GRID_POINTS*AUTO_BED_LEVELING_GRID_POINTS, 3, eqnAMatrix, eqnBVector);
SERIAL_PROTOCOLPGM("Eqn coefficients: a: ");
SERIAL_PROTOCOL(plane_equation_coefficients[0]);
@ -1747,11 +1747,11 @@ void process_commands()
SERIAL_PROTOCOLLN(plane_equation_coefficients[2]);
set_bed_compensation_equation_lsq(plane_equation_coefficients);
set_bed_level_equation_lsq(plane_equation_coefficients);
free(plane_equation_coefficients);
#else // AUTO_BED_COMPENSATION_GRID not defined
#else // AUTO_BED_LEVELING_GRID not defined
// Probe at 3 arbitrary points
// probe 1
@ -1765,21 +1765,21 @@ void process_commands()
clean_up_after_endstop_move();
set_bed_compensation_equation_3pts(z_at_pt_1, z_at_pt_2, z_at_pt_3);
set_bed_level_equation_3pts(z_at_pt_1, z_at_pt_2, z_at_pt_3);
#endif // AUTO_BED_COMPENSATION_GRID
#endif // AUTO_BED_LEVELING_GRID
st_synchronize();
// The following code correct the Z height difference from z-probe position and hotend tip position.
// The Z height on homing is measured by Z-Probe, but the probe is quite far from the hotend.
// When the bed is uneven, this height must be corrected.
real_z = float(st_get_position(Z_AXIS))/axis_steps_per_unit[Z_AXIS]; //get the real Z (since the auto bed compensation is already correcting the plane)
real_z = float(st_get_position(Z_AXIS))/axis_steps_per_unit[Z_AXIS]; //get the real Z (since the auto bed leveling is already correcting the plane)
x_tmp = current_position[X_AXIS] + X_PROBE_OFFSET_FROM_EXTRUDER;
y_tmp = current_position[Y_AXIS] + Y_PROBE_OFFSET_FROM_EXTRUDER;
z_tmp = current_position[Z_AXIS];
apply_rotation_xyz(plan_bed_compensation_matrix, x_tmp, y_tmp, z_tmp); //Apply the correction sending the probe offset
apply_rotation_xyz(plan_bed_level_matrix, x_tmp, y_tmp, z_tmp); //Apply the correction sending the probe offset
current_position[Z_AXIS] = z_tmp - real_z + current_position[Z_AXIS]; //The difference is added to current position and sent to planner.
plan_set_position(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS]);
#ifdef Z_PROBE_SLED
@ -1792,7 +1792,7 @@ void process_commands()
{
engage_z_probe(); // Engage Z Servo endstop if available
st_synchronize();
// TODO: make sure the bed_compensation_rotation_matrix is identity or the planner will get set incorectly
// TODO: make sure the bed_level_rotation_matrix is identity or the planner will get set incorectly
setup_for_endstop_move();
feedrate = homing_feedrate[Z_AXIS];
@ -1819,7 +1819,7 @@ void process_commands()
dock_sled(false);
break;
#endif // Z_PROBE_SLED
#endif // ENABLE_AUTO_BED_COMPENSATION
#endif // ENABLE_AUTO_BED_LEVELING
case 90: // G90
relative_mode = false;
break;
@ -2078,7 +2078,7 @@ void process_commands()
//
// This function assumes the bed has been homed. Specificaly, that a G28 command
// as been issued prior to invoking the M48 Z-Probe repeatability measurement function.
// Any information generated by a prior G29 Bed compensation command will be lost and need to be
// Any information generated by a prior G29 Bed leveling command will be lost and need to be
// regenerated.
//
// The number of samples will default to 10 if not specified. You can use upper or lower case
@ -2086,7 +2086,7 @@ void process_commands()
// N for its communication protocol and will get horribly confused if you send it a capital N.
//
#ifdef ENABLE_AUTO_BED_COMPENSATION
#ifdef ENABLE_AUTO_BED_LEVELING
#ifdef Z_PROBE_REPEATABILITY_TEST
case 48: // M48 Z-Probe repeatability
@ -2164,7 +2164,7 @@ void process_commands()
//
st_synchronize();
plan_bed_compensation_matrix.set_to_identity();
plan_bed_level_matrix.set_to_identity();
plan_buffer_line( X_current, Y_current, Z_start_location,
ext_position,
homing_feedrate[Z_AXIS]/60,
@ -2343,7 +2343,7 @@ Sigma_Exit:
break;
}
#endif // Z_PROBE_REPEATABILITY_TEST
#endif // ENABLE_AUTO_BED_COMPENSATION
#endif // ENABLE_AUTO_BED_LEVELING
case 104: // M104
if(setTargetedHotend(104)){
@ -3104,11 +3104,11 @@ Sigma_Exit:
if (code_seen('S')) {
servo_position = code_value();
if ((servo_index >= 0) && (servo_index < NUM_SERVOS)) {
#if defined (ENABLE_AUTO_BED_COMPENSATION) && (PROBE_SERVO_DEACTIVATION_DELAY > 0)
#if defined (ENABLE_AUTO_BED_LEVELING) && (PROBE_SERVO_DEACTIVATION_DELAY > 0)
servos[servo_index].attach(0);
#endif
servos[servo_index].write(servo_position);
#if defined (ENABLE_AUTO_BED_COMPENSATION) && (PROBE_SERVO_DEACTIVATION_DELAY > 0)
#if defined (ENABLE_AUTO_BED_LEVELING) && (PROBE_SERVO_DEACTIVATION_DELAY > 0)
delay(PROBE_SERVO_DEACTIVATION_DELAY);
servos[servo_index].detach();
#endif
@ -3373,7 +3373,7 @@ Sigma_Exit:
st_synchronize();
}
break;
#if defined(ENABLE_AUTO_BED_COMPENSATION) && defined(SERVO_ENDSTOPS) && not defined(Z_PROBE_SLED)
#if defined(ENABLE_AUTO_BED_LEVELING) && defined(SERVO_ENDSTOPS) && not defined(Z_PROBE_SLED)
case 401:
{
engage_z_probe(); // Engage Z Servo endstop if available

View File

@ -262,7 +262,7 @@ uint8_t Servo::attach(int pin)
uint8_t Servo::attach(int pin, int min, int max)
{
if(this->servoIndex < MAX_SERVOS ) {
#if defined (ENABLE_AUTO_BED_COMPENSATION) && (PROBE_SERVO_DEACTIVATION_DELAY > 0)
#if defined (ENABLE_AUTO_BED_LEVELING) && (PROBE_SERVO_DEACTIVATION_DELAY > 0)
if (pin > 0) this->pin = pin; else pin = this->pin;
#endif
pinMode( pin, OUTPUT) ; // set servo pin to output

View File

@ -123,7 +123,7 @@ public:
int read(); // returns current pulse width as an angle between 0 and 180 degrees
int readMicroseconds(); // returns current pulse width in microseconds for this servo (was read_us() in first release)
bool attached(); // return true if this servo is attached, otherwise false
#if defined (ENABLE_AUTO_BED_COMPENSATION) && (PROBE_SERVO_DEACTIVATION_DELAY > 0)
#if defined (ENABLE_AUTO_BED_LEVELING) && (PROBE_SERVO_DEACTIVATION_DELAY > 0)
int pin; // store the hardware pin of the servo
#endif
private:

View File

@ -75,14 +75,14 @@ float max_e_jerk;
float mintravelfeedrate;
unsigned long axis_steps_per_sqr_second[NUM_AXIS];
#ifdef ENABLE_AUTO_BED_COMPENSATION
// this holds the required transform to compensate for bed compensation
matrix_3x3 plan_bed_compensation_matrix = {
#ifdef ENABLE_AUTO_BED_LEVELING
// this holds the required transform to compensate for bed level
matrix_3x3 plan_bed_level_matrix = {
1.0, 0.0, 0.0,
0.0, 1.0, 0.0,
0.0, 0.0, 1.0,
};
#endif // #ifdef ENABLE_AUTO_BED_COMPENSATION
#endif // #ifdef ENABLE_AUTO_BED_LEVELING
// The current position of the tool in absolute steps
long position[NUM_AXIS]; //rescaled from extern when axis_steps_per_unit are changed by gcode
@ -528,11 +528,11 @@ float junction_deviation = 0.1;
// Add a new linear movement to the buffer. steps_x, _y and _z is the absolute position in
// mm. Microseconds specify how many microseconds the move should take to perform. To aid acceleration
// calculation the caller must also provide the physical length of the line in millimeters.
#ifdef ENABLE_AUTO_BED_COMPENSATION
#ifdef ENABLE_AUTO_BED_LEVELING
void plan_buffer_line(float x, float y, float z, const float &e, float feed_rate, const uint8_t &extruder)
#else
void plan_buffer_line(const float &x, const float &y, const float &z, const float &e, float feed_rate, const uint8_t &extruder)
#endif //ENABLE_AUTO_BED_COMPENSATION
#endif //ENABLE_AUTO_BED_LEVELING
{
// Calculate the buffer head after we push this byte
int next_buffer_head = next_block_index(block_buffer_head);
@ -546,9 +546,9 @@ void plan_buffer_line(const float &x, const float &y, const float &z, const floa
lcd_update();
}
#ifdef ENABLE_AUTO_BED_COMPENSATION
apply_rotation_xyz(plan_bed_compensation_matrix, x, y, z);
#endif // ENABLE_AUTO_BED_COMPENSATION
#ifdef ENABLE_AUTO_BED_LEVELING
apply_rotation_xyz(plan_bed_level_matrix, x, y, z);
#endif // ENABLE_AUTO_BED_LEVELING
// The target position of the tool in absolute steps
// Calculate target position in absolute steps
@ -1021,29 +1021,29 @@ block->steps_y = labs((target[X_AXIS]-position[X_AXIS]) - (target[Y_AXIS]-positi
st_wake_up();
}
#ifdef ENABLE_AUTO_BED_COMPENSATION
#ifdef ENABLE_AUTO_BED_LEVELING
vector_3 plan_get_position() {
vector_3 position = vector_3(st_get_position_mm(X_AXIS), st_get_position_mm(Y_AXIS), st_get_position_mm(Z_AXIS));
//position.debug("in plan_get position");
//plan_bed_compensation_matrix.debug("in plan_get bed_compensation");
matrix_3x3 inverse = matrix_3x3::transpose(plan_bed_compensation_matrix);
//plan_bed_level_matrix.debug("in plan_get bed_level");
matrix_3x3 inverse = matrix_3x3::transpose(plan_bed_level_matrix);
//inverse.debug("in plan_get inverse");
position.apply_rotation(inverse);
//position.debug("after rotation");
return position;
}
#endif // ENABLE_AUTO_BED_COMPENSATION
#endif // ENABLE_AUTO_BED_LEVELING
#ifdef ENABLE_AUTO_BED_COMPENSATION
#ifdef ENABLE_AUTO_BED_LEVELING
void plan_set_position(float x, float y, float z, const float &e)
{
apply_rotation_xyz(plan_bed_compensation_matrix, x, y, z);
apply_rotation_xyz(plan_bed_level_matrix, x, y, z);
#else
void plan_set_position(const float &x, const float &y, const float &z, const float &e)
{
#endif // ENABLE_AUTO_BED_COMPENSATION
#endif // ENABLE_AUTO_BED_LEVELING
position[X_AXIS] = lround(x*axis_steps_per_unit[X_AXIS]);
position[Y_AXIS] = lround(y*axis_steps_per_unit[Y_AXIS]);

View File

@ -26,9 +26,9 @@
#include "Marlin.h"
#ifdef ENABLE_AUTO_BED_COMPENSATION
#ifdef ENABLE_AUTO_BED_LEVELING
#include "vector_3.h"
#endif // ENABLE_AUTO_BED_COMPENSATION
#endif // ENABLE_AUTO_BED_LEVELING
// This struct is used when buffering the setup for each linear movement "nominal" values are as specified in
// the source g-code and may never actually be reached if acceleration management is active.
@ -71,10 +71,10 @@ typedef struct {
volatile char busy;
} block_t;
#ifdef ENABLE_AUTO_BED_COMPENSATION
// this holds the required transform to compensate for bed compensation
extern matrix_3x3 plan_bed_compensation_matrix;
#endif // #ifdef ENABLE_AUTO_BED_COMPENSATION
#ifdef ENABLE_AUTO_BED_LEVELING
// this holds the required transform to compensate for bed level
extern matrix_3x3 plan_bed_level_matrix;
#endif // #ifdef ENABLE_AUTO_BED_LEVELING
// Initialize the motion plan subsystem
void plan_init();
@ -82,21 +82,21 @@ void plan_init();
// Add a new linear movement to the buffer. x, y and z is the signed, absolute target position in
// millimaters. Feed rate specifies the speed of the motion.
#ifdef ENABLE_AUTO_BED_COMPENSATION
#ifdef ENABLE_AUTO_BED_LEVELING
void plan_buffer_line(float x, float y, float z, const float &e, float feed_rate, const uint8_t &extruder);
// Get the position applying the bed compensation matrix if enabled
// Get the position applying the bed level matrix if enabled
vector_3 plan_get_position();
#else
void plan_buffer_line(const float &x, const float &y, const float &z, const float &e, float feed_rate, const uint8_t &extruder);
#endif // ENABLE_AUTO_BED_COMPENSATION
#endif // ENABLE_AUTO_BED_LEVELING
// Set position. Used for G92 instructions.
#ifdef ENABLE_AUTO_BED_COMPENSATION
#ifdef ENABLE_AUTO_BED_LEVELING
void plan_set_position(float x, float y, float z, const float &e);
#else
void plan_set_position(const float &x, const float &y, const float &z, const float &e);
#endif // ENABLE_AUTO_BED_COMPENSATION
#endif // ENABLE_AUTO_BED_LEVELING
void plan_set_e_position(const float &e);

View File

@ -1,6 +1,6 @@
#include "qr_solve.h"
#ifdef AUTO_BED_COMPENSATION_GRID
#ifdef AUTO_BED_LEVELING_GRID
#include <stdlib.h>
#include <math.h>

View File

@ -1,6 +1,6 @@
#include "Configuration.h"
#ifdef AUTO_BED_COMPENSATION_GRID
#ifdef AUTO_BED_LEVELING_GRID
void daxpy ( int n, double da, double dx[], int incx, double dy[], int incy );
double ddot ( int n, double dx[], int incx, double dy[], int incy );

View File

@ -1,5 +1,5 @@
/*
vector_3.cpp - Vector library for bed compensation
vector_3.cpp - Vector library for bed leveling
Copyright (c) 2012 Lars Brubaker. All right reserved.
This library is free software; you can redistribute it and/or
@ -19,7 +19,7 @@
#include <math.h>
#include "Marlin.h"
#ifdef ENABLE_AUTO_BED_COMPENSATION
#ifdef ENABLE_AUTO_BED_LEVELING
#include "vector_3.h"
vector_3::vector_3() : x(0), y(0), z(0) { }
@ -163,5 +163,5 @@ void matrix_3x3::debug(char* title)
}
}
#endif // #ifdef ENABLE_AUTO_BED_COMPENSATION
#endif // #ifdef ENABLE_AUTO_BED_LEVELING

View File

@ -1,5 +1,5 @@
/*
vector_3.cpp - Vector library for bed compensation
vector_3.cpp - Vector library for bed leveling
Copyright (c) 2012 Lars Brubaker. All right reserved.
This library is free software; you can redistribute it and/or
@ -19,7 +19,7 @@
#ifndef VECTOR_3_H
#define VECTOR_3_H
#ifdef ENABLE_AUTO_BED_COMPENSATION
#ifdef ENABLE_AUTO_BED_LEVELING
class matrix_3x3;
struct vector_3
@ -57,6 +57,6 @@ struct matrix_3x3
void apply_rotation_xyz(matrix_3x3 rotationMatrix, float &x, float& y, float& z);
#endif // ENABLE_AUTO_BED_COMPENSATION
#endif // ENABLE_AUTO_BED_LEVELING
#endif // VECTOR_3_H

View File

@ -53,7 +53,7 @@ Features:
* Configurable serial port to support connection of wireless adaptors.
* Automatic operation of extruder/cold-end cooling fans based on nozzle temperature
* RC Servo Support, specify angle or duration for continuous rotation servos.
* Auto Bed Compensation.
* Bed Auto Leveling.
* Support for a filament diameter sensor, which adjusts extrusion volume
The default baudrate is 250000. This baudrate has less jitter and hence errors than the usual 115200 baud, but is less supported by drivers and host-environments.
@ -279,7 +279,7 @@ If all goes well the firmware is uploading
That's ok. Enjoy Silky Smooth Printing.
===============================================
Instructions for configuring Auto Bed Compensation
Instructions for configuring Bed Auto Leveling
===============================================
There are two options for this feature. You may choose to use a servo mounted on the X carriage or you may use a sled that mounts on the X axis and can be docked when not in use.
See the section for each option below for specifics about installation and configuration. Also included are instructions that apply to both options.
@ -295,7 +295,7 @@ If jumping the arduino Vcc do RAMPS 5V rail, take care to not use a power hungry
Instructions for Both Options
-----------------------------
Uncomment the "ENABLE_AUTO_BED_COMPENSATION" define (commented by default)
Uncomment the "ENABLE_AUTO_BED_LEVELING" define (commented by default)
The following options define the probing positions. These are good starting values.
I recommend to keep a better clearance from borders in the first run and then make the probes as close as possible to borders:
@ -391,7 +391,7 @@ For example, suppose you measured the endstop position and it was 20mm to the ri
* \#define Y_PROBE_OFFSET_FROM_EXTRUDER 10
* \#define Z_PROBE_OFFSET_FROM_EXTRUDER 2.75
That's it.. enjoy never having to calibrate your Z endstop neither tramming your bed by hand anymore ;-)
That's it.. enjoy never having to calibrate your Z endstop neither leveling your bed by hand anymore ;-)
Filament Sensor
---------------