MaslowCNC / Firmware

Maslow Firmware
GNU General Public License v3.0
261 stars 136 forks source link

Add a system setting for positionErrorLimit, stop cutting if reached #429

Closed blurfl closed 6 years ago

blurfl commented 6 years ago

After each time that position error is reported, check against a limit and take action if the limit is reached.

Note, this leaves GC with a 'Hold' in place rather than a 'Stop'. This leaves the line number visible.The user is asked to click the 'Stop' button to get GC into the same state as the firmware.

GC PR #703 makes an Advanced Setting available to change the value of positionErrorLimit.

BarbourSmith commented 6 years ago

I just had this trigger during the calibration process when measuring the distance between the motors...which is awesome because we are stalling the motor for a fraction of a second there...but also an issue.

Would it be safe to set the threshold to something large like 200mm when entering that step in the settings, and then reset it to normal when moving on?

blurfl commented 6 years ago

Sure. Do we need to save the previous value to restore it?

BarbourSmith commented 6 years ago

I think I can just send a hard coded value, and then pull the original value from the config file, right?

blurfl commented 6 years ago

That's right, sending $42=200 as a macro doesn't change the setting in groundcontrol.ini, just in the EEPROM.

blurfl commented 6 years ago

Darn! That's why I couldn't turn it off while working on the I,J thing...

blurfl commented 6 years ago

This affects 'Test Motors/Encoders/ as well...

blurfl commented 6 years ago

Not sure how to keep the B04 'Test Motors/Encoders' from triggering the position error during the test. It of course will trigger it once the test is complete. Should we use a global flag in the firmware to suspend testing for the the error limit while the B04 is under way, or have B04 stash the value and restore it after the last axis has finished?

davidelang commented 6 years ago

On Wed, 18 Apr 2018, Scott Smith wrote:

Not sure how to keep the B04 'Test Motors/Encoders' from triggering the position error during the test. It of course will trigger it once the test is complete. Should we use a global flag in the firmware to suspend testing for the the error limit while the B04 is under way, or have B04 stash the value and restore it after the last axis has finished?

I would take the attitude that B commands have no safety net, you do exactly what they tell you to do. G commands should have the safety net of limits, stall detection, etc. But let the B commands remain unprotected so that they can be used for unexpected things.

BarbourSmith commented 6 years ago

Great point @blurfl .

What if we just did a reload position at the end of the test so that wherever the sled is is where it's supposed to be at that point? Maybe we should have been doing that anyway?

blurfl commented 6 years ago

position reload

A great idea. Can you point at a place that shows how this is done? I had a quick look but didn't spot it. I'm deep in a trig. rabbit hole over in gcodeCanvas, wanted to stay focussed there.

Here's a branch of firmware that implements a system flag to suspend evaluating position error, and uses it during the B04 process. https://github.com/blurfl/Firmware/tree/test-motors-needs-to-be-exempt-from-position-error-limit

BarbourSmith commented 6 years ago

I believe that line 249 in Gcode.cpp is doing what we want to do:

leftAxis.set(leftAxis.read());

It just reads the current position and tells the axis that it is right where it should be

blurfl commented 6 years ago

Great! Thanks for the quick answer💯👍. A PR is opened 😁 Collaboration is awesome!

BarbourSmith commented 6 years ago

It is!!!!