From fa951f8a0bc7391c55478e8951813f798696bef1 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Tue, 12 May 2015 00:31:51 -0700 Subject: [PATCH 1/5] Always do st_synchronize() before G28 --- Marlin/Marlin_main.cpp | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/Marlin/Marlin_main.cpp b/Marlin/Marlin_main.cpp index 5517b8e18..7d75ad8d5 100644 --- a/Marlin/Marlin_main.cpp +++ b/Marlin/Marlin_main.cpp @@ -1845,6 +1845,9 @@ inline void gcode_G4() { */ inline void gcode_G28() { + // Wait for planner moves to finish! + st_synchronize(); + // For auto bed leveling, clear the level matrix #ifdef ENABLE_AUTO_BED_LEVELING plan_bed_level_matrix.set_to_identity(); @@ -1859,12 +1862,7 @@ inline void gcode_G28() { mbl.active = 0; #endif - saved_feedrate = feedrate; - saved_feedrate_multiplier = feedrate_multiplier; - feedrate_multiplier = 100; - refresh_cmd_timeout(); - - enable_endstops(true); + setup_for_endstop_move(); set_destination_to_current(); @@ -3150,8 +3148,6 @@ inline void gcode_M42() { clean_up_after_endstop_move(); - // enable_endstops(true); - if (verbose_level > 0) { SERIAL_PROTOCOLPGM("Mean: "); SERIAL_PROTOCOL_F(mean, 6); From 367e2eb9f47906dfa08e8a2804b54030db15b5e2 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Tue, 12 May 2015 00:51:22 -0700 Subject: [PATCH 2/5] Global setup_for_endstop_move --- Marlin/Marlin_main.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/Marlin/Marlin_main.cpp b/Marlin/Marlin_main.cpp index 7d75ad8d5..1ca925d5f 100644 --- a/Marlin/Marlin_main.cpp +++ b/Marlin/Marlin_main.cpp @@ -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_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 DELTA From 8d814de558a34897ce4f6734b06e6c27ddab4021 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Tue, 12 May 2015 00:55:00 -0700 Subject: [PATCH 3/5] Return void in prevent_dangerous_extrude --- Marlin/Marlin_main.cpp | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/Marlin/Marlin_main.cpp b/Marlin/Marlin_main.cpp index 1ca925d5f..ae0652ac1 100644 --- a/Marlin/Marlin_main.cpp +++ b/Marlin/Marlin_main.cpp @@ -5743,25 +5743,22 @@ void mesh_plan_buffer_line(float x, float y, float z, const float e, float feed_ #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; if (de) { if (degHotend(active_extruder) < extrude_min_temp) { curr_e = dest_e; // Behave as if the move really took place, but ignore E part SERIAL_ECHO_START; SERIAL_ECHOLNPGM(MSG_ERR_COLD_EXTRUDE_STOP); - return 0; } #ifdef PREVENT_LENGTHY_EXTRUDE if (labs(de) > EXTRUDE_MAXLENGTH) { curr_e = dest_e; // Behave as if the move really took place, but ignore E part SERIAL_ECHO_START; SERIAL_ECHOLNPGM(MSG_ERR_LONG_EXTRUDE_STOP); - return 0; } #endif } - return de; } #endif // PREVENT_DANGEROUS_EXTRUDE From b5200e184cc83eac6055667f94a522ef99212bed Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Tue, 12 May 2015 01:01:53 -0700 Subject: [PATCH 4/5] Remove extra setup_for_endstop_move --- Marlin/Marlin_main.cpp | 8 -------- 1 file changed, 8 deletions(-) diff --git a/Marlin/Marlin_main.cpp b/Marlin/Marlin_main.cpp index ae0652ac1..1e3d436a1 100644 --- a/Marlin/Marlin_main.cpp +++ b/Marlin/Marlin_main.cpp @@ -1264,14 +1264,6 @@ static void setup_for_endstop_move() { 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() { #ifdef ENDSTOPS_ONLY_FOR_HOMING enable_endstops(false); From 873f7d6f2a81ec550072177ef52a024186a9d4a3 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Tue, 12 May 2015 01:33:51 -0700 Subject: [PATCH 5/5] Check that configs are up-to-date --- Marlin/Marlin.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Marlin/Marlin.h b/Marlin/Marlin.h index 4703dbffa..03531d1d3 100644 --- a/Marlin/Marlin.h +++ b/Marlin/Marlin.h @@ -21,6 +21,10 @@ #include "fastio.h" #include "Configuration.h" +#ifndef SANITYCHECK_H + #error Your Configuration.h and Configuration_adv.h files are outdated! +#endif + #if (ARDUINO >= 100) #include "Arduino.h" #else