From: Bernhard Date: Fri, 9 Dec 2011 11:32:31 +0000 (+0100) Subject: fixed the st_synchronize. it would have continued if there is only the last move... X-Git-Tag: iwj-success-2012-07-29~159 X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=commitdiff_plain;h=61c943b4bfdb80ca8145cb66d16169a8891bdb94;p=marlin.git fixed the st_synchronize. it would have continued if there is only the last move of the buffer being stepped. --- diff --git a/Marlin/planner.h b/Marlin/planner.h index 53ac3d8..b1e028f 100644 --- a/Marlin/planner.h +++ b/Marlin/planner.h @@ -130,4 +130,14 @@ FORCE_INLINE block_t *plan_get_current_block() block->busy = true; return(block); } + +// Gets the current block. Returns NULL if buffer empty +FORCE_INLINE bool blocks_queued() +{ + if (block_buffer_head == block_buffer_tail) { + return false; + } + else + return true; +} #endif diff --git a/Marlin/stepper.cpp b/Marlin/stepper.cpp index e993d73..2ef0773 100644 --- a/Marlin/stepper.cpp +++ b/Marlin/stepper.cpp @@ -706,22 +706,17 @@ void st_init() sei(); } -#define TEMPORARY_Z_HOME_SOUND_FIX -#ifdef TEMPORARY_Z_HOME_SOUND_FIX - #include -#endif + +#include // Block until all buffered steps are executed void st_synchronize() { - while(plan_get_current_block()) { + while(current_block!=0 || blocks_queued()) { manage_heater(); manage_inactivity(1); LCD_STATUS; - #ifdef TEMPORARY_Z_HOME_SOUND_FIX - _delay_ms(200); - _delay_ms(200); - #endif - } + //_delay_ms(1); + } } void st_set_position(const long &x, const long &y, const long &z, const long &e)