Create a new HALUI MDI command with one line in your .ini file:
[HALUI]
MDI_COMMAND = G92 X0 Y0
This causes a new HAL pin to be created, called halui.mdi-command-00. Then wire that pin up to the joystick button that you want to cause that command to be run, with an line in your .hal:
net setXYOrigin input.0.btn-thumb2 => halui.mdi-command-00
Now pressing that button (in this case, the thumb 2 button) runs G92 X0 Y0, just as if I'd typed it in the MDI box. This setup allows me to use the joystick to jog to the place that I want my origin to be, and then set that to be my XY origin by pressing the button.
You can have any number of MDI_COMMAND .ini lines, and they each make make their own mdi-command-xx pin, ordered in the order they appear in the file.
Each one can run any one liner. In the next post I'll talk about running more than one line from a single button.
No comments:
Post a Comment