Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

init max endstop pins if corresponding flag USE_MAX is enabled #19532

Closed

Conversation

Le0Michine
Copy link

Requirements

  • Filling out this template is required. Pull Requests without a clear description may be closed at the maintainers' discretion.

Description

Added init max endstops for scenario when user wants to use USE_XMAX_PLUG, USE_YMAX_PLUG or USE_ZMAX_PLUG and doesn't have SENSORLESS_HOMING enabled (ie STALL_SENSITIVITY is undefined).

Benefits

The use case is dual Z motors which require usage of one of those MAX plugs for the second Z_MIN endstop. If neither of MAX_PIN parameters defined compilation fails with a simiilar error

#error "Z2_USE_ENDSTOP has been assigned to a nonexistent endstop!"

Configurations

Here is the related parameters

Configuration_adv.h

// #define SENSORLESS_HOMING // StallGuard capable drivers only
...
#define NUM_Z_STEPPER_DRIVERS 2
....
#define Z2_USE_ENDSTOP          _YMAX_

Configuration.h

#define USE_YMAX_PLUG

Related Issues

I didn't see any related open issues.

This is required in case if sensorless homing was not enabled for either of axis and one wants to use dual Z motors with two endstops. If MAX_PIN is not initialised compilation would fail with error `#error "Z2_USE_ENDSTOP has been assigned to a nonexistent endstop!"`
@ellensp
Copy link
Contributor

ellensp commented Sep 28, 2020

SKR 1.4 does not have max plugs
It has x,y and Y endstop plugs plugs and e0-det, e1-det and pwr-det and if you try an use anything else in these plug the diag pins from e0 and e1 stepper drivers will interfere with it.

@Le0Michine
Copy link
Author

Le0Michine commented Sep 28, 2020

According to BTT docs diag pins are supposed to be cut to avoid that in case sensorless homing is not used as it would interfere with x, y and z min. It seems for E0, E1 one would also need to cut diag pins to be able to use filament runout sensors.

Besides in the code E0_DET E1_DET and PWR_DET were already assigned as X_MAX_PIN, Y_MAX_PIN and Z_MAX_PIN in lines 59, 70 and 81 respectively.

Do you see any particular reason why not to set X_MAX_PIN, Y_MAX_PIN and Z_MAX_PIN in case when STALL_SENSITIVITY is not defined?

@thinkyhead
Copy link
Member

thinkyhead commented Sep 28, 2020

Do you see any particular reason why not to set X_MAX_PIN, Y_MAX_PIN and Z_MAX_PIN in case when STALL_SENSITIVITY is not defined?

For one thing, they can't serve that function. If the X axis homes to max then the X_STOP_PIN is the X max endstop. I don't see the value of forcing the X endstop of all machines that use this board to connect to the E0_DIAG_PIN when homing to max. Each axis only needs a single endstop plug. The existing exposure of the "other" pin as the "other endstop" pin was provided by request, and is exactly opposite of the effect of this PR.

@thinkyhead thinkyhead closed this Sep 28, 2020
@Le0Michine
Copy link
Author

@thinkyhead for some configurations it is required to have multiple endstops for a single axis, a good example of that is dual Z motors. In Configuration_adv.h it is possible to use MAX pins as extra endstops however that won't work unless they are initialized which is currently happening only when sensorless homing is enabled. I find it unclear why those pins can serve the purpose of X_MAX plugs when stallguard is enabled and can't when it is not, would appreciate it if you could clarify that to me. My understanding is that it won't be used as MAX plug unless user explicitly enables it, same goes for filament runout, so user still can use those ports for either of functions. But not having them defined in the pins files essentially blocks user from using dual Z axis without sensorless homing and fails compilation with an unclear error.

I also wanted to bring your attention to the fact that in SKR 1.3 has exact same plugs set for the endstop the only difference is the labels, please refer the links below to see the exact same assignment of pins as in this PR (same pin assigned to x_max and filament runout). Would that resolve your concern regarding my change?

https://github.com/MarlinFirmware/Marlin/blob/2.0.x/Marlin/src/pins/lpc1768/pins_BTT_SKR_V1_3.h#L47
https://github.com/MarlinFirmware/Marlin/blob/2.0.x/Marlin/src/pins/lpc1768/pins_BTT_SKR_V1_3.h#L94

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants