grblHAL / core

grblHAL core code and master Wiki
Other
304 stars 73 forks source link

How to limit the maximum output pulse frequency to prevent the user from setting an excessively high pulse rate that could cause grblHAL to crash? #522

Closed hanke-cnc closed 1 month ago

hanke-cnc commented 1 month ago

Some servo users like to set very high pulse rates, which can cause grblHAL to crash. They might think this is a sign of instability. I don't want to keep explaining this to them. I want to take some actions to prevent it from crashing, reduce the user's speed, and issue a warning to them. Anything is fine as long as it doesn't crash.

terjeio commented 1 month ago

hal.max_step_rate can be set by the driver on startup, if set an error will be issued on attempts to set it higher. I have not profiled any driver yet so currently it is not set for any driver. If you have a reasonable value (or values since the max may differ slightly depending on how many motors are driven) I may add it. Other parameters that also affects the max. rate is step pulse length and delay, these has to be set to within spec. of the stepper drivers and be short enough to allow for clean pulses.