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

Loading…
Cancel
Save