-
-
Notifications
You must be signed in to change notification settings - Fork 19.3k
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 bool evalution of XYval and similar types #26936
🐛 Fix bool evalution of XYval and similar types #26936
Conversation
@tombrazier, with this change the backlash compensation behavior is going to change. Previously this bypass would never execute, but now it can:
Do you think that is going to break anything in backlash compensation? I think it will most likely just reduce overhead when this branch is taken, but I haven't examined everything closely. |
Short answer: no I don't think it will break anything. Long answer: The check is for the case where backlash is disabled by setting the amount of correction to zero. In that situation any previously unapplied correction that is recorded in |
@thinkyhead After a long conversation on Discord there are several things I want to draw to your attention about this PR.
|
Fixes Input Shaping bootloop among other issues. See MarlinFirmware#26936 for more information. Co-authored-by: sjasonsmith <[email protected]>
Patch for |
Require explicit cast to get T* pointers from XYval and similar types. This prevents the pointer from being implicitly returned and checked for nullptr when trying to evaluate these structs in boolean expressions.
Description
XYval and similar types has an
operator bool()
which should allow them to be easily tested for zero values in conditional expressions. This was not working, becauseoperator T*()
was being implicitly used instead, which then always evaluated to true.By making the pointer conversion explicit, it is still accessible for use, but will not be automatically used in a boolean expression.
This was found while debugging problems in BACKLASH_COMPENSATION, where the following statement evaluated to false, even though all referenced variables contained zeroed-out data.
if (!correction && !residual_error) return;
Requirements
N/A
Benefits
Remove unintuitive behavior
Configurations
N/A
Related Issues
N/A