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 autoleveller interpolation bug and make it use correct variable numbers #491

Merged
merged 2 commits into from
Dec 7, 2020

Conversation

Uks2
Copy link
Contributor

@Uks2 Uks2 commented Dec 6, 2020

This should fix issue #490 by making the making the interpolation algorithm only uses two points if it's directly between them.

Also, the autoleveller's constructor generates a collection of unique variables, but these were only being used in one place, with variables #1 - #3 being used everywhere else. This change makes it so that the generated variables are used throughout the code.

@@ -414,9 +410,7 @@ X-4.81601 Y-2.92779 Z[#3+-0.04000]
#2=[#516+[#517-#516]*0.35816]
#3=[#1+[#2-#1]*0.99789]
X-4.81377 Y-2.93518 Z[#3+-0.04000]
#1=[#516+[#517-#516]*0.33331]
#2=[#519+[#520-#519]*0.33331]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great! I see here that we used to access a variable that is larger than #517, but in the new code, there is no usage of variables greater than #517. Excellent!

@eyal0
Copy link
Contributor

eyal0 commented Dec 7, 2020

I ran these commands on your PR:

git rebase -i master -x "SKIP_GERBERIMPORTER_TESTS_PNG=1 make -j 10 check && (./integration_tests.py -j 10 || (./integration_tests.py --fix --add && git commit --amend --no-edit && ./integration_tests.py -j 10))"
git push -f Uks2 HEAD:master

The code is unchanged but the integration tests are fixed.

There is a new bug in CI, I think that the MacOS environment broke. I'll fix that and then we'll be able to submit this with working CI.

Thank you for your efforts. Very well done!

If the autoleveller wants to calculate the height of a point that is
directly between two measured points, it will interpolate between just
those two points, instead of using all four points in the adjacent
square. This fixes a bug where, if the point being calculated was at the
far left or top of the design, the resulting G code would ask for points
off the edge of the design that hadn't been measured.
The autoleveller's constructor generates a collection of unique variable
numbers that it can use when calculating its interpolated heights,
however these where only used in one place (when moving the tool
vertically down at the start of a line) and variables 1, 2 and 3 were
used in the rest of the code. This caused the output G code to reference
the wrong variable when calculating the milling depth at the start of a
line. The autoleveller now uses its generated variables throughout its
code.
@coveralls
Copy link
Collaborator

Coverage Status

Coverage decreased (-0.04%) to 68.154% when pulling 76ae2d0 on Uks2:master into 08c6be7 on pcb2gcode:master.

@eyal0 eyal0 merged commit c3929ef into pcb2gcode:master Dec 7, 2020
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