|
@@ -23,6 +23,9 @@
|
|
|
|
|
|
#include "planner.h"
|
|
|
|
|
|
+#define ENABLE_STEPPER_DRIVER_INTERRUPT() TIMSK1 |= (1<<OCIE1A)
|
|
|
+#define DISABLE_STEPPER_DRIVER_INTERRUPT() TIMSK1 &= ~(1<<OCIE1A)
|
|
|
+
|
|
|
#if EXTRUDERS > 2
|
|
|
#define WRITE_E_STEP(v) { if(current_block->active_extruder == 2) { WRITE(E2_STEP_PIN, v); } else { if(current_block->active_extruder == 1) { WRITE(E1_STEP_PIN, v); } else { WRITE(E0_STEP_PIN, v); }}}
|
|
|
#define NORM_E_DIR() { if(current_block->active_extruder == 2) { WRITE(E2_DIR_PIN, !INVERT_E2_DIR); } else { if(current_block->active_extruder == 1) { WRITE(E1_DIR_PIN, !INVERT_E1_DIR); } else { WRITE(E0_DIR_PIN, !INVERT_E0_DIR); }}}
|
|
@@ -71,11 +74,18 @@ void st_get_position_xy(long &x, long &y);
|
|
|
float st_get_position_mm(uint8_t axis);
|
|
|
|
|
|
|
|
|
-// The stepper subsystem goes to sleep when it runs out of things to execute. Call this
|
|
|
-// to notify the subsystem that it is time to go to work.
|
|
|
-void st_wake_up();
|
|
|
+// Call this function just before re-enabling the stepper driver interrupt and the global interrupts
|
|
|
+// to avoid a stepper timer overflow.
|
|
|
+FORCE_INLINE void st_reset_timer()
|
|
|
+{
|
|
|
+ // Clear a possible pending interrupt on OCR1A overflow.
|
|
|
+ TIFR1 |= 1 << OCF1A;
|
|
|
+ // Reset the counter.
|
|
|
+ TCNT1 = 0;
|
|
|
+ // Wake up after 1ms from now.
|
|
|
+ OCR1A = 2000;
|
|
|
+}
|
|
|
|
|
|
-
|
|
|
void checkHitEndstops(); //call from somewhere to create an serial error message with the locations the endstops where hit, in case they were triggered
|
|
|
bool endstops_hit_on_purpose(); //avoid creation of the message, i.e. after homing and before a routine call of checkHitEndstops();
|
|
|
bool endstop_z_hit_on_purpose();
|