static bool old_z_min_endstop=false;
static bool old_z_max_endstop=false;
+static bool bussy_error=false;
+unsigned char OCR1A_error=12345;
+
volatile long count_position[NUM_AXIS] = { 0, 0, 0, 0};
volatile char count_direction[NUM_AXIS] = { 1, 1, 1, 1};
#define ENABLE_STEPPER_DRIVER_INTERRUPT() TIMSK1 |= (1<<OCIE1A)
#define DISABLE_STEPPER_DRIVER_INTERRUPT() TIMSK1 &= ~(1<<OCIE1A)
+void checkStepperErrors()
+{
+ if(bussy_error) {
+ SERIAL_ERROR_START
+ SERIAL_ERROR(OCR1A_error);
+ SERIAL_ERRORLNPGM(" ISR overtaking itself.");
+ bussy_error = false;
+ }
+}
+
void checkHitEndstops()
{
if( endstop_x_hit || endstop_y_hit || endstop_z_hit) {
ISR(TIMER1_COMPA_vect)
{
if(busy){
- SERIAL_ERROR_START
- SERIAL_ERROR(*(unsigned short *)OCR1A);
- SERIAL_ERRORLNPGM(" ISR overtaking itself.");
+ OCR1A_error = OCR1A;
+ bussy_error = true;
OCR1A = 0x30000;
return;
} // The busy-flag is used to avoid reentering this interrupt
void checkHitEndstops(); //call from somwhere to create an serial error message with the locations the endstops where hit, in case they were triggered
void endstops_hit_on_purpose(); //avoid creation of the message, i.e. after homeing and before a routine call of checkHitEndstops();
-
+void checkStepperErrors(); //Print errors detected by the stepper
extern block_t *current_block; // A pointer to the block currently being traced