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

Stepper_enable_control causes issues #6

Open
JomerDev opened this issue Dec 12, 2024 · 5 comments
Open

Stepper_enable_control causes issues #6

JomerDev opened this issue Dec 12, 2024 · 5 comments

Comments

@JomerDev
Copy link

Hello. I've compiled grblHAL to use Stepper_enable_control since I need that functionality in a project and it seems for larger files the plugin causes issues. Most of the time if I have a file with the M17 and M18 in them and start it (via ioSender) some of the steppers never start or only start and run once and no longer after that. I've checked the order and placement of the added commands multiple times to no avail. Interestingly, even if the motors are nor actually running their position changes as if they ran just fine.
If I run the same code in multiple parts it usually works without issue. I first thought that it was a buffer issue, but changing the buffer sizes didn't change anything.

I've attached one of the broken files here: gerade.zip
Note, I've tried swapping M17 and M18 around since I wasn't 100% sure which was enable and which was disable, neither version made a difference

@terjeio
Copy link
Contributor

terjeio commented Dec 13, 2024

M17 is enable, M18 (or M84) is disable. M17 is only in effect until the next set of motions is completed (basically until next IDLE status) unless $1 (Step idle delay) is set to 255.
M18 takes effect immediately, even if there are queued motions, unless a delay is specified. And if a delay is specified then after the delay - again even if there are queued motions at that point in time. One could add a G4 delay after M18, but this will not work since a transition from IDLE to CYCLE will reenable all motors. This means that currently it is not possible to switch motors on/off while motion is ongoing. And since M17/M18 only controls the motor enable signals steps will still be sent and positions updated.

If you want to mask which axes step pulses are sent to a different plugin has to be made.

@JomerDev
Copy link
Author

Ok, so I either need to use M17 255 every time or add M17 before every command where the motor should run?
And I probably need to put M400 before M18 so any move still running is done fore the motor gets disabled.
Thank you, thats good to know

@terjeio
Copy link
Contributor

terjeio commented Dec 14, 2024

Ok, so I either need to use M17 255 every time or add M17 before every command where the motor should run?

No, motors will be turned on automatically whenever there is motion commanded. And turned off 25 ms after motion is completed unless the $9 setting is changed to a different value than the default 25. Setting $9=255 is a special since that leaves the motors enabled at all times. Other values changes the off delay. M17 and M18 is for those who need more explicit control over when motors are enabled/disabled. There is also a setting, $37, that can be used instead of setting $9=255 if you want specific motors to be kept enabled at all times. E.g. some wants to keep Z enabled since gravity may pull the spindle down if not.

@JomerDev
Copy link
Author

Yes, I have a similar situation, I have a wire bending machine and one of the steppers is pressing the wire against a mold hold in position by the second stepper. If the second stepper is turned off it will get pushed back, if I keep it enabled the stepper driver gets very hot after a bit. So I want to control the second stepper to stay on while the first stepper is pushing against it.
So I'm trying to use M17 and M18 to that effect, with the issue mentioned above.
From the first answer it seems like my issue might be that sometimes the stepper gets disabled before it is finished with it's motion, so I'll have to try and make sure that M18 is only called after the motion is done for sure

@terjeio
Copy link
Contributor

terjeio commented Dec 17, 2024

So I want to control the second stepper to stay on while the first stepper is pushing against it.

For how long? If less than 65535 ms (about one minute) you can set the delay using $1.
If longer then set $1 to 255 (keeps the steppers enabled) and then
G4P0.1
M18S<delay> where <delay> is number of seconds to keep the steppers enabled.
or if $1 <> 255 and > 100
G4P0.1
M17
M18PS<delay> where <delay> is number of seconds to keep the steppers enabled.

G4P0.1 waits until queued motions has completed plus 100 ms.

When $1 = 255 you may want to disable the steppers at startup by adding M18 to a startup command: $N0=M18

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

No branches or pull requests

2 participants