Merge branch 'Development' into dev_version

Latest upstream commits
2.0.x
Scott Lahteine 10 years ago
commit 7431ef7e2d

@ -7,7 +7,7 @@ Background
This mesh based method of leveling/compensating can compensate for an non-flat bed. There are various opinions about doing this. It was primarily written to compensate a RigidBot BIG bed (40x30cm) that was somewhat bent.
Currently there is no automatic way to probe the bed like the Auto Bed Leveling feature. This might soon be implemented though, stay tuned.
Currently there is no automatic way to probe the bed like the Auto Bed Leveling feature. So, you can not enable `ENABLE_AUTO_BED_LEVELING` at the same time. This might soon be implemented though, stay tuned.
Theory
------
@ -28,6 +28,10 @@ In `Configuration.h` there are two options that can be enabled.
There are also some values that can be set.
The following will set the step distance used when manually turning the display encoder. Default is 0.025
`MBL_Z_STEP`
Following four define the area to cover. Default 10mm from max bed size
`MESH_MIN_X`<br/>
@ -55,14 +59,14 @@ When selecting this option the printer will first do a homing, and then travel t
If the EEPROM has been enable it can be good to issue a `M500` to get these points saved.
Issuing a `G29` will return the state of the mesh leveling.
Issuing a `G29` will return the state of the mesh leveling and report the probed points.
Probing the bed with G-codes
----------------------------
Probing the bed by G-codes follows the sequence much like doing it with the display.
`G29` or `G29 S0` will return the state bed leveling.
`G29` or `G29 S0` will return the state of the bed leveling and report the probed points. Where X=1 Y=1 is the top-left value and X=MESH_NUM_X_POINTS Y=MESH_NUM_Y_POINTS is bottom-right value. X per column and Y per row.
`G29 S1` will initiate the bed leveling, homing and traveling to the first point to probe.
@ -70,6 +74,8 @@ Then use your preferred Printer controller program, i.e. Printrun, to lower the
`G29 S2` will store the point and travel to the next point until last point has been probed.
`G29 S3 Xn Yn Zn.nn` will modify a single probed point. This can be used to tweak a badly probed point. Specify probe point where `Xn` and `Yn`, where `n` in `Xn` is between 1 and `MESH_NUM_X_POINTS`. Likewise for `Yn`. `Zn.nn` is the new Z value in that probed point.
Note
----

@ -426,6 +426,10 @@ const bool Z_PROBE_ENDSTOP_INVERTING = false; // set to true to invert the logic
// #define MANUAL_BED_LEVELING // Add display menu option for bed leveling
// #define MESH_BED_LEVELING // Enable mesh bed leveling
#ifdef MANUAL_BED_LEVELING
#define MBL_Z_STEP 0.025 // Step size while manually probing Z axis
#endif // MANUAL_BED_LEVELING
#ifdef MESH_BED_LEVELING
#define MESH_MIN_X 10
#define MESH_MAX_X (X_MAX_POS - MESH_MIN_X)

@ -2013,7 +2013,7 @@ inline void gcode_G28() {
#ifdef MESH_BED_LEVELING
enum MeshLevelingState { MeshReport, MeshStart, MeshNext };
enum MeshLevelingState { MeshReport, MeshStart, MeshNext, MeshSet };
/**
* G29: Mesh-based Z-Probe, probes a grid and produces a
@ -2021,20 +2021,31 @@ inline void gcode_G28() {
*
* Parameters With MESH_BED_LEVELING:
*
* S0 Produce a mesh report
* S1 Start probing mesh points
* S2 Probe the next mesh point
* S0 Produce a mesh report
* S1 Start probing mesh points
* S2 Probe the next mesh point
* S3 Xn Yn Zn.nn Manually modify a single point
*
* The S0 report the points as below
*
* +----> X-axis
* |
* |
* v Y-axis
*
*/
inline void gcode_G29() {
static int probe_point = -1;
MeshLevelingState state = code_seen('S') || code_seen('s') ? (MeshLevelingState)code_value_short() : MeshReport;
if (state < 0 || state > 2) {
SERIAL_PROTOCOLLNPGM("S out of range (0-2).");
if (state < 0 || state > 3) {
SERIAL_PROTOCOLLNPGM("S out of range (0-3).");
return;
}
int ix, iy;
float z;
switch(state) {
case MeshReport:
if (mbl.active) {
@ -2068,7 +2079,6 @@ inline void gcode_G28() {
SERIAL_PROTOCOLLNPGM("Start mesh probing with \"G29 S1\" first.");
return;
}
int ix, iy;
if (probe_point == 0) {
// Set Z to a positive value before recording the first Z.
current_position[Z_AXIS] = MESH_HOME_SEARCH_Z;
@ -2102,6 +2112,36 @@ inline void gcode_G28() {
mbl.active = 1;
enquecommands_P(PSTR("G28"));
}
break;
case MeshSet:
if (code_seen('X') || code_seen('x')) {
ix = code_value_long()-1;
if (ix < 0 || ix >= MESH_NUM_X_POINTS) {
SERIAL_PROTOCOLPGM("X out of range (1-" STRINGIFY(MESH_NUM_X_POINTS) ").\n");
return;
}
} else {
SERIAL_PROTOCOLPGM("X not entered.\n");
return;
}
if (code_seen('Y') || code_seen('y')) {
iy = code_value_long()-1;
if (iy < 0 || iy >= MESH_NUM_Y_POINTS) {
SERIAL_PROTOCOLPGM("Y out of range (1-" STRINGIFY(MESH_NUM_Y_POINTS) ").\n");
return;
}
} else {
SERIAL_PROTOCOLPGM("Y not entered.\n");
return;
}
if (code_seen('Z') || code_seen('z')) {
z = code_value();
} else {
SERIAL_PROTOCOLPGM("Z not entered.\n");
return;
}
mbl.z_values[iy][ix] = z;
} // switch(state)
}

@ -91,6 +91,18 @@
#error You must enable either DISPLAY_CHARSET_HD44780_JAPAN or DISPLAY_CHARSET_HD44780_WESTERN for your LCD controller.
#endif
/**
* Mesh Bed Leveling
*/
#ifdef MESH_BED_LEVELING
#ifdef DELTA
#error MESH_BED_LEVELING does not yet support DELTA printers
#endif
#ifdef ENABLE_AUTO_BED_LEVELING
#error Select ENABLE_AUTO_BED_LEVELING or MESH_BED_LEVELING, not both
#endif
#endif
/**
* Auto Bed Leveling
*/

@ -426,6 +426,10 @@ const bool Z_PROBE_ENDSTOP_INVERTING = false; // set to true to invert the logic
// #define MANUAL_BED_LEVELING // Add display menu option for bed leveling
// #define MESH_BED_LEVELING // Enable mesh bed leveling
#ifdef MANUAL_BED_LEVELING
#define MBL_Z_STEP 0.025
#endif // MANUAL_BED_LEVELING
#ifdef MESH_BED_LEVELING
#define MESH_MIN_X 10
#define MESH_MAX_X (X_MAX_POS - MESH_MIN_X)

@ -364,6 +364,10 @@ const bool Z_MAX_ENDSTOP_INVERTING = true; // set to true to invert the logic of
// #define MANUAL_BED_LEVELING // Add display menu option for bed leveling
// #define MESH_BED_LEVELING // Enable mesh bed leveling
#ifdef MANUAL_BED_LEVELING
#define MBL_Z_STEP 0.025
#endif // MANUAL_BED_LEVELING
#ifdef MESH_BED_LEVELING
#define MESH_MIN_X 10
#define MESH_MAX_X (X_MAX_POS - MESH_MIN_X)

@ -387,6 +387,10 @@ const bool Z_MAX_ENDSTOP_INVERTING = true; // set to true to invert the logic of
// #define MANUAL_BED_LEVELING // Add display menu option for bed leveling
// #define MESH_BED_LEVELING // Enable mesh bed leveling
#ifdef MANUAL_BED_LEVELING
#define MBL_Z_STEP 0.025
#endif // MANUAL_BED_LEVELING
#ifdef MESH_BED_LEVELING
#define MESH_MIN_X 10
#define MESH_MAX_X (X_MAX_POS - MESH_MIN_X)

@ -392,6 +392,10 @@ const bool Z_MAX_ENDSTOP_INVERTING = true; // set to true to invert the logic of
// #define MANUAL_BED_LEVELING // Add display menu option for bed leveling
// #define MESH_BED_LEVELING // Enable mesh bed leveling
#ifdef MANUAL_BED_LEVELING
#define MBL_Z_STEP 0.025
#endif // MANUAL_BED_LEVELING
#ifdef MESH_BED_LEVELING
#define MESH_MIN_X 10
#define MESH_MAX_X (X_MAX_POS - MESH_MIN_X)

@ -416,6 +416,10 @@ const bool Z_MAX_ENDSTOP_INVERTING = true; // set to true to invert the logic of
// #define MANUAL_BED_LEVELING // Add display menu option for bed leveling
// #define MESH_BED_LEVELING // Enable mesh bed leveling
#ifdef MANUAL_BED_LEVELING
#define MBL_Z_STEP 0.025
#endif // MANUAL_BED_LEVELING
#ifdef MESH_BED_LEVELING
#define MESH_MIN_X 10
#define MESH_MAX_X (X_MAX_POS - MESH_MIN_X)

@ -386,6 +386,10 @@ const bool Z_MAX_ENDSTOP_INVERTING = true; // set to true to invert the logic of
// #define MANUAL_BED_LEVELING // Add display menu option for bed leveling
// #define MESH_BED_LEVELING // Enable mesh bed leveling
#ifdef MANUAL_BED_LEVELING
#define MBL_Z_STEP 0.025
#endif // MANUAL_BED_LEVELING
#ifdef MESH_BED_LEVELING
#define MESH_MIN_X 10
#define MESH_MAX_X (X_MAX_POS - MESH_MIN_X)

@ -414,6 +414,10 @@ const bool Z_MAX_ENDSTOP_INVERTING = true; // set to true to invert the logic of
// #define MANUAL_BED_LEVELING // Add display menu option for bed leveling
// #define MESH_BED_LEVELING // Enable mesh bed leveling
#ifdef MANUAL_BED_LEVELING
#define MBL_Z_STEP 0.025
#endif // MANUAL_BED_LEVELING
#ifdef MESH_BED_LEVELING
#define MESH_MIN_X 10
#define MESH_MAX_X (X_MAX_POS - MESH_MIN_X)

@ -414,6 +414,10 @@ const bool Z_MAX_ENDSTOP_INVERTING = false; // set to true to invert the logic o
// #define MANUAL_BED_LEVELING // Add display menu option for bed leveling
// #define MESH_BED_LEVELING // Enable mesh bed leveling
#ifdef MANUAL_BED_LEVELING
#define MBL_Z_STEP 0.025
#endif // MANUAL_BED_LEVELING
#ifdef MESH_BED_LEVELING
#define MESH_MIN_X 10
#define MESH_MAX_X (X_MAX_POS - MESH_MIN_X)

@ -384,6 +384,10 @@ const bool Z_MAX_ENDSTOP_INVERTING = true; // set to true to invert the logic of
// #define MANUAL_BED_LEVELING // Add display menu option for bed leveling
// #define MESH_BED_LEVELING // Enable mesh bed leveling
#ifdef MANUAL_BED_LEVELING
#define MBL_Z_STEP 0.025
#endif // MANUAL_BED_LEVELING
#ifdef MESH_BED_LEVELING
#define MESH_MIN_X 10
#define MESH_MAX_X (X_MAX_POS - MESH_MIN_X)

@ -386,6 +386,10 @@ const bool Z_MAX_ENDSTOP_INVERTING = true; // set to true to invert the logic of
// #define MANUAL_BED_LEVELING // Add display menu option for bed leveling
// #define MESH_BED_LEVELING // Enable mesh bed leveling
#ifdef MANUAL_BED_LEVELING
#define MBL_Z_STEP 0.025
#endif // MANUAL_BED_LEVELING
#ifdef MESH_BED_LEVELING
#define MESH_MIN_X 10
#define MESH_MAX_X (X_MAX_POS - MESH_MIN_X)

@ -511,12 +511,14 @@ float junction_deviation = 0.1;
if (de) {
if (degHotend(active_extruder) < extrude_min_temp) {
position[E_AXIS] = target[E_AXIS]; //behave as if the move really took place, but ignore E part
de = 0; // no difference
SERIAL_ECHO_START;
SERIAL_ECHOLNPGM(MSG_ERR_COLD_EXTRUDE_STOP);
}
#ifdef PREVENT_LENGTHY_EXTRUDE
if (labs(de) > axis_steps_per_unit[E_AXIS] * EXTRUDE_MAXLENGTH) {
position[E_AXIS] = target[E_AXIS]; // Behave as if the move really took place, but ignore E part
de = 0; // no difference
SERIAL_ECHO_START;
SERIAL_ECHOLNPGM(MSG_ERR_LONG_EXTRUDE_STOP);
}

@ -1161,7 +1161,9 @@ static void lcd_quick_feedback() {
delayMicroseconds(delay);
WRITE(BEEPER,LOW);
delayMicroseconds(delay);
}
}
const int j = max(10000 - LCD_FEEDBACK_FREQUENCY_DURATION_MS * 1000, 0);
if (j) delayMicroseconds(j);
#endif
}
@ -1802,20 +1804,23 @@ static void _lcd_level_bed()
{
if (encoderPosition != 0) {
refresh_cmd_timeout();
current_position[Z_AXIS] += float((int)encoderPosition) * 0.05;
current_position[Z_AXIS] += float((int)encoderPosition) * MBL_Z_STEP;
if (min_software_endstops && current_position[Z_AXIS] < Z_MIN_POS) current_position[Z_AXIS] = Z_MIN_POS;
if (max_software_endstops && current_position[Z_AXIS] > Z_MAX_POS) current_position[Z_AXIS] = Z_MAX_POS;
encoderPosition = 0;
plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS], manual_feedrate[Z_AXIS]/60, active_extruder);
lcdDrawUpdate = 1;
}
if (lcdDrawUpdate) lcd_implementation_drawedit(PSTR("Z"), ftostr32(current_position[Z_AXIS]));
if (lcdDrawUpdate) lcd_implementation_drawedit(PSTR("Z"), ftostr43(current_position[Z_AXIS]));
static bool debounce_click = false;
if (LCD_CLICKED) {
if (!debounce_click) {
debounce_click = true;
int ix = _lcd_level_bed_position % MESH_NUM_X_POINTS;
int iy = _lcd_level_bed_position / MESH_NUM_X_POINTS;
if (iy&1) { // Zig zag
ix = (MESH_NUM_X_POINTS - 1) - ix;
}
mbl.set_z(ix, iy, current_position[Z_AXIS]);
_lcd_level_bed_position++;
if (_lcd_level_bed_position == MESH_NUM_X_POINTS*MESH_NUM_Y_POINTS) {

@ -31,7 +31,7 @@ We are actively looking for testers. So please try the current development versi
## Contact
__Google Hangout:__ <a href="https://plus.google.com/hangouts/_/g2wp5duzb2y6ahikg6tmwao3kua" target="_blank">Hagnout</a>
__Google Hangout:__ <a href="https://plus.google.com/hangouts/_/g2wp5duzb2y6ahikg6tmwao3kua" target="_blank">Hangout</a>
## Credits

Loading…
Cancel
Save