Browse Source

faster compare

!(~(ab)&0x3) and ab == 0x3 are equal
wurstnase 10 years ago
parent
commit
94120740d8
1 changed files with 4 additions and 5 deletions
  1. 4
    5
      Marlin/stepper.cpp

+ 4
- 5
Marlin/stepper.cpp View File

@@ -566,8 +566,8 @@ ISR(TIMER1_COMPA_vect) {
566 566
             if (z_test && current_block->steps[Z_AXIS] > 0) { // z_test = Z_MIN || Z2_MIN
567 567
               endstops_trigsteps[Z_AXIS] = count_position[Z_AXIS];
568 568
               endstop_hit_bits |= BIT(Z_MIN);
569
-              if (!performing_homing || (performing_homing && !((~z_test) & 0x3)))  //if not performing home or if both endstops were trigged during homing...
570
-                step_events_completed = current_block->step_event_count;            //!((~z_test) & 0x3) = Z_MIN && Z2_MIN
569
+              if (!performing_homing || (performing_homing && z_test == & 0x3)))  //if not performing home or if both endstops were trigged during homing...
570
+                step_events_completed = current_block->step_event_count;
571 571
             }
572 572
           #else // !Z_DUAL_ENDSTOPS
573 573
 
@@ -577,7 +577,6 @@ ISR(TIMER1_COMPA_vect) {
577 577
 
578 578
         #ifdef Z_PROBE_ENDSTOP
579 579
           UPDATE_ENDSTOP(Z, PROBE);
580
-          SET_ENDSTOP_BIT(Z, PROBE);
581 580
 
582 581
           if (TEST_ENDSTOP(Z_PROBE))
583 582
           {
@@ -603,8 +602,8 @@ ISR(TIMER1_COMPA_vect) {
603 602
             if (z_test && current_block->steps[Z_AXIS] > 0) {  // t_test = Z_MAX || Z2_MAX
604 603
               endstops_trigsteps[Z_AXIS] = count_position[Z_AXIS];
605 604
               endstop_hit_bits |= BIT(Z_MIN);
606
-              if (!performing_homing || (performing_homing && !((~z_test) & 0x3)))  //if not performing home or if both endstops were trigged during homing...
607
-                step_events_completed = current_block->step_event_count;            //!((~z_test) & 0x3) = Z_MAX && Z2_MAX
605
+              if (!performing_homing || (performing_homing && z_test == 0x3)))  //if not performing home or if both endstops were trigged during homing...
606
+                step_events_completed = current_block->step_event_count;
608 607
             }
609 608
 
610 609
           #else // !Z_DUAL_ENDSTOPS

Loading…
Cancel
Save