The leafboy controller will not support mach4 it will only support mach3 and probing is suspect
Yes you can replace the controller with a ESS and c25 plus a few relays to keep it safe ( the spindle on my Kx1 ) wanted to start on switch on )
My Kx1 runs fine on mach4 much smoother than before
Note the USB from smoothe stepper at this time is only mach3
The only problem is the knitting do not trust the tags on the cables and they are all the same colour
Download the manual for your controller from leafboy it will tell you what cable is what note you have 9 limits to contend with
Sorry I cannot help with the relays as you system is slightly different from mine but it's the signal that control the spindle direction one inhibits the spindle until mach4 is fully in control the other helps with CW/CCW.
If you go with these parts note the port two on the c25 the inputs are inverted