Add Home button in KMotionCNC
Posted: Tue Jun 04, 2019 10:55 pm
Need a Home button to go to zero position.
From right click on KMotionCNC>Tool setup screen>User Buttons
Add button name eg Home.
Add key eg 100.
Add execute prog.
Add thread eg 4.
Add var eg 0.
Create "home.c" file and point to it in c file field.
Note I created the home.c file using Atom which is a text/code editor and not something like Microsoft Visual Studio so no compiling but I don't think I need to.
The home.c file looks like:
#include "KMotionDef.h"
//Brings the head back to X0,Y0,Z0,A0,B0,C0,U0,V0 position after Pause button while motors are still on. Will not work after Stop button. Note my machine uses 8 axis so that is why it is so long.
Here is the code which I have no idea.
I noted all I have to do is replicate what the Manual Entry field does as if I enter G1 X0 Y0 Z0 A0 B0 C0 U0 VO and hit Send it works. "The Manual Entry cell allows the user to quickly enter a single line of G Code and Send it to the interpreter for execution." -the field below the gcode window.
I guess the code would also have to pause the gcode file from running if it is, keep the motors powered, and also do what the Restart button does above the gcode window.
So the head goes to zero position and the gcode file can be run again from the start or another file can be loaded.
If someone knows how the code will look if you can hack that out with some comments it would be the fastest way to explain how to do it as I think it will be a very short code. Ok cheers.
From right click on KMotionCNC>Tool setup screen>User Buttons
Add button name eg Home.
Add key eg 100.
Add execute prog.
Add thread eg 4.
Add var eg 0.
Create "home.c" file and point to it in c file field.
Note I created the home.c file using Atom which is a text/code editor and not something like Microsoft Visual Studio so no compiling but I don't think I need to.
The home.c file looks like:
#include "KMotionDef.h"
//Brings the head back to X0,Y0,Z0,A0,B0,C0,U0,V0 position after Pause button while motors are still on. Will not work after Stop button. Note my machine uses 8 axis so that is why it is so long.
Here is the code which I have no idea.
I noted all I have to do is replicate what the Manual Entry field does as if I enter G1 X0 Y0 Z0 A0 B0 C0 U0 VO and hit Send it works. "The Manual Entry cell allows the user to quickly enter a single line of G Code and Send it to the interpreter for execution." -the field below the gcode window.
I guess the code would also have to pause the gcode file from running if it is, keep the motors powered, and also do what the Restart button does above the gcode window.
So the head goes to zero position and the gcode file can be run again from the start or another file can be loaded.
If someone knows how the code will look if you can hack that out with some comments it would be the fastest way to explain how to do it as I think it will be a very short code. Ok cheers.