grblHAL / core

grblHAL core code and master Wiki
Other
320 stars 84 forks source link

Spindle on delay shouldn't require spindle sync #220

Closed devknoll closed 1 year ago

devknoll commented 1 year ago

https://github.com/grblHAL/core/blob/fbef120e947117f88b42fcea3716237d4c8babec/settings.c#L1730

The general spindle delay seems to require spindle sync (via the cap.at_speed). Seems like this should be !hal.spindle.cap.at_speed instead, since spindle sync has its own way (i.e. speed tolerance) to delay.

(I'm not at a desktop, otherwise I would PR this)

terjeio commented 1 year ago

Setting_SpindleOnDelay is the delay before an alarm is generated if the actual RPM is not within limits. It is dependent on at speed capability of the spindle, derived from RPM read either from an encoder or by other means provided by the spindle driver. E.g. VFD spindles typically provides the RPM as a readout from a (modbus) register, no encoder is needed. The default driver provided spindle code can provide RPM readout in some form independent of whether spindle sync is enabled or not - but is mostly related to the spindle sync code (for now) since spindle sync requires it.

An example of RPM readout from an encoder when spindle sync is not enabled can be found in the MSP432P401 driver, from an experiment with PID controlled RPM.

devknoll commented 1 year ago

In particular, I was looking at this branch:

https://github.com/grblHAL/core/blob/fbef120e947117f88b42fcea3716237d4c8babec/spindle_control.c#L299

So the value looks like it will be used without triggering an alarm, but the setting doesn't appear (because the same at_speed check fails in settings.c)

terjeio commented 1 year ago

I use the same settings value (but different setting ids) for both the alarm delay and spindle spinup delay on door close when safety door is enabled - this since the functionality is more or less the same and having two independent setting values might be confusing. If the spindle supports the at speed capability then the delay is for the alarm else it is a plain spinup delay with no RPM verification.

devknoll commented 1 year ago

Is there a way if I don't have at speed support and I don't have a safety door, and just want a plain spin up delay (with no RPM verification)? My spindle takes a moment to ramp up to e.g. 18k, and after a tool change it will frequently try to start cutting immediately, before the spindle has reached the correct speed.

Thanks!

terjeio commented 1 year ago

You have to use G4P to add a delay before continuing. Typically this is added to the post processor.

And for those who have a door switch: the spin up delay is only added when the door is closed.

devknoll commented 1 year ago

Makes sense, thanks!