Merge pull request #8892 from thinkyhead/bf1_action_on_action

[1.1.x] Fixes for G29 / 3POINT
master
Scott Lahteine 7 years ago committed by GitHub
commit 99f98890c2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -4490,7 +4490,7 @@ void home_all_axes() { gcode_G28(true); }
const uint8_t old_debug_flags = marlin_debug_flags; const uint8_t old_debug_flags = marlin_debug_flags;
if (query) marlin_debug_flags |= DEBUG_LEVELING; if (query) marlin_debug_flags |= DEBUG_LEVELING;
if (DEBUGGING(LEVELING)) { if (DEBUGGING(LEVELING)) {
DEBUG_POS(">>> gcode_G29", current_position); DEBUG_POS(">>> G29", current_position);
log_machine_info(); log_machine_info();
} }
marlin_debug_flags = old_debug_flags; marlin_debug_flags = old_debug_flags;
@ -4552,12 +4552,10 @@ void home_all_axes() { gcode_G28(true); }
abl_grid_points_y = GRID_MAX_POINTS_Y; abl_grid_points_y = GRID_MAX_POINTS_Y;
#endif #endif
#if ENABLED(AUTO_BED_LEVELING_LINEAR) || ENABLED(PROBE_MANUALLY) #if ENABLED(AUTO_BED_LEVELING_LINEAR)
#if ENABLED(AUTO_BED_LEVELING_LINEAR) ABL_VAR int abl2;
ABL_VAR int abl2; #elif ENABLED(PROBE_MANUALLY) // Bilinear
#else // Bilinear int constexpr abl2 = GRID_MAX_POINTS;
int constexpr abl2 = GRID_MAX_POINTS;
#endif
#endif #endif
#if ENABLED(AUTO_BED_LEVELING_BILINEAR) #if ENABLED(AUTO_BED_LEVELING_BILINEAR)
@ -4575,7 +4573,9 @@ void home_all_axes() { gcode_G28(true); }
#elif ENABLED(AUTO_BED_LEVELING_3POINT) #elif ENABLED(AUTO_BED_LEVELING_3POINT)
int constexpr abl2 = 3; #if ENABLED(PROBE_MANUALLY)
int constexpr abl2 = 3; // used to show total points
#endif
// Probe at 3 arbitrary points // Probe at 3 arbitrary points
ABL_VAR vector_3 points[3] = { ABL_VAR vector_3 points[3] = {
@ -4624,7 +4624,7 @@ void home_all_axes() { gcode_G28(true); }
j = parser.byteval('J', -1); j = parser.byteval('J', -1);
if (!isnan(rx) && !isnan(ry)) { if (!isnan(rx) && !isnan(ry)) {
// Get nearest i / j from x / y // Get nearest i / j from rx / ry
i = (rx - bilinear_start[X_AXIS] + 0.5 * xGridSpacing) / xGridSpacing; i = (rx - bilinear_start[X_AXIS] + 0.5 * xGridSpacing) / xGridSpacing;
j = (ry - bilinear_start[Y_AXIS] + 0.5 * yGridSpacing) / yGridSpacing; j = (ry - bilinear_start[Y_AXIS] + 0.5 * yGridSpacing) / yGridSpacing;
i = constrain(i, 0, GRID_MAX_POINTS_X - 1); i = constrain(i, 0, GRID_MAX_POINTS_X - 1);
@ -4637,22 +4637,18 @@ void home_all_axes() { gcode_G28(true); }
bed_level_virt_interpolate(); bed_level_virt_interpolate();
#endif #endif
set_bed_leveling_enabled(abl_should_enable); set_bed_leveling_enabled(abl_should_enable);
report_current_position(); if (abl_should_enable) report_current_position();
} }
return; return;
} // parser.seen('W') } // parser.seen('W')
#endif #endif
#if HAS_LEVELING // Jettison bed leveling data
if (parser.seen('J')) {
// Jettison bed leveling data reset_bed_level();
if (parser.seen('J')) { return;
reset_bed_level(); }
return;
}
#endif
verbose_level = parser.intval('V'); verbose_level = parser.intval('V');
if (!WITHIN(verbose_level, 0, 4)) { if (!WITHIN(verbose_level, 0, 4)) {
@ -4682,6 +4678,7 @@ void home_all_axes() { gcode_G28(true); }
} }
abl2 = abl_grid_points_x * abl_grid_points_y; abl2 = abl_grid_points_x * abl_grid_points_y;
mean = 0;
#elif ENABLED(AUTO_BED_LEVELING_BILINEAR) #elif ENABLED(AUTO_BED_LEVELING_BILINEAR)
@ -4734,8 +4731,9 @@ void home_all_axes() { gcode_G28(true); }
#endif // ABL_GRID #endif // ABL_GRID
if (verbose_level > 0) { if (verbose_level > 0) {
SERIAL_PROTOCOLLNPGM("G29 Auto Bed Leveling"); SERIAL_PROTOCOLPGM("G29 Auto Bed Leveling");
if (dryrun) SERIAL_PROTOCOLLNPGM("Running in DRY-RUN mode"); if (dryrun) SERIAL_PROTOCOLPGM(" (DRYRUN)");
SERIAL_EOL();
} }
stepper.synchronize(); stepper.synchronize();
@ -4744,15 +4742,6 @@ void home_all_axes() { gcode_G28(true); }
// Be formal so G29 can be done successively without G28. // Be formal so G29 can be done successively without G28.
set_bed_leveling_enabled(false); set_bed_leveling_enabled(false);
if (!dryrun) {
// Re-orient the current position without leveling
// based on where the steppers are positioned.
set_current_from_steppers_for_axis(ALL_AXES);
// Sync the planner to where the steppers stopped
SYNC_PLAN_POSITION_KINEMATIC();
}
#if HAS_BED_PROBE #if HAS_BED_PROBE
// Deploy the probe. Probe will raise if needed. // Deploy the probe. Probe will raise if needed.
if (DEPLOY_PROBE()) { if (DEPLOY_PROBE()) {
@ -4934,9 +4923,10 @@ void home_all_axes() { gcode_G28(true); }
#elif ENABLED(AUTO_BED_LEVELING_3POINT) #elif ENABLED(AUTO_BED_LEVELING_3POINT)
// Probe at 3 arbitrary points // Probe at 3 arbitrary points
if (abl_probe_index < 3) { if (abl_probe_index < abl2) {
xProbe = points[abl_probe_index].x; xProbe = points[abl_probe_index].x;
yProbe = points[abl_probe_index].y; yProbe = points[abl_probe_index].y;
_manual_goto_xy(xProbe, yProbe);
#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
@ -4974,6 +4964,8 @@ void home_all_axes() { gcode_G28(true); }
{ {
const bool stow_probe_after_each = parser.boolval('E'); const bool stow_probe_after_each = parser.boolval('E');
measured_z = 0;
#if ABL_GRID #if ABL_GRID
bool zig = PR_OUTER_END & 1; // Always end at RIGHT and BACK_PROBE_BED_POSITION bool zig = PR_OUTER_END & 1; // Always end at RIGHT and BACK_PROBE_BED_POSITION
@ -5307,7 +5299,7 @@ void home_all_axes() { gcode_G28(true); }
if (!faux) clean_up_after_endstop_or_probe_move(); if (!faux) clean_up_after_endstop_or_probe_move();
#if ENABLED(DEBUG_LEVELING_FEATURE) #if ENABLED(DEBUG_LEVELING_FEATURE)
if (DEBUGGING(LEVELING)) SERIAL_ECHOLNPGM("<<< gcode_G29"); if (DEBUGGING(LEVELING)) SERIAL_ECHOLNPGM("<<< G29");
#endif #endif
report_current_position(); report_current_position();
@ -9638,7 +9630,7 @@ void quickstop_stepper() {
#if ENABLED(EEPROM_SETTINGS) #if ENABLED(EEPROM_SETTINGS)
const int8_t storage_slot = parser.has_value() ? parser.value_int() : ubl.storage_slot; const int8_t storage_slot = parser.has_value() ? parser.value_int() : ubl.storage_slot;
const uint16_t a = settings.calc_num_meshes(); const int16_t a = settings.calc_num_meshes();
if (!a) { if (!a) {
SERIAL_PROTOCOLLNPGM("?EEPROM storage not available."); SERIAL_PROTOCOLLNPGM("?EEPROM storage not available.");

@ -608,7 +608,7 @@
if (parser.seen('L')) { // Load Current Mesh Data if (parser.seen('L')) { // Load Current Mesh Data
g29_storage_slot = parser.has_value() ? parser.value_int() : storage_slot; g29_storage_slot = parser.has_value() ? parser.value_int() : storage_slot;
uint16_t a = settings.calc_num_meshes(); int16_t a = settings.calc_num_meshes();
if (!a) { if (!a) {
SERIAL_PROTOCOLLNPGM("?EEPROM storage not available."); SERIAL_PROTOCOLLNPGM("?EEPROM storage not available.");
@ -650,7 +650,7 @@
return; return;
} }
uint16_t a = settings.calc_num_meshes(); int16_t a = settings.calc_num_meshes();
if (!a) { if (!a) {
SERIAL_PROTOCOLLNPGM("?EEPROM storage not available."); SERIAL_PROTOCOLLNPGM("?EEPROM storage not available.");
@ -1327,7 +1327,7 @@
* use cases for the users. So we can wait and see what to do with it. * use cases for the users. So we can wait and see what to do with it.
*/ */
void unified_bed_leveling::g29_compare_current_mesh_to_stored_mesh() { void unified_bed_leveling::g29_compare_current_mesh_to_stored_mesh() {
uint16_t a = settings.calc_num_meshes(); int16_t a = settings.calc_num_meshes();
if (!a) { if (!a) {
SERIAL_PROTOCOLLNPGM("?EEPROM storage not available."); SERIAL_PROTOCOLLNPGM("?EEPROM storage not available.");

@ -2279,7 +2279,7 @@ void kill_screen(const char* lcd_msg) {
* Save Bed Mesh * Save Bed Mesh
*/ */
void _lcd_ubl_storage_mesh() { void _lcd_ubl_storage_mesh() {
uint16_t a = settings.calc_num_meshes(); int16_t a = settings.calc_num_meshes();
START_MENU(); START_MENU();
MENU_BACK(MSG_UBL_LEVEL_BED); MENU_BACK(MSG_UBL_LEVEL_BED);
if (!WITHIN(ubl_storage_slot, 0, a - 1)) { if (!WITHIN(ubl_storage_slot, 0, a - 1)) {

Loading…
Cancel
Save