Sfoglia il codice sorgente

Removed ISR overtaken message from ISR routine

Erik van der Zalm 13 anni fa
parent
commit
0e0e4945d8
3 ha cambiato i file con 17 aggiunte e 4 eliminazioni
  1. 1
    0
      Marlin/Marlin.pde
  2. 15
    3
      Marlin/stepper.cpp
  3. 1
    1
      Marlin/stepper.h

+ 1
- 0
Marlin/Marlin.pde Vedi File

@@ -289,6 +289,7 @@ void loop()
289 289
   manage_heater();
290 290
   manage_inactivity(1);
291 291
   checkHitEndstops();
292
+  checkStepperErrors();
292 293
   LCD_STATUS;
293 294
 }
294 295
 

+ 15
- 3
Marlin/stepper.cpp Vedi File

@@ -77,6 +77,9 @@ static bool old_y_max_endstop=false;
77 77
 static bool old_z_min_endstop=false;
78 78
 static bool old_z_max_endstop=false;
79 79
 
80
+static bool bussy_error=false;
81
+unsigned char OCR1A_error=12345;
82
+
80 83
 volatile long count_position[NUM_AXIS] = { 0, 0, 0, 0};
81 84
 volatile char count_direction[NUM_AXIS] = { 1, 1, 1, 1};
82 85
 
@@ -160,6 +163,16 @@ asm volatile ( \
160 163
 #define ENABLE_STEPPER_DRIVER_INTERRUPT()  TIMSK1 |= (1<<OCIE1A)
161 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 176
 void checkHitEndstops()
164 177
 {
165 178
  if( endstop_x_hit || endstop_y_hit || endstop_z_hit) {
@@ -264,9 +277,8 @@ inline void trapezoid_generator_reset() {
264 277
 ISR(TIMER1_COMPA_vect)
265 278
 {        
266 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 282
     OCR1A = 0x30000;
271 283
     return; 
272 284
   } // The busy-flag is used to avoid reentering this interrupt

+ 1
- 1
Marlin/stepper.h Vedi File

@@ -44,7 +44,7 @@ void st_wake_up();
44 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 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 49
 extern block_t *current_block;  // A pointer to the block currently being traced
50 50
 

Loading…
Annulla
Salva