Merge pull request #6858 from thinkyhead/bf_leveling_patch

Fixes for PROBE_MANUALLY and LCD_BED_LEVELING
This commit is contained in:
Scott Lahteine 2017-05-26 12:13:43 -05:00 committed by GitHub
commit 73ed0c63b4
4 changed files with 472 additions and 496 deletions

1
.gitignore vendored
View File

@ -52,6 +52,7 @@ tags
*.lo *.lo
*.o *.o
*.obj *.obj
*.ino.cpp
# Precompiled Headers # Precompiled Headers
*.gch *.gch

View File

@ -3800,6 +3800,10 @@ void home_all_axes() { gcode_G28(true); }
#if ENABLED(MESH_BED_LEVELING) || ENABLED(PROBE_MANUALLY) #if ENABLED(MESH_BED_LEVELING) || ENABLED(PROBE_MANUALLY)
#if ENABLED(PROBE_MANUALLY) && ENABLED(LCD_BED_LEVELING)
extern bool lcd_wait_for_move;
#endif
inline void _manual_goto_xy(const float &x, const float &y) { inline void _manual_goto_xy(const float &x, const float &y) {
const float old_feedrate_mm_s = feedrate_mm_s; const float old_feedrate_mm_s = feedrate_mm_s;
@ -3822,6 +3826,10 @@ void home_all_axes() { gcode_G28(true); }
feedrate_mm_s = old_feedrate_mm_s; feedrate_mm_s = old_feedrate_mm_s;
stepper.synchronize(); stepper.synchronize();
#if ENABLED(PROBE_MANUALLY) && ENABLED(LCD_BED_LEVELING)
lcd_wait_for_move = false;
#endif
} }
#endif #endif
@ -4190,7 +4198,7 @@ void home_all_axes() { gcode_G28(true); }
if (!g29_in_progress) { if (!g29_in_progress) {
#if ENABLED(PROBE_MANUALLY) || ENABLED(AUTO_BED_LEVELING_LINEAR) #if ENABLED(PROBE_MANUALLY) || ENABLED(AUTO_BED_LEVELING_LINEAR)
abl_probe_index = 0; abl_probe_index = -1;
#endif #endif
abl_should_enable = planner.abl_enabled; abl_should_enable = planner.abl_enabled;
@ -4397,30 +4405,40 @@ void home_all_axes() { gcode_G28(true); }
#if ENABLED(PROBE_MANUALLY) #if ENABLED(PROBE_MANUALLY)
const bool seenA = parser.seen('A'), seenQ = parser.seen('Q');
// For manual probing, get the next index to probe now.
// On the first probe this will be incremented to 0.
if (!seenA && !seenQ) {
++abl_probe_index;
g29_in_progress = true;
}
// Abort current G29 procedure, go back to ABLStart // Abort current G29 procedure, go back to ABLStart
if (parser.seen('A') && g29_in_progress) { if (seenA && g29_in_progress) {
SERIAL_PROTOCOLLNPGM("Manual G29 aborted"); SERIAL_PROTOCOLLNPGM("Manual G29 aborted");
#if HAS_SOFTWARE_ENDSTOPS #if HAS_SOFTWARE_ENDSTOPS
soft_endstops_enabled = enable_soft_endstops; soft_endstops_enabled = enable_soft_endstops;
#endif #endif
planner.abl_enabled = abl_should_enable; planner.abl_enabled = abl_should_enable;
g29_in_progress = false; g29_in_progress = false;
#if ENABLED(LCD_BED_LEVELING)
lcd_wait_for_move = false;
#endif
} }
// Query G29 status // Query G29 status
if (parser.seen('Q')) { if (verbose_level || seenQ) {
if (!g29_in_progress) SERIAL_PROTOCOLPGM("Manual G29 ");
SERIAL_PROTOCOLLNPGM("Manual G29 idle"); if (g29_in_progress) {
else { SERIAL_PROTOCOLPAIR("point ", abl_probe_index + 1);
SERIAL_PROTOCOLPAIR("Manual G29 point ", abl_probe_index + 1);
SERIAL_PROTOCOLLNPAIR(" of ", abl2); SERIAL_PROTOCOLLNPAIR(" of ", abl2);
} }
else
SERIAL_PROTOCOLLNPGM("idle");
} }
if (parser.seen('A') || parser.seen('Q')) return; if (seenA || seenQ) return;
// Fall through to probe the first point
g29_in_progress = true;
if (abl_probe_index == 0) { if (abl_probe_index == 0) {
// For the initial G29 save software endstop state // For the initial G29 save software endstop state
@ -4458,20 +4476,20 @@ void home_all_axes() { gcode_G28(true); }
#if ABL_GRID #if ABL_GRID
// Find a next point to probe // Skip any unreachable points
// On the first G29 this will be the first probe point
while (abl_probe_index < abl2) { while (abl_probe_index < abl2) {
// Set xCount, yCount based on abl_probe_index, with zig-zag // Set xCount, yCount based on abl_probe_index, with zig-zag
PR_OUTER_VAR = abl_probe_index / PR_INNER_END; PR_OUTER_VAR = abl_probe_index / PR_INNER_END;
PR_INNER_VAR = abl_probe_index - (PR_OUTER_VAR * PR_INNER_END); PR_INNER_VAR = abl_probe_index - (PR_OUTER_VAR * PR_INNER_END);
bool zig = (PR_OUTER_VAR & 1) != ((PR_OUTER_END) & 1); // Probe in reverse order for every other row/column
bool zig = (PR_OUTER_VAR & 1); // != ((PR_OUTER_END) & 1);
if (zig) PR_INNER_VAR = (PR_INNER_END - 1) - PR_INNER_VAR; if (zig) PR_INNER_VAR = (PR_INNER_END - 1) - PR_INNER_VAR;
const float xBase = left_probe_bed_position + xGridSpacing * xCount, const float xBase = xCount * xGridSpacing + left_probe_bed_position,
yBase = front_probe_bed_position + yGridSpacing * yCount; yBase = yCount * yGridSpacing + front_probe_bed_position;
xProbe = floor(xBase + (xBase < 0 ? 0 : 0.5)); xProbe = floor(xBase + (xBase < 0 ? 0 : 0.5));
yProbe = floor(yBase + (yBase < 0 ? 0 : 0.5)); yProbe = floor(yBase + (yBase < 0 ? 0 : 0.5));
@ -4488,7 +4506,6 @@ void home_all_axes() { gcode_G28(true); }
// Is there a next point to move to? // Is there a next point to move to?
if (abl_probe_index < abl2) { if (abl_probe_index < abl2) {
_manual_goto_xy(xProbe, yProbe); // Can be used here too! _manual_goto_xy(xProbe, yProbe); // Can be used here too!
++abl_probe_index;
#if HAS_SOFTWARE_ENDSTOPS #if HAS_SOFTWARE_ENDSTOPS
// Disable software endstops to allow manual adjustment // Disable software endstops to allow manual adjustment
// If G29 is not completed, they will not be re-enabled // If G29 is not completed, they will not be re-enabled
@ -4497,10 +4514,9 @@ void home_all_axes() { gcode_G28(true); }
return; return;
} }
else { else {
// Then leveling is done!
// G29 finishing code goes here
// After recording the last point, activate abl // Leveling done! Fall through to G29 finishing code below
SERIAL_PROTOCOLLNPGM("Grid probing done."); SERIAL_PROTOCOLLNPGM("Grid probing done.");
g29_in_progress = false; g29_in_progress = false;
@ -4514,9 +4530,8 @@ void home_all_axes() { gcode_G28(true); }
// Probe at 3 arbitrary points // Probe at 3 arbitrary points
if (abl_probe_index < 3) { if (abl_probe_index < 3) {
xProbe = LOGICAL_X_POSITION(points[i].x); xProbe = LOGICAL_X_POSITION(points[abl_probe_index].x);
yProbe = LOGICAL_Y_POSITION(points[i].y); yProbe = LOGICAL_Y_POSITION(points[abl_probe_index].y);
++abl_probe_index;
#if HAS_SOFTWARE_ENDSTOPS #if HAS_SOFTWARE_ENDSTOPS
// Disable software endstops to allow manual adjustment // Disable software endstops to allow manual adjustment
// If G29 is not completed, they will not be re-enabled // If G29 is not completed, they will not be re-enabled
@ -4587,7 +4602,7 @@ void home_all_axes() { gcode_G28(true); }
yProbe = floor(yBase + (yBase < 0 ? 0 : 0.5)); yProbe = floor(yBase + (yBase < 0 ? 0 : 0.5));
#if ENABLED(AUTO_BED_LEVELING_LINEAR) #if ENABLED(AUTO_BED_LEVELING_LINEAR)
indexIntoAB[xCount][yCount] = ++abl_probe_index; indexIntoAB[xCount][yCount] = ++abl_probe_index; // 0...
#endif #endif
#if IS_KINEMATIC #if IS_KINEMATIC
@ -4665,7 +4680,10 @@ void home_all_axes() { gcode_G28(true); }
// G29 Finishing Code // G29 Finishing Code
// //
// Unless this is a dry run, auto bed leveling will // Unless this is a dry run, auto bed leveling will
// definitely be enabled after this point // definitely be enabled after this point.
//
// If code above wants to continue leveling, it should
// return or loop before this point.
// //
// Restore state after probing // Restore state after probing
@ -4675,6 +4693,10 @@ void home_all_axes() { gcode_G28(true); }
if (DEBUGGING(LEVELING)) DEBUG_POS("> probing complete", current_position); if (DEBUGGING(LEVELING)) DEBUG_POS("> probing complete", current_position);
#endif #endif
#if ENABLED(PROBE_MANUALLY) && ENABLED(LCD_BED_LEVELING)
lcd_wait_for_move = false;
#endif
// Calculate leveling, print reports, correct the position // Calculate leveling, print reports, correct the position
#if ENABLED(AUTO_BED_LEVELING_BILINEAR) #if ENABLED(AUTO_BED_LEVELING_BILINEAR)

View File

@ -1344,9 +1344,8 @@ void MarlinSettings::reset() {
#else #else
#define LINEAR_UNIT(N) N #define LINEAR_UNIT(N) N
#define VOLUMETRIC_UNIT(N) N #define VOLUMETRIC_UNIT(N) N
SERIAL_ECHOLNPGM(" G21 ; Units in mm\n"); SERIAL_ECHOLNPGM(" G21 ; Units in mm");
#endif #endif
SERIAL_EOL;
#if ENABLED(ULTIPANEL) #if ENABLED(ULTIPANEL)
@ -1361,12 +1360,13 @@ void MarlinSettings::reset() {
serialprintPGM(parser.temp_units_name()); serialprintPGM(parser.temp_units_name());
#else #else
#define TEMP_UNIT(N) N #define TEMP_UNIT(N) N
SERIAL_ECHOLNPGM(" M149 C ; Units in Celsius\n"); SERIAL_ECHOLNPGM(" M149 C ; Units in Celsius");
#endif #endif
SERIAL_EOL;
#endif #endif
SERIAL_EOL;
/** /**
* Volumetric extrusion M200 * Volumetric extrusion M200
*/ */

887
Marlin/ultralcd.cpp Normal file → Executable file

File diff suppressed because it is too large Load Diff