grblHAL / core

grblHAL core code and master Wiki
Other
334 stars 88 forks source link

Add Setting for Axis Limitpos #606

Open jeefdumbo opened 1 month ago

jeefdumbo commented 1 month ago

I have a suggestion for homing. The negative home positions are not common for non-professional machines and are therefore rather confusing. My machine, for example, has the Y motors and the limit switches on the Max Position.Setting the origin to 0 is therefore not applicable. When reversing the homing direction I have the negative positions. I therefore added a “Limit Pos” setting for the axes. I can now define the position of the limit switches for each axis. This means it doesn't matter where the limit switches are mounted and I always have a defined position. These changes may not be fully developed but will work. Please excuse my English, I come from German-speaking countries. I hope the pull request is correct. I very rarely work with git

skasti commented 1 month ago

I also have my limit switches on the max-position, and the only "side-effect" of this is that my machines workspace is all in "negative space". And that is quite common as far as I understand 🤔

Not entirely sure I understand why, but I think it was just easier like this back when you had very little computational power on cnc's, and it made it so that going to [0,0,0] would always be safe once homed. This is not guaranteed to be true if you have configured "axis limitpos" so it says you have 300mm z-travel, but in actuality it is 296.7 or something like that. You will have to tune these settings very closely to avoid crashing and to get your [0,0,0] where you want it.

If you want your G54 [0,0,0] to be your closest leftmost corner of your work-space with the machine working in negative space, you just configure the G54 offset to do that 😅

jeefdumbo commented 1 month ago

It is clear that it works even without this setting. It's just more flexible and I can set my home (0,0,0) position to the position I want, to the position of the limit switches or even opposite, regardless of the "reverse homing" setting. I can even place the limit switches in the middle of the machine. And it looks nicer to the eye. In order to avoid collisions, I have to set the machine limits precisely even without this setting. Since it's not a big change, I think it's just a convenient additional function.

terjeio commented 1 month ago

Since it's not a big change

It is and I'll put this on my todo list. The main reason it is a big change is that you have added new data to the settings struct. This will cause a settings reset to defaults on an update - which I do not want to burden the users with too often. Also, I have a few other pending changes to the struct that I want to include when it is revised (and there is a revision number in the struct that has to be updated, along with all the drivers that checks it).

There is a few other issues with your PR as well, you have changed some default values in config.h that should not be changed, and you have hijacked some existing setting numbers- new setting numbers has to be added instead.