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

fix pins postprocessing for Z_MULTI_ENDSTOPS #27137

Merged
merged 5 commits into from
Jun 8, 2024

Conversation

ellensp
Copy link
Contributor

@ellensp ellensp commented May 28, 2024

Description

Marlin/src/pins/pins_postprocess.h for Z_MULTI_ENDSTOPS doesn't work as desired

The Idea of pins_postprocess is to automatically juggle existing pins around as the features requires it.
In this case the feature is Z_MULTI_ENDSTOPS

Z Stop works:
(works) Use Z_MIN_PIN or Z_MAX_PIN when defined.
(works) If Z_STOP_PIN is defined automatically converted to Z_MIN_PIN or Z_MAX_PIN depending on your homing direction as needed

Z2 Stop does not work as it should:
(works) Use Z2_MIN_PIN or Z2_MAX_PIN when defined.
(works) If Z2_STOP_PIN exists it is automatically converted to Z2_MIN_PIN or Z2_MAX_PIN depending on your homing direction
(faulty) If Z2_STOP_PIN does not exist and a unused Z_MIN_PIN or Z_MAX_PIN is defined use that as Z2_STOP_PIN
Currently it can define Z2_STOP_PIN as Z_STOP_PIN even when this is in conflict
(faulty) error if there are no options left. No error in current code.

Z3 Stop does not work as it should:
(works) Use Z3_MIN_PIN or Z3_MAX_PIN when defined.
(works) If Z3_STOP_PIN exists it is automatically converted to Z3_MIN_PIN or Z3_MAX_PIN depending on your homing direction
(faulty) There is no standard pin to reuse as this pin, so error if there are no options left
Currently Z4_STOP_PIN will be defined as Z_STOP_PIN even when this is in conflict

Z4 Stop does not work as it should:
(works) Use Z4_MIN_PIN or Z4_MAX_PIN when defined.
(works) If Z4_STOP_PIN exists it is automatically converted to Z4_MIN_PIN or Z4_MAX_PIN depending on your homing direction
(faulty) There is no standard pin to reuse as this pin, so error if there are no options left
Currently Z4_STOP_PIN will be defined as Z_STOP_PIN even when this is in conflict

Updated to correct all of these

Added some sanity checks for commonly miss configured X2_STOP, X3_STOP and X4_STOP pins.

Requirements

Z_MULTI_ENDSTOPS

Benefits

Marlin auto selects correct stop pins

Related Issues

#27014 (comment)

@ellensp
Copy link
Contributor Author

ellensp commented May 28, 2024

@thinkyhead When you come to review this please go over this with a fine tooth comb, Programmed very late at night on almost no sleep

CI error is unrelated to this PR

@thisiskeithb thisiskeithb linked an issue May 28, 2024 that may be closed by this pull request
1 task
@thinkyhead
Copy link
Member

Thanks for catching this one. The architecture of this thing can be tedious with so many scattered elements, but I'm sure we'll get it all wrangled in time. Perhaps "Armlin" would be a good codename for a 32-bit-only codebase with a more sensible high-level architecture.

@ellensp
Copy link
Contributor Author

ellensp commented Jun 8, 2024

"assume a shared pin"

Why would you assume a shared pin when you enabled Z_MULTI_ENDSTOPS? This is the opposite of what Z_MULTI_ENDSTOPS is for.

I do not think this is a desirable outcome when you set Z_MULTI_ENDSTOPS

@thinkyhead
Copy link
Member

Yeah, it's a strange idea. I don't know what the original rationale was for that choice, but I didn't want to change it right away without looking further. I expect we'll go back to asserting separate endstop pin defines, but maybe we'll tweak the error to explain the use cases. … I'll review the history now and then apply whatever is most sensible.

@thinkyhead
Copy link
Member

Couldn't find any specific misuse cases, but reading the history was good for a few chuckles.

@thinkyhead thinkyhead merged commit 1d29a56 into MarlinFirmware:bugfix-2.1.x Jun 8, 2024
62 checks passed
@ellensp ellensp deleted the auto-endstops branch June 9, 2024 03:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[BUG] Dual Z Stepper with dual endstop don't work
2 participants