Help with Macro that logs homing deviation
Posted: Thu Feb 22, 2024 4:04 am
I have a machine that is having intermittent step loss issues. I have 2 objectives
1. Rehome the machine after each cut, we suspect the step loss happens at the end of the cut, rehoming the machine would allow it to reset the home position in preparation for the next run. The appears to be as simple as a G28.1 command in the M30 macro.
2. Log the difference in home position. Lets say I lost steps and it causes a .050" positioning error in the y axis. The machine would travel to the Y axis limit, when triggered log the -0.050" position value in a sheet with date and time, and then set the the machine coordinate system to zero (essentially homing the machine).
Having never written a macro in UCCNC before, this was my thought process. (This would triggered via the M30 macro
Define slow home speed, fast home speed, warning limit, and file location.
1. Turn off soft limits
2. Move Z axis to switch at a fast home speed till switch hit
3. Retract Z axis .25"
4. Move Z axis to switch at slow home speed till switch hit
5. Save Z axis readout to variable
6. Move Y axis to switch at a fast home speed till switch hit
7. Retract Y axis .25"
8. Move Y axis to switch at slow home speed till switch hit
9. Save Y axis readout to variable
10. Move X axis to switch at a fast home speed till switch hit
11. Retract X axis .25"
12. Move X axis to switch at slow home speed till switch hit
13. Save X axis readout to variable
14. Write X, Y, and Z values + date/time + current G-Code File to Log File
15. Set machine coordinates to 0,0,0 (or alternatively move away from switches by .5" and run G28.1 to home).
16. Popup a window telling the operator if error exceeded some defined limit
I'm still researching if this is possible via Macros. I would welcome any suggestions for improvement.
I plan to use some of the macros provided here by Robert Spark as a reference while writing the Macro. https://cncdrive.com/forum/viewtopic.ph ... 1&start=10
Thanks
1. Rehome the machine after each cut, we suspect the step loss happens at the end of the cut, rehoming the machine would allow it to reset the home position in preparation for the next run. The appears to be as simple as a G28.1 command in the M30 macro.
2. Log the difference in home position. Lets say I lost steps and it causes a .050" positioning error in the y axis. The machine would travel to the Y axis limit, when triggered log the -0.050" position value in a sheet with date and time, and then set the the machine coordinate system to zero (essentially homing the machine).
Having never written a macro in UCCNC before, this was my thought process. (This would triggered via the M30 macro
Define slow home speed, fast home speed, warning limit, and file location.
1. Turn off soft limits
2. Move Z axis to switch at a fast home speed till switch hit
3. Retract Z axis .25"
4. Move Z axis to switch at slow home speed till switch hit
5. Save Z axis readout to variable
6. Move Y axis to switch at a fast home speed till switch hit
7. Retract Y axis .25"
8. Move Y axis to switch at slow home speed till switch hit
9. Save Y axis readout to variable
10. Move X axis to switch at a fast home speed till switch hit
11. Retract X axis .25"
12. Move X axis to switch at slow home speed till switch hit
13. Save X axis readout to variable
14. Write X, Y, and Z values + date/time + current G-Code File to Log File
15. Set machine coordinates to 0,0,0 (or alternatively move away from switches by .5" and run G28.1 to home).
16. Popup a window telling the operator if error exceeded some defined limit
I'm still researching if this is possible via Macros. I would welcome any suggestions for improvement.
I plan to use some of the macros provided here by Robert Spark as a reference while writing the Macro. https://cncdrive.com/forum/viewtopic.ph ... 1&start=10
Thanks