-
-
Notifications
You must be signed in to change notification settings - Fork 5.4k
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 inaccurate error message #6781
base: master
Are you sure you want to change the base?
Fix inaccurate error message #6781
Conversation
b177eaf
to
3d71e2d
Compare
Thank you for submitting a PR, please be aware that you need to sign off to accept the developer certificate of origin, please see point 3 in https://github.com/Klipper3d/klipper/blob/master/docs/CONTRIBUTING.md#what-to-expect-in-a-review Thanks |
@@ -329,8 +329,9 @@ def __init__(self, config, need_position_minmax=True, | |||
if (self.position_endstop < self.position_min | |||
or self.position_endstop > self.position_max): | |||
raise config.error( | |||
"position_endstop in section '%s' must be between" | |||
" position_min and position_max" % config.get_name()) | |||
"position_endstop in section '%s' must not be outside the range" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the negative wording is less useful. My personal opinion is that the original wording is better.
"The position_endstop must be between position_min and position_max."
(pick a number between 1 and 10...)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is no rule as to when between can be considered inclusive or exclusive, and the grammatical structure of the relevant sentence would not affect this.
You may be able to make deductions or assumptions from the subject and context of the sentence itself or surrounding sentences, but that would be only assumptions.
If the question of inclusion or exclusion were critical, the only way to determine what was intended would be to ask the author or speaker.
Personally, I would say that very strictly the limits of "between" are exclusive. But you cannot tell how any particular person uses it, and therefore, the only appropriate answer to your question is: "If in doubt, ask!"
Addendum (post-acceptance): The fact that "between" is strictly exclusive of the limits can be illustrated by considering its use when referring to physical objects. For example, you might refer to:
the gap/space between two parked vehicles the path between the river and the road
In such cases the 'limits' are the vehicles, river and road: "between" does not include the vehicles, river or road, but refers only to the 'area' within those 'limits', namely the gap/space or path.
Likewise, "between 1 and 10" excludes the 'limits' 1 and 10, and includes only the 'items within those limits, namely 2 to 9.
source: https://english.stackexchange.com/a/118403
And here we're talking about the gap/space between two points. This is almost certainly the reason I subconsciously used the exclusive between
I'm not sure there's a right or wrong answer here, and even if there were there's enough confusion around the topic that the only wording that makes sense for everybody is to just explicitly state that it's inclusive
If you'd said "The position_endstop must be a number between position_min and position_max", I'm almost certain I would have used inclusive but my brain would spawn off a thread wondering why such a sophisticated codebase built around mathematics decided to go with the term "numbers" 😅
I would concur on that one, the proposed wording is more ambiguous. Not sure why you think its misleading? Thanks |
I'm completely open to further revision. I wasn't crazy about the wording either but it was the best accurate wording I could come up at the time I believe this wording is an improvement from my original PR, and will expose the disconnect:
edit: alternatively, and probably betterly, "position_endstop in section '%s' must be between position_min and position_max inclusive" *and while I'm not sure every user will understand what I spent a good 5 minutes going "whyy can't I just set the 0 to the point the endstop tells me is the edge of travel??" And I finally said "this makes no sense maybe the error is wrong" and just yolo'd the following:
And it worked. Yep. Bad error message. This isn't what I was hoping to do--I gave up and physically moved the limit switch--but it works. This configuration is valid. I'm interested in revising the docs on these parameters as they're also technically incorrect when they should pretty much be no-brainers. I'm still not fully grasping what should be a dirt simple concept, and the docs are making it worse
Distance is a measurement between multiple points. If it's a distance, we're missing information.. there's no direction or destination.
"Location of the endstop". This is entirely unhelpful. To be clear, I'm not faulting any devs--I've been doing this professionally for a couple decades, I know. I love love love Klipper and it's a brilliant showcase of FOSS. Major kudos to everyone who contributed and there is loads of good documentation, this just looks like fatigue.
Same as position_max I only had 20-30 minutes to work on this, thus the rushed PR and me moving the limit switch instead of digging to further understand these parameters. I'm happy to make adjustments to the docs here and add it to this PR or submit it as a new PR. If someone wouldn't mind enlightening me that would make this a quick and easy improvement As an aside, I was thinking I could set the endstop to -33, then my new 0 would be the minimum--where the nozzle meets the edge of the print bed. I saw a couple posts where people tried to do the same but I didn't have time to go further I just said "eh, guess it doesn't work like that". I think that would be worth mentioning in the docs in some form or fashion, whether directly or indirectly by explaining the underlying behavior |
I do agree with your other items. In those three statements, the term
I would argue for the min/max the term I don't think the addition of the term The min/max are stepper absolute positions. So it makes no sense for the endstop position to be outside the range between min/max... how would the stepper ever get to the position where the endstop is activated. |
Yep. Agree fully. I think I'm solid on this. I was solid with it 5-6 years ago when I first set it up 😅 I'll try to get changes pushed this weekend. Honestly now that I've been thinking about it, I remember this being a pain point on my initial install
I'll update this to just add the word inclusive. That's a better/cleaner solution and should still pull up existing threads when people search the error message
Oh, absolutely not, I agree. I was changing config values to try to learn how it all works and this ambiguity cost me some time. That was my first attempt and I got that error message. For subsequent attempts, my mind was trying to reconcile "endstop must be between (exclusive) min and max..." with my set of mental notes of how the machine reacted w/ the new settings As I got closer to solving the puzzle, I started to realize that it behaves in a sane manner and this extra condition was throwing me off. That's when I got the confidence to go "I don't care what it says, 0, 0. Works. -33, -33. Works." Apparently it's just a difference in how our brains interpret things 🌈 I kept visualizing points on a line and if someone drew two points on 0 and a point at 10, and then pointed at one of the 0 points and asked "is this point between 0 and 10?", I imagine very few would instinctively say "yes". It's either going to be "no" or someone who's run into this problem before asking if the between is inclusive or exclusive 😅 It took me reading "pick a number between 1 and 10..." aloud for it to click. My brain was all in on "parking space between two cars" mode
Yes! That too! But my mind went to "what in the world are they doing??" thinking there was some voodoo behind the scenes I'll update the title of the PR as well, since "inaccurate" is inaccurate lol |
Thank you for your contribution to Klipper. Unfortunately, a reviewer has not assigned themselves to this GitHub Pull Request. All Pull Requests are reviewed before merging, and a reviewer will need to volunteer. Further information is available at: https://www.klipper3d.org/CONTRIBUTING.html There are some steps that you can take now:
Unfortunately, if a reviewer does not assign themselves to this GitHub Pull Request then it will be automatically closed. If this happens, then it is a good idea to move further discussion to the Klipper Discourse server. Reviewers can reach out on that forum to let you know if they are interested and when they are available. Best regards, PS: I'm just an automated script, not a human being. |
This pull request improves the error message related to the
position_endstop
in stepper sections (e.g.,stepper_y
) to provide clearer guidance on valid input. The original message was misleading by implying that theposition_endstop
must strictly lie betweenposition_min
andposition_max
.The updated error message clarifies that the
position_endstop
must be within or equal to the travel range defined byposition_min
andposition_max
. This change aims to reduce confusion and help users configure their endstop positions more easily.