|
@@ -177,6 +177,10 @@ float extruder_offset[2][EXTRUDERS] = {
|
177
|
177
|
#endif
|
178
|
178
|
uint8_t active_extruder = 0;
|
179
|
179
|
int fanSpeed=0;
|
|
180
|
+#ifdef SERVO_ENDSTOPS
|
|
181
|
+ int servo_endstops[] = SERVO_ENDSTOPS;
|
|
182
|
+ int servo_endstop_angles[] = SERVO_ENDSTOP_ANGLES;
|
|
183
|
+#endif
|
180
|
184
|
#ifdef BARICUDA
|
181
|
185
|
int ValvePressure=0;
|
182
|
186
|
int EtoPPressure=0;
|
|
@@ -351,6 +355,16 @@ void servo_init()
|
351
|
355
|
#if (NUM_SERVOS >= 5)
|
352
|
356
|
#error "TODO: enter initalisation code for more servos"
|
353
|
357
|
#endif
|
|
358
|
+
|
|
359
|
+ // Set position of Servo Endstops that are defined
|
|
360
|
+ #ifdef SERVO_ENDSTOPS
|
|
361
|
+ for(int8_t i = 0; i < 3; i++)
|
|
362
|
+ {
|
|
363
|
+ if(servo_endstops[i] > -1) {
|
|
364
|
+ servos[servo_endstops[i]].write(servo_endstop_angles[i * 2 + 1]);
|
|
365
|
+ }
|
|
366
|
+ }
|
|
367
|
+ #endif
|
354
|
368
|
}
|
355
|
369
|
|
356
|
370
|
void setup()
|
|
@@ -664,11 +678,16 @@ static void axis_is_at_home(int axis) {
|
664
|
678
|
static void homeaxis(int axis) {
|
665
|
679
|
#define HOMEAXIS_DO(LETTER) \
|
666
|
680
|
((LETTER##_MIN_PIN > -1 && LETTER##_HOME_DIR==-1) || (LETTER##_MAX_PIN > -1 && LETTER##_HOME_DIR==1))
|
667
|
|
-
|
668
|
681
|
if (axis==X_AXIS ? HOMEAXIS_DO(X) :
|
669
|
682
|
axis==Y_AXIS ? HOMEAXIS_DO(Y) :
|
670
|
683
|
axis==Z_AXIS ? HOMEAXIS_DO(Z) :
|
671
|
684
|
0) {
|
|
685
|
+
|
|
686
|
+ // Engage Servo endstop if enabled
|
|
687
|
+ #ifdef SERVO_ENDSTOPS[axis] > -1
|
|
688
|
+ servos[servo_endstops[axis]].write(servo_endstop_angles[axis * 2]);
|
|
689
|
+ #endif
|
|
690
|
+
|
672
|
691
|
current_position[axis] = 0;
|
673
|
692
|
plan_set_position(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS]);
|
674
|
693
|
destination[axis] = 1.5 * max_length(axis) * home_dir(axis);
|
|
@@ -691,6 +710,11 @@ static void homeaxis(int axis) {
|
691
|
710
|
destination[axis] = current_position[axis];
|
692
|
711
|
feedrate = 0.0;
|
693
|
712
|
endstops_hit_on_purpose();
|
|
713
|
+
|
|
714
|
+ // Retract Servo endstop if enabled
|
|
715
|
+ #ifdef SERVO_ENDSTOPS[axis] > -1
|
|
716
|
+ servos[servo_endstops[axis]].write(servo_endstop_angles[axis * 2 + 1]);
|
|
717
|
+ #endif
|
694
|
718
|
}
|
695
|
719
|
}
|
696
|
720
|
#define HOMEAXIS(LETTER) homeaxis(LETTER##_AXIS)
|
|
@@ -2281,4 +2305,4 @@ bool setTargetedHotend(int code){
|
2281
|
2305
|
}
|
2282
|
2306
|
}
|
2283
|
2307
|
return false;
|
2284
|
|
-}
|
|
2308
|
+}
|