|
@@ -486,18 +486,18 @@ ISR(TIMER1_COMPA_vect)
|
486
|
486
|
#if !defined COREXY
|
487
|
487
|
counter_x += current_block->steps_x;
|
488
|
488
|
if (counter_x > 0) {
|
489
|
|
- WRITE(X_STEP_PIN, HIGH);
|
|
489
|
+ WRITE(X_STEP_PIN, !INVERT_X_STEP_PIN);
|
490
|
490
|
counter_x -= current_block->step_event_count;
|
491
|
491
|
count_position[X_AXIS]+=count_direction[X_AXIS];
|
492
|
|
- WRITE(X_STEP_PIN, LOW);
|
|
492
|
+ WRITE(X_STEP_PIN, INVERT_X_STEP_PIN);
|
493
|
493
|
}
|
494
|
494
|
|
495
|
495
|
counter_y += current_block->steps_y;
|
496
|
496
|
if (counter_y > 0) {
|
497
|
|
- WRITE(Y_STEP_PIN, HIGH);
|
|
497
|
+ WRITE(Y_STEP_PIN, !INVERT_Y_STEP_PIN);
|
498
|
498
|
counter_y -= current_block->step_event_count;
|
499
|
|
- count_position[Y_AXIS]+=count_direction[Y_AXIS];
|
500
|
|
- WRITE(Y_STEP_PIN, LOW);
|
|
499
|
+ count_position[Y_AXIS]+=count_direction[Y_AXIS];
|
|
500
|
+ WRITE(Y_STEP_PIN, INVERT_Y_STEP_PIN);
|
501
|
501
|
}
|
502
|
502
|
#endif
|
503
|
503
|
|
|
@@ -506,64 +506,64 @@ ISR(TIMER1_COMPA_vect)
|
506
|
506
|
counter_y += current_block->steps_y;
|
507
|
507
|
|
508
|
508
|
if ((counter_x > 0)&&!(counter_y>0)){ //X step only
|
509
|
|
- WRITE(X_STEP_PIN, HIGH);
|
510
|
|
- WRITE(Y_STEP_PIN, HIGH);
|
|
509
|
+ WRITE(X_STEP_PIN, !INVERT_X_STEP_PIN);
|
|
510
|
+ WRITE(Y_STEP_PIN, !INVERT_Y_STEP_PIN);
|
511
|
511
|
counter_x -= current_block->step_event_count;
|
512
|
512
|
count_position[X_AXIS]+=count_direction[X_AXIS];
|
513
|
|
- WRITE(X_STEP_PIN, LOW);
|
514
|
|
- WRITE(Y_STEP_PIN, LOW);
|
|
513
|
+ WRITE(X_STEP_PIN, INVERT_X_STEP_PIN);
|
|
514
|
+ WRITE(Y_STEP_PIN, INVERT_Y_STEP_PIN);
|
515
|
515
|
}
|
516
|
516
|
|
517
|
517
|
if (!(counter_x > 0)&&(counter_y>0)){ //Y step only
|
518
|
|
- WRITE(X_STEP_PIN, HIGH);
|
519
|
|
- WRITE(Y_STEP_PIN, HIGH);
|
|
518
|
+ WRITE(X_STEP_PIN, !INVERT_X_STEP_PIN);
|
|
519
|
+ WRITE(Y_STEP_PIN, !INVERT_Y_STEP_PIN);
|
520
|
520
|
counter_y -= current_block->step_event_count;
|
521
|
521
|
count_position[Y_AXIS]+=count_direction[Y_AXIS];
|
522
|
|
- WRITE(X_STEP_PIN, LOW);
|
523
|
|
- WRITE(Y_STEP_PIN, LOW);
|
|
522
|
+ WRITE(X_STEP_PIN, INVERT_X_STEP_PIN);
|
|
523
|
+ WRITE(Y_STEP_PIN, INVERT_Y_STEP_PIN);
|
524
|
524
|
}
|
525
|
525
|
|
526
|
526
|
if ((counter_x > 0)&&(counter_y>0)){ //step in both axes
|
527
|
527
|
if (((out_bits & (1<<X_AXIS)) == 0)^((out_bits & (1<<Y_AXIS)) == 0)){ //X and Y in different directions
|
528
|
|
- WRITE(Y_STEP_PIN, HIGH);
|
|
528
|
+ WRITE(Y_STEP_PIN, !INVERT_Y_STEP_PIN);
|
529
|
529
|
counter_x -= current_block->step_event_count;
|
530
|
|
- WRITE(Y_STEP_PIN, LOW);
|
|
530
|
+ WRITE(Y_STEP_PIN, INVERT_Y_STEP_PIN);
|
531
|
531
|
step_wait();
|
532
|
532
|
count_position[X_AXIS]+=count_direction[X_AXIS];
|
533
|
533
|
count_position[Y_AXIS]+=count_direction[Y_AXIS];
|
534
|
|
- WRITE(Y_STEP_PIN, HIGH);
|
|
534
|
+ WRITE(Y_STEP_PIN, !INVERT_Y_STEP_PIN);
|
535
|
535
|
counter_y -= current_block->step_event_count;
|
536
|
|
- WRITE(Y_STEP_PIN, LOW);
|
|
536
|
+ WRITE(Y_STEP_PIN, INVERT_Y_STEP_PIN);
|
537
|
537
|
}
|
538
|
538
|
else{ //X and Y in same direction
|
539
|
|
- WRITE(X_STEP_PIN, HIGH);
|
|
539
|
+ WRITE(X_STEP_PIN, !INVERT_X_STEP_PIN);
|
540
|
540
|
counter_x -= current_block->step_event_count;
|
541
|
|
- WRITE(X_STEP_PIN, LOW) ;
|
|
541
|
+ WRITE(X_STEP_PIN, INVERT_X_STEP_PIN) ;
|
542
|
542
|
step_wait();
|
543
|
543
|
count_position[X_AXIS]+=count_direction[X_AXIS];
|
544
|
544
|
count_position[Y_AXIS]+=count_direction[Y_AXIS];
|
545
|
|
- WRITE(X_STEP_PIN, HIGH);
|
|
545
|
+ WRITE(X_STEP_PIN, !INVERT_X_STEP_PIN);
|
546
|
546
|
counter_y -= current_block->step_event_count;
|
547
|
|
- WRITE(X_STEP_PIN, LOW);
|
|
547
|
+ WRITE(X_STEP_PIN, INVERT_X_STEP_PIN);
|
548
|
548
|
}
|
549
|
549
|
}
|
550
|
550
|
#endif //corexy
|
551
|
551
|
|
552
|
552
|
counter_z += current_block->steps_z;
|
553
|
553
|
if (counter_z > 0) {
|
554
|
|
- WRITE(Z_STEP_PIN, HIGH);
|
|
554
|
+ WRITE(Z_STEP_PIN, !INVERT_Z_STEP_PIN);
|
555
|
555
|
counter_z -= current_block->step_event_count;
|
556
|
556
|
count_position[Z_AXIS]+=count_direction[Z_AXIS];
|
557
|
|
- WRITE(Z_STEP_PIN, LOW);
|
|
557
|
+ WRITE(Z_STEP_PIN, INVERT_Z_STEP_PIN);
|
558
|
558
|
}
|
559
|
559
|
|
560
|
560
|
#ifndef ADVANCE
|
561
|
561
|
counter_e += current_block->steps_e;
|
562
|
562
|
if (counter_e > 0) {
|
563
|
|
- WRITE_E_STEP(HIGH);
|
|
563
|
+ WRITE_E_STEP(!INVERT_E_STEP_PIN);
|
564
|
564
|
counter_e -= current_block->step_event_count;
|
565
|
565
|
count_position[E_AXIS]+=count_direction[E_AXIS];
|
566
|
|
- WRITE_E_STEP(LOW);
|
|
566
|
+ WRITE(E_STEP_PIN, INVERT_E_STEP_PIN);
|
567
|
567
|
}
|
568
|
568
|
#endif //!ADVANCE
|
569
|
569
|
step_events_completed += 1;
|
|
@@ -647,45 +647,45 @@ ISR(TIMER1_COMPA_vect)
|
647
|
647
|
// Set E direction (Depends on E direction + advance)
|
648
|
648
|
for(unsigned char i=0; i<4;i++) {
|
649
|
649
|
if (e_steps[0] != 0) {
|
650
|
|
- WRITE(E0_STEP_PIN, LOW);
|
|
650
|
+ WRITE(E0_STEP_PIN, INVERT_E_STEP_PIN);
|
651
|
651
|
if (e_steps[0] < 0) {
|
652
|
652
|
WRITE(E0_DIR_PIN, INVERT_E0_DIR);
|
653
|
653
|
e_steps[0]++;
|
654
|
|
- WRITE(E0_STEP_PIN, HIGH);
|
|
654
|
+ WRITE(E0_STEP_PIN, !INVERT_E_STEP_PIN);
|
655
|
655
|
}
|
656
|
656
|
else if (e_steps[0] > 0) {
|
657
|
657
|
WRITE(E0_DIR_PIN, !INVERT_E0_DIR);
|
658
|
658
|
e_steps[0]--;
|
659
|
|
- WRITE(E0_STEP_PIN, HIGH);
|
|
659
|
+ WRITE(E0_STEP_PIN, !INVERT_E_STEP_PIN);
|
660
|
660
|
}
|
661
|
661
|
}
|
662
|
662
|
#if EXTRUDERS > 1
|
663
|
663
|
if (e_steps[1] != 0) {
|
664
|
|
- WRITE(E1_STEP_PIN, LOW);
|
|
664
|
+ WRITE(E1_STEP_PIN, INVERT_E_STEP_PIN);
|
665
|
665
|
if (e_steps[1] < 0) {
|
666
|
666
|
WRITE(E1_DIR_PIN, INVERT_E1_DIR);
|
667
|
667
|
e_steps[1]++;
|
668
|
|
- WRITE(E1_STEP_PIN, HIGH);
|
|
668
|
+ WRITE(E1_STEP_PIN, !INVERT_E_STEP_PIN);
|
669
|
669
|
}
|
670
|
670
|
else if (e_steps[1] > 0) {
|
671
|
671
|
WRITE(E1_DIR_PIN, !INVERT_E1_DIR);
|
672
|
672
|
e_steps[1]--;
|
673
|
|
- WRITE(E1_STEP_PIN, HIGH);
|
|
673
|
+ WRITE(E1_STEP_PIN, !INVERT_E_STEP_PIN);
|
674
|
674
|
}
|
675
|
675
|
}
|
676
|
676
|
#endif
|
677
|
677
|
#if EXTRUDERS > 2
|
678
|
678
|
if (e_steps[2] != 0) {
|
679
|
|
- WRITE(E2_STEP_PIN, LOW);
|
|
679
|
+ WRITE(E2_STEP_PIN, INVERT_E_STEP_PIN);
|
680
|
680
|
if (e_steps[2] < 0) {
|
681
|
681
|
WRITE(E2_DIR_PIN, INVERT_E2_DIR);
|
682
|
682
|
e_steps[2]++;
|
683
|
|
- WRITE(E2_STEP_PIN, HIGH);
|
|
683
|
+ WRITE(E2_STEP_PIN, !INVERT_E_STEP_PIN);
|
684
|
684
|
}
|
685
|
685
|
else if (e_steps[2] > 0) {
|
686
|
686
|
WRITE(E2_DIR_PIN, !INVERT_E2_DIR);
|
687
|
687
|
e_steps[2]--;
|
688
|
|
- WRITE(E2_STEP_PIN, HIGH);
|
|
688
|
+ WRITE(E2_STEP_PIN, !INVERT_E_STEP_PIN);
|
689
|
689
|
}
|
690
|
690
|
}
|
691
|
691
|
#endif
|
|
@@ -790,26 +790,32 @@ void st_init()
|
790
|
790
|
//Initialize Step Pins
|
791
|
791
|
#if (X_STEP_PIN > -1)
|
792
|
792
|
SET_OUTPUT(X_STEP_PIN);
|
|
793
|
+ WRITE(X_STEP_PIN,INVERT_X_STEP_PIN);
|
793
|
794
|
if(!X_ENABLE_ON) WRITE(X_ENABLE_PIN,HIGH);
|
794
|
795
|
#endif
|
795
|
796
|
#if (Y_STEP_PIN > -1)
|
796
|
797
|
SET_OUTPUT(Y_STEP_PIN);
|
|
798
|
+ WRITE(Y_STEP_PIN,INVERT_Y_STEP_PIN);
|
797
|
799
|
if(!Y_ENABLE_ON) WRITE(Y_ENABLE_PIN,HIGH);
|
798
|
800
|
#endif
|
799
|
801
|
#if (Z_STEP_PIN > -1)
|
800
|
802
|
SET_OUTPUT(Z_STEP_PIN);
|
|
803
|
+ WRITE(Z_STEP_PIN,INVERT_Z_STEP_PIN);
|
801
|
804
|
if(!Z_ENABLE_ON) WRITE(Z_ENABLE_PIN,HIGH);
|
802
|
805
|
#endif
|
803
|
806
|
#if (E0_STEP_PIN > -1)
|
804
|
807
|
SET_OUTPUT(E0_STEP_PIN);
|
|
808
|
+ WRITE(E0_STEP_PIN,INVERT_E_STEP_PIN);
|
805
|
809
|
if(!E_ENABLE_ON) WRITE(E0_ENABLE_PIN,HIGH);
|
806
|
810
|
#endif
|
807
|
811
|
#if defined(E1_STEP_PIN) && (E1_STEP_PIN > -1)
|
808
|
812
|
SET_OUTPUT(E1_STEP_PIN);
|
|
813
|
+ WRITE(E1_STEP_PIN,INVERT_E_STEP_PIN);
|
809
|
814
|
if(!E_ENABLE_ON) WRITE(E1_ENABLE_PIN,HIGH);
|
810
|
815
|
#endif
|
811
|
816
|
#if defined(E2_STEP_PIN) && (E2_STEP_PIN > -1)
|
812
|
817
|
SET_OUTPUT(E2_STEP_PIN);
|
|
818
|
+ WRITE(E2_STEP_PIN,INVERT_E_STEP_PIN);
|
813
|
819
|
if(!E_ENABLE_ON) WRITE(E2_ENABLE_PIN,HIGH);
|
814
|
820
|
#endif
|
815
|
821
|
|