Skip to content

Commit

Permalink
🩹 Endstops prelim. followup
Browse files Browse the repository at this point in the history
  • Loading branch information
thinkyhead committed May 7, 2023
1 parent 12d8108 commit 99a9e26
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
4 changes: 2 additions & 2 deletions Marlin/src/module/endstops.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -311,7 +311,7 @@ void Endstops::event_handler() {
SERIAL_ECHOPGM(" " STRINGIFY(A) ":", planner.triggered_position_mm(_AXIS(A))); _SET_STOP_CHAR(A,C); }while(0)

#define _ENDSTOP_HIT_TEST(A,C) \
if (TERN0(HAS_##A##_MIN, TEST(hit_state, A##_MIN)) || TERN0(HAS_##A##_MAX, TEST(hit_state, A##_MAX))) \
if (TERN0(USE_##A##_MIN, TEST(hit_state, ES_ENUM(A,MIN))) || TERN0(USE_##A##_MAX, TEST(hit_state, ES_ENUM(A,MAX)))) \
_ENDSTOP_HIT_ECHO(A,C)

#define ENDSTOP_HIT_TEST_X() _ENDSTOP_HIT_TEST(X,'X')
Expand Down Expand Up @@ -792,7 +792,7 @@ void Endstops::update() {
}while(0)

// Core Sensorless Homing needs to test an Extra Pin
#define CORE_DIAG(QQ,A,MM) (CORE_IS_##QQ && A##_SENSORLESS && !A##_SPI_SENSORLESS && HAS_##A##_##MM)
#define CORE_DIAG(QQ,A,MM) (CORE_IS_##QQ && A##_SENSORLESS && !A##_SPI_SENSORLESS && USE_##A##_##MM)
#define PROCESS_CORE_ENDSTOP(A1,M1,A2,M2) do { \
if (TEST_ENDSTOP(_ENDSTOP(A1,M1))) { \
_ENDSTOP_HIT(A2,M2); \
Expand Down
3 changes: 3 additions & 0 deletions Marlin/src/module/endstops.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@
#include "../inc/MarlinConfig.h"
#include <stdint.h>

#define _ES_ENUM(A,M) A##_##M
#define ES_ENUM(A,M) _ES_ENUM(A,M)

#define _ES_ITEM(N) N,
#define ES_ITEM(K,N) TERN_(K,DEFER4(_ES_ITEM)(N))

Expand Down
2 changes: 1 addition & 1 deletion Marlin/src/module/stepper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,7 @@ xyze_int8_t Stepper::count_direction{0};
#define MINDIR(A) (count_direction[_AXIS(A)] < 0)
#define MAXDIR(A) (count_direction[_AXIS(A)] > 0)

#define STEPTEST(A,M,I) TERN0(HAS_ ##A## ##I## _ ##M, !(TEST(endstops.state(), A## ##I## _ ##M) && M## DIR(A)) && !locked_ ##A## ##I## _motor)
#define STEPTEST(A,M,I) TERN0(USE_##A##I##_##M, !(TEST(endstops.state(), A##I##_##M) && M## DIR(A)) && !locked_ ##A##I##_motor)

#define DUAL_ENDSTOP_APPLY_STEP(A,V) \
if (separate_multi_axis) { \
Expand Down

0 comments on commit 99a9e26

Please sign in to comment.