@@ -823,19 +823,16 @@ void Endstops::update() {
823
823
#endif
824
824
825
825
#if ENABLED(CALIBRATION_GCODE)
826
- if (calibration_probe_enabled) {
827
- #if HAS_CALIBRATION_STATE
828
- if (TEST (live_state, CALIBRATION) == calibration_stop_state) stepper.quick_stop ();
829
- #else
830
- if (TEST (live_state, Z_MIN_PROBE) == calibration_stop_state) stepper.quick_stop ();
831
- #endif
832
- }
826
+ if (calibration_probe_enabled
827
+ && calibration_stop_state == TEST (live_state, TERN (HAS_CALIBRATION_STATE, CALIBRATION, Z_MIN_PROBE)))
828
+ stepper.quick_stop ();
833
829
#endif
830
+
834
831
// Signal, after validation, if an endstop limit is pressed or not
835
832
836
833
#if HAS_X_AXIS
837
834
if (stepper.axis_is_moving (X_AXIS)) {
838
- if (!stepper.motor_direction (X_AXIS_HEAD)) { // -direction
835
+ if (!stepper.motor_direction (X_AXIS_HEAD)) {
839
836
#if HAS_X_MIN_STATE
840
837
PROCESS_ENDSTOP_X (MIN);
841
838
#if CORE_DIAG(XY, Y, MIN)
@@ -849,7 +846,7 @@ void Endstops::update() {
849
846
#endif
850
847
#endif
851
848
}
852
- else { // +direction
849
+ else {
853
850
#if HAS_X_MAX_STATE
854
851
PROCESS_ENDSTOP_X (MAX);
855
852
#if CORE_DIAG(XY, Y, MIN)
@@ -868,7 +865,7 @@ void Endstops::update() {
868
865
869
866
#if HAS_Y_AXIS
870
867
if (stepper.axis_is_moving (Y_AXIS)) {
871
- if (!stepper.motor_direction (Y_AXIS_HEAD)) { // -direction
868
+ if (!stepper.motor_direction (Y_AXIS_HEAD)) {
872
869
#if HAS_Y_MIN_STATE
873
870
PROCESS_ENDSTOP_Y (MIN);
874
871
#if CORE_DIAG(XY, X, MIN)
@@ -882,7 +879,7 @@ void Endstops::update() {
882
879
#endif
883
880
#endif
884
881
}
885
- else { // +direction
882
+ else {
886
883
#if HAS_Y_MAX_STATE
887
884
PROCESS_ENDSTOP_Y (MAX);
888
885
#if CORE_DIAG(XY, X, MIN)
@@ -901,7 +898,8 @@ void Endstops::update() {
901
898
902
899
#if HAS_Z_AXIS
903
900
if (stepper.axis_is_moving (Z_AXIS)) {
904
- if (!stepper.motor_direction (Z_AXIS_HEAD)) { // Z -direction. Gantry down, bed up.
901
+ if (!stepper.motor_direction (Z_AXIS_HEAD)) {
902
+ // Z- : Gantry down, bed up
905
903
#if HAS_Z_MIN_STATE
906
904
// If the Z_MIN_PIN is being used for the probe there's no
907
905
// separate Z_MIN endstop. But a Z endstop could be wired
@@ -927,7 +925,8 @@ void Endstops::update() {
927
925
if (z_probe_enabled) PROCESS_ENDSTOP (Z, MIN_PROBE);
928
926
#endif
929
927
}
930
- else { // Z +direction. Gantry up, bed down.
928
+ else {
929
+ // Z+ : Gantry up, bed down
931
930
#if HAS_Z_MAX_STATE
932
931
PROCESS_ENDSTOP_Z (MAX);
933
932
#if CORE_DIAG(XZ, X, MIN)
@@ -944,89 +943,89 @@ void Endstops::update() {
944
943
}
945
944
#endif // HAS_Z_AXIS
946
945
947
- #if HAS_I_AXIS
946
+ #if HAS_I_AXIS && HAS_I_STATE
948
947
if (stepper.axis_is_moving (I_AXIS)) {
949
- if (!stepper.motor_direction (I_AXIS_HEAD)) { // -direction
948
+ if (!stepper.motor_direction (I_AXIS_HEAD)) {
950
949
#if HAS_I_MIN_STATE
951
950
PROCESS_ENDSTOP (I, MIN);
952
951
#endif
953
952
}
954
- else { // +direction
953
+ else {
955
954
#if HAS_I_MAX_STATE
956
955
PROCESS_ENDSTOP (I, MAX);
957
956
#endif
958
957
}
959
958
}
960
959
#endif // HAS_I_AXIS
961
960
962
- #if HAS_J_AXIS
961
+ #if HAS_J_AXIS && HAS_J_STATE
963
962
if (stepper.axis_is_moving (J_AXIS)) {
964
- if (!stepper.motor_direction (J_AXIS_HEAD)) { // -direction
963
+ if (!stepper.motor_direction (J_AXIS_HEAD)) {
965
964
#if HAS_J_MIN_STATE
966
965
PROCESS_ENDSTOP (J, MIN);
967
966
#endif
968
967
}
969
- else { // +direction
968
+ else {
970
969
#if HAS_J_MAX_STATE
971
970
PROCESS_ENDSTOP (J, MAX);
972
971
#endif
973
972
}
974
973
}
975
974
#endif // HAS_J_AXIS
976
975
977
- #if HAS_K_AXIS
976
+ #if HAS_K_AXIS && HAS_K_STATE
978
977
if (stepper.axis_is_moving (K_AXIS)) {
979
- if (!stepper.motor_direction (K_AXIS_HEAD)) { // -direction
978
+ if (!stepper.motor_direction (K_AXIS_HEAD)) {
980
979
#if HAS_K_MIN_STATE
981
980
PROCESS_ENDSTOP (K, MIN);
982
981
#endif
983
982
}
984
- else { // +direction
983
+ else {
985
984
#if HAS_K_MAX_STATE
986
985
PROCESS_ENDSTOP (K, MAX);
987
986
#endif
988
987
}
989
988
}
990
989
#endif // HAS_K_AXIS
991
990
992
- #if HAS_U_AXIS
991
+ #if HAS_U_AXIS && HAS_U_STATE
993
992
if (stepper.axis_is_moving (U_AXIS)) {
994
- if (!stepper.motor_direction (U_AXIS_HEAD)) { // -direction
993
+ if (!stepper.motor_direction (U_AXIS_HEAD)) {
995
994
#if HAS_U_MIN_STATE
996
995
PROCESS_ENDSTOP (U, MIN);
997
996
#endif
998
997
}
999
- else { // +direction
998
+ else {
1000
999
#if HAS_U_MAX_STATE
1001
1000
PROCESS_ENDSTOP (U, MAX);
1002
1001
#endif
1003
1002
}
1004
1003
}
1005
1004
#endif // HAS_U_AXIS
1006
1005
1007
- #if HAS_V_AXIS
1006
+ #if HAS_V_AXIS && HAS_V_STATE
1008
1007
if (stepper.axis_is_moving (V_AXIS)) {
1009
- if (!stepper.motor_direction (V_AXIS_HEAD)) { // -direction
1008
+ if (!stepper.motor_direction (V_AXIS_HEAD)) {
1010
1009
#if HAS_V_MIN_STATE
1011
1010
PROCESS_ENDSTOP (V, MIN);
1012
1011
#endif
1013
1012
}
1014
- else { // +direction
1013
+ else {
1015
1014
#if HAS_V_MAX_STATE
1016
1015
PROCESS_ENDSTOP (V, MAX);
1017
1016
#endif
1018
1017
}
1019
1018
}
1020
1019
#endif // HAS_V_AXIS
1021
1020
1022
- #if HAS_W_AXIS
1021
+ #if HAS_W_AXIS && HAS_W_STATE
1023
1022
if (stepper.axis_is_moving (W_AXIS)) {
1024
- if (!stepper.motor_direction (W_AXIS_HEAD)) { // -direction
1023
+ if (!stepper.motor_direction (W_AXIS_HEAD)) {
1025
1024
#if HAS_W_MIN_STATE
1026
1025
PROCESS_ENDSTOP (W, MIN);
1027
1026
#endif
1028
1027
}
1029
- else { // +direction
1028
+ else {
1030
1029
#if HAS_W_MAX_STATE
1031
1030
PROCESS_ENDSTOP (W, MAX);
1032
1031
#endif
0 commit comments