|
@@ -351,6 +351,16 @@ void servo_init()
|
351
|
351
|
#if (NUM_SERVOS >= 5)
|
352
|
352
|
#error "TODO: enter initalisation code for more servos"
|
353
|
353
|
#endif
|
|
354
|
+
|
|
355
|
+ // Set position of Servo Endstops that are defined
|
|
356
|
+ #ifdef SERVO_ENDSTOPS
|
|
357
|
+ for(int8_t i = 0; i < 3; i++)
|
|
358
|
+ {
|
|
359
|
+ if(servo_endstops[i] > -1) {
|
|
360
|
+ servos[servo_endstops[i]].write(servo_endstop_angles[i * 2 + 1]);
|
|
361
|
+ }
|
|
362
|
+ }
|
|
363
|
+ #endif
|
354
|
364
|
}
|
355
|
365
|
|
356
|
366
|
void setup()
|
|
@@ -664,11 +674,16 @@ static void axis_is_at_home(int axis) {
|
664
|
674
|
static void homeaxis(int axis) {
|
665
|
675
|
#define HOMEAXIS_DO(LETTER) \
|
666
|
676
|
((LETTER##_MIN_PIN > -1 && LETTER##_HOME_DIR==-1) || (LETTER##_MAX_PIN > -1 && LETTER##_HOME_DIR==1))
|
667
|
|
-
|
668
|
677
|
if (axis==X_AXIS ? HOMEAXIS_DO(X) :
|
669
|
678
|
axis==Y_AXIS ? HOMEAXIS_DO(Y) :
|
670
|
679
|
axis==Z_AXIS ? HOMEAXIS_DO(Z) :
|
671
|
680
|
0) {
|
|
681
|
+
|
|
682
|
+ // Engage Servo endstop if enabled
|
|
683
|
+ #ifdef SERVO_ENDSTOPS[axis] > -1
|
|
684
|
+ servos[servo_endstops[axis]].write(servo_endstop_angles[axis * 2]);
|
|
685
|
+ #endif
|
|
686
|
+
|
672
|
687
|
current_position[axis] = 0;
|
673
|
688
|
plan_set_position(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS]);
|
674
|
689
|
destination[axis] = 1.5 * max_length(axis) * home_dir(axis);
|
|
@@ -691,6 +706,11 @@ static void homeaxis(int axis) {
|
691
|
706
|
destination[axis] = current_position[axis];
|
692
|
707
|
feedrate = 0.0;
|
693
|
708
|
endstops_hit_on_purpose();
|
|
709
|
+
|
|
710
|
+ // Retract Servo endstop if enabled
|
|
711
|
+ #ifdef SERVO_ENDSTOPS[axis] > -1
|
|
712
|
+ servos[servo_endstops[axis]].write(servo_endstop_angles[axis * 2 + 1]);
|
|
713
|
+ #endif
|
694
|
714
|
}
|
695
|
715
|
}
|
696
|
716
|
#define HOMEAXIS(LETTER) homeaxis(LETTER##_AXIS)
|
|
@@ -2281,4 +2301,4 @@ bool setTargetedHotend(int code){
|
2281
|
2301
|
}
|
2282
|
2302
|
}
|
2283
|
2303
|
return false;
|
2284
|
|
-}
|
|
2304
|
+}
|