Removed ISR overtaken message from ISR routine

This commit is contained in:
Erik van der Zalm 2011-11-25 13:59:58 +01:00
parent c0f8c9fd72
commit 0e0e4945d8
3 changed files with 17 additions and 4 deletions

View File

@ -289,6 +289,7 @@ void loop()
manage_heater();
manage_inactivity(1);
checkHitEndstops();
checkStepperErrors();
LCD_STATUS;
}

View File

@ -77,6 +77,9 @@ static bool old_y_max_endstop=false;
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};
@ -160,6 +163,16 @@ asm volatile ( \
#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) {
@ -264,9 +277,8 @@ inline void trapezoid_generator_reset() {
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

View File

@ -44,7 +44,7 @@ void st_wake_up();
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