Added boundary function & fix ORIGIN function#42
Conversation
|
And this second patch (d7ae54c) fixes the other problem I'm encountering with the current firmware: the ORIGIN function did not work. After setting the origin, the head would crash into the top when running a file or during subsequent MOVEs. Now I'm aware this is a large patch, and it's never funny if anyone completely messes up your own code. But I had to do some refactorings in order to get this to work and make the code understandable: In LaosMotion I've made a clear distinction between relative and absolute coordinates. For example, moveTo() has been split into two functions: Similarly I've added getCurrentPositionRelativeToOrigin() and getCurrentPositionAbsolute(), Initially home coordinate and origin are the same. Pressing the ORIGIN button changes this, as if the current position is the home position. This effectively means that the current position becomes the top left coordinate of the workpiece, i.e. (0,0) in VisiCut. Secondly, LaosMotion::write() no longer directly calls into the planner to make moves, but rather uses the above moveToRelativeToOrigin(). In other words all simplecode is now interpreted relative to the set origin. Finally I couldn't resist to do a bit of cleanup by removing some static/global variables. For example, LaosMenu maintained its own x,y,z variables to keep the position of the head during MOVE. I've changed this into calls to LaosMotion to get the current position and then move to the new position, thus no longer maintaining its own state. |
|
Just checking, did you also add soft/hard axis limits? (see: #34) When users begin a file somewhere else this becomes much more important. In the future it would be nice to communicate to something like VisiCut that the origin has changed, because there also a set origin feature in VisiCut. Great that you're contributing to LaOS! |
|
Yes I was planning to add the limit checks later. It's relatively easy because LaosExtent can process the file first, so we know beforehand if the job will run into the limits. Anyway there's still a bug in the Origin feature, it's only working if the home switches are at the top left. I will fix that later. |
|
Ok, I hope these latest patches fix the bugs:
|
|
Correct me if I'm wrong, but the bed height should be deductable from existing variables: Visicut and config.txt sizes should be identical. If not, that's a configuration mistake, which should not be fixed by introducing new variables. |
|
Boundary checks work now on my machine and so does limit enforcing. Still I think there is no need to introduce new config variables. Bedheight is a know variable already and enforcelimits is useless, since it should not be optional (limits are there to be enforced). Since the current patch shouldn't break existing configurations, I will merge it as is, with the above points still to be fixed in code. |
Added boundary function & fix ORIGIN function
This reverts commit 0d5e966, reversing changes made to ade5ccd. See http://redmine.laoslaser.org/boards/3/topics/765?r=785
I've added a BOUNDARIES menu between RUN and DELETE. This scans the file to determine the bounding rectangle, moves the laser head around the bounding rectangle and displays the dimensions.