Merge pull request #2061 from thinkyhead/wait_before_g28

Always do st_synchronize() before G28
master
Scott Lahteine 10 years ago
commit 9ba8cf5fe3

@ -21,6 +21,10 @@
#include "fastio.h" #include "fastio.h"
#include "Configuration.h" #include "Configuration.h"
#ifndef SANITYCHECK_H
#error Your Configuration.h and Configuration_adv.h files are outdated!
#endif
#if (ARDUINO >= 100) #if (ARDUINO >= 100)
#include "Arduino.h" #include "Arduino.h"
#else #else

@ -1096,6 +1096,14 @@ inline void sync_plan_position() {
inline void set_current_to_destination() { memcpy(current_position, destination, sizeof(current_position)); } inline void set_current_to_destination() { memcpy(current_position, destination, sizeof(current_position)); }
inline void set_destination_to_current() { memcpy(destination, current_position, sizeof(destination)); } inline void set_destination_to_current() { memcpy(destination, current_position, sizeof(destination)); }
static void setup_for_endstop_move() {
saved_feedrate = feedrate;
saved_feedrate_multiplier = feedrate_multiplier;
feedrate_multiplier = 100;
refresh_cmd_timeout();
enable_endstops(true);
}
#ifdef ENABLE_AUTO_BED_LEVELING #ifdef ENABLE_AUTO_BED_LEVELING
#ifdef DELTA #ifdef DELTA
@ -1256,14 +1264,6 @@ inline void set_destination_to_current() { memcpy(destination, current_position,
feedrate = oldFeedRate; feedrate = oldFeedRate;
} }
static void setup_for_endstop_move() {
saved_feedrate = feedrate;
saved_feedrate_multiplier = feedrate_multiplier;
feedrate_multiplier = 100;
refresh_cmd_timeout();
enable_endstops(true);
}
static void clean_up_after_endstop_move() { static void clean_up_after_endstop_move() {
#ifdef ENDSTOPS_ONLY_FOR_HOMING #ifdef ENDSTOPS_ONLY_FOR_HOMING
enable_endstops(false); enable_endstops(false);
@ -1845,6 +1845,9 @@ inline void gcode_G4() {
*/ */
inline void gcode_G28() { inline void gcode_G28() {
// Wait for planner moves to finish!
st_synchronize();
// For auto bed leveling, clear the level matrix // For auto bed leveling, clear the level matrix
#ifdef ENABLE_AUTO_BED_LEVELING #ifdef ENABLE_AUTO_BED_LEVELING
plan_bed_level_matrix.set_to_identity(); plan_bed_level_matrix.set_to_identity();
@ -1859,12 +1862,7 @@ inline void gcode_G28() {
mbl.active = 0; mbl.active = 0;
#endif #endif
saved_feedrate = feedrate; setup_for_endstop_move();
saved_feedrate_multiplier = feedrate_multiplier;
feedrate_multiplier = 100;
refresh_cmd_timeout();
enable_endstops(true);
set_destination_to_current(); set_destination_to_current();
@ -3150,8 +3148,6 @@ inline void gcode_M42() {
clean_up_after_endstop_move(); clean_up_after_endstop_move();
// enable_endstops(true);
if (verbose_level > 0) { if (verbose_level > 0) {
SERIAL_PROTOCOLPGM("Mean: "); SERIAL_PROTOCOLPGM("Mean: ");
SERIAL_PROTOCOL_F(mean, 6); SERIAL_PROTOCOL_F(mean, 6);
@ -5739,25 +5735,22 @@ void mesh_plan_buffer_line(float x, float y, float z, const float e, float feed_
#ifdef PREVENT_DANGEROUS_EXTRUDE #ifdef PREVENT_DANGEROUS_EXTRUDE
inline float prevent_dangerous_extrude(float &curr_e, float &dest_e) { inline void prevent_dangerous_extrude(float &curr_e, float &dest_e) {
float de = dest_e - curr_e; float de = dest_e - curr_e;
if (de) { if (de) {
if (degHotend(active_extruder) < extrude_min_temp) { if (degHotend(active_extruder) < extrude_min_temp) {
curr_e = dest_e; // Behave as if the move really took place, but ignore E part curr_e = dest_e; // Behave as if the move really took place, but ignore E part
SERIAL_ECHO_START; SERIAL_ECHO_START;
SERIAL_ECHOLNPGM(MSG_ERR_COLD_EXTRUDE_STOP); SERIAL_ECHOLNPGM(MSG_ERR_COLD_EXTRUDE_STOP);
return 0;
} }
#ifdef PREVENT_LENGTHY_EXTRUDE #ifdef PREVENT_LENGTHY_EXTRUDE
if (labs(de) > EXTRUDE_MAXLENGTH) { if (labs(de) > EXTRUDE_MAXLENGTH) {
curr_e = dest_e; // Behave as if the move really took place, but ignore E part curr_e = dest_e; // Behave as if the move really took place, but ignore E part
SERIAL_ECHO_START; SERIAL_ECHO_START;
SERIAL_ECHOLNPGM(MSG_ERR_LONG_EXTRUDE_STOP); SERIAL_ECHOLNPGM(MSG_ERR_LONG_EXTRUDE_STOP);
return 0;
} }
#endif #endif
} }
return de;
} }
#endif // PREVENT_DANGEROUS_EXTRUDE #endif // PREVENT_DANGEROUS_EXTRUDE

Loading…
Cancel
Save