Browse Source

Removed ISR overtaken message from ISR routine

Erik van der Zalm 13 years ago
parent
commit
0e0e4945d8
3 changed files with 17 additions and 4 deletions
  1. 1
    0
      Marlin/Marlin.pde
  2. 15
    3
      Marlin/stepper.cpp
  3. 1
    1
      Marlin/stepper.h

+ 1
- 0
Marlin/Marlin.pde View File

289
   manage_heater();
289
   manage_heater();
290
   manage_inactivity(1);
290
   manage_inactivity(1);
291
   checkHitEndstops();
291
   checkHitEndstops();
292
+  checkStepperErrors();
292
   LCD_STATUS;
293
   LCD_STATUS;
293
 }
294
 }
294
 
295
 

+ 15
- 3
Marlin/stepper.cpp View File

77
 static bool old_z_min_endstop=false;
77
 static bool old_z_min_endstop=false;
78
 static bool old_z_max_endstop=false;
78
 static bool old_z_max_endstop=false;
79
 
79
 
80
+static bool bussy_error=false;
81
+unsigned char OCR1A_error=12345;
82
+
80
 volatile long count_position[NUM_AXIS] = { 0, 0, 0, 0};
83
 volatile long count_position[NUM_AXIS] = { 0, 0, 0, 0};
81
 volatile char count_direction[NUM_AXIS] = { 1, 1, 1, 1};
84
 volatile char count_direction[NUM_AXIS] = { 1, 1, 1, 1};
82
 
85
 
160
 #define ENABLE_STEPPER_DRIVER_INTERRUPT()  TIMSK1 |= (1<<OCIE1A)
163
 #define ENABLE_STEPPER_DRIVER_INTERRUPT()  TIMSK1 |= (1<<OCIE1A)
161
 #define DISABLE_STEPPER_DRIVER_INTERRUPT() TIMSK1 &= ~(1<<OCIE1A)
164
 #define DISABLE_STEPPER_DRIVER_INTERRUPT() TIMSK1 &= ~(1<<OCIE1A)
162
 
165
 
166
+void checkStepperErrors()
167
+{
168
+  if(bussy_error) {
169
+    SERIAL_ERROR_START
170
+    SERIAL_ERROR(OCR1A_error);
171
+    SERIAL_ERRORLNPGM(" ISR overtaking itself.");
172
+    bussy_error = false;
173
+  }
174
+}
175
+
163
 void checkHitEndstops()
176
 void checkHitEndstops()
164
 {
177
 {
165
  if( endstop_x_hit || endstop_y_hit || endstop_z_hit) {
178
  if( endstop_x_hit || endstop_y_hit || endstop_z_hit) {
264
 ISR(TIMER1_COMPA_vect)
277
 ISR(TIMER1_COMPA_vect)
265
 {        
278
 {        
266
   if(busy){ 
279
   if(busy){ 
267
-    SERIAL_ERROR_START
268
-    SERIAL_ERROR(*(unsigned short *)OCR1A);
269
-    SERIAL_ERRORLNPGM(" ISR overtaking itself.");
280
+    OCR1A_error = OCR1A;
281
+    bussy_error = true;
270
     OCR1A = 0x30000;
282
     OCR1A = 0x30000;
271
     return; 
283
     return; 
272
   } // The busy-flag is used to avoid reentering this interrupt
284
   } // The busy-flag is used to avoid reentering this interrupt

+ 1
- 1
Marlin/stepper.h View File

44
 void checkHitEndstops(); //call from somwhere to create an serial error message with the locations the endstops where hit, in case they were triggered
44
 void checkHitEndstops(); //call from somwhere to create an serial error message with the locations the endstops where hit, in case they were triggered
45
 void endstops_hit_on_purpose(); //avoid creation of the message, i.e. after homeing and before a routine call of checkHitEndstops();
45
 void endstops_hit_on_purpose(); //avoid creation of the message, i.e. after homeing and before a routine call of checkHitEndstops();
46
 
46
 
47
-
47
+void checkStepperErrors(); //Print errors detected by the stepper
48
 
48
 
49
 extern block_t *current_block;  // A pointer to the block currently being traced
49
 extern block_t *current_block;  // A pointer to the block currently being traced
50
 
50
 

Loading…
Cancel
Save