Browse Source

Update endstops only for homing. (use less resources when not used)

Erik van der Zalm 13 years ago
parent
commit
89e832c295
1 changed files with 18 additions and 7 deletions
  1. 18
    7
      Marlin/stepper.cpp

+ 18
- 7
Marlin/stepper.cpp View File

@@ -87,7 +87,12 @@ volatile char count_direction[NUM_AXIS] = { 1, 1, 1, 1};
87 87
 //===========================================================================
88 88
 //=============================functions         ============================
89 89
 //===========================================================================
90
-  
90
+
91
+#ifdef ENDSTOPS_ONLY_FOR_HOMING
92
+  #define CHECK_ENDSTOPS  if(check_endstops)
93
+#else
94
+  #define CHECK_ENDSTOPS
95
+#endif
91 96
 
92 97
 // intRes = intIn1 * intIn2 >> 16
93 98
 // uses:
@@ -316,7 +321,8 @@ ISR(TIMER1_COMPA_vect)
316 321
     if ((out_bits & (1<<X_AXIS)) != 0) {   // -direction
317 322
       WRITE(X_DIR_PIN, INVERT_X_DIR);
318 323
       count_direction[X_AXIS]=-1;
319
-      if(check_endstops) {
324
+      CHECK_ENDSTOPS
325
+      {
320 326
         #if X_MIN_PIN > -1
321 327
           bool x_min_endstop=(READ(X_MIN_PIN) != X_ENDSTOPS_INVERTING);
322 328
           if(x_min_endstop && old_x_min_endstop && (current_block->steps_x > 0)) {
@@ -331,7 +337,8 @@ ISR(TIMER1_COMPA_vect)
331 337
     else { // +direction 
332 338
       WRITE(X_DIR_PIN,!INVERT_X_DIR);
333 339
       count_direction[X_AXIS]=1;
334
-      if(check_endstops) {
340
+      CHECK_ENDSTOPS 
341
+      {
335 342
         #if X_MAX_PIN > -1
336 343
           bool x_max_endstop=(READ(X_MAX_PIN) != X_ENDSTOPS_INVERTING);
337 344
           if(x_max_endstop && old_x_max_endstop && (current_block->steps_x > 0)){
@@ -347,7 +354,8 @@ ISR(TIMER1_COMPA_vect)
347 354
     if ((out_bits & (1<<Y_AXIS)) != 0) {   // -direction
348 355
       WRITE(Y_DIR_PIN,INVERT_Y_DIR);
349 356
       count_direction[Y_AXIS]=-1;
350
-      if(check_endstops) {
357
+      CHECK_ENDSTOPS
358
+      {
351 359
         #if Y_MIN_PIN > -1
352 360
           bool y_min_endstop=(READ(Y_MIN_PIN) != Y_ENDSTOPS_INVERTING);
353 361
           if(y_min_endstop && old_y_min_endstop && (current_block->steps_y > 0)) {
@@ -362,7 +370,8 @@ ISR(TIMER1_COMPA_vect)
362 370
     else { // +direction
363 371
     WRITE(Y_DIR_PIN,!INVERT_Y_DIR);
364 372
       count_direction[Y_AXIS]=1;
365
-      if(check_endstops) {
373
+      CHECK_ENDSTOPS
374
+      {
366 375
         #if Y_MAX_PIN > -1
367 376
           bool y_max_endstop=(READ(Y_MAX_PIN) != Y_ENDSTOPS_INVERTING);
368 377
           if(y_max_endstop && old_y_max_endstop && (current_block->steps_y > 0)){
@@ -378,7 +387,8 @@ ISR(TIMER1_COMPA_vect)
378 387
     if ((out_bits & (1<<Z_AXIS)) != 0) {   // -direction
379 388
       WRITE(Z_DIR_PIN,INVERT_Z_DIR);
380 389
       count_direction[Z_AXIS]=-1;
381
-      if(check_endstops) {
390
+      CHECK_ENDSTOPS
391
+      {
382 392
         #if Z_MIN_PIN > -1
383 393
           bool z_min_endstop=(READ(Z_MIN_PIN) != Z_ENDSTOPS_INVERTING);
384 394
           if(z_min_endstop && old_z_min_endstop && (current_block->steps_z > 0)) {
@@ -393,7 +403,8 @@ ISR(TIMER1_COMPA_vect)
393 403
     else { // +direction
394 404
       WRITE(Z_DIR_PIN,!INVERT_Z_DIR);
395 405
       count_direction[Z_AXIS]=1;
396
-      if(check_endstops) {
406
+      CHECK_ENDSTOPS
407
+      {
397 408
         #if Z_MAX_PIN > -1
398 409
           bool z_max_endstop=(READ(Z_MAX_PIN) != Z_ENDSTOPS_INVERTING);
399 410
           if(z_max_endstop && old_z_max_endstop && (current_block->steps_z > 0)) {

Loading…
Cancel
Save