Hi Tom,
Thanks very much for your help with the previous issue. I'm finally getting back to this again and having a problem I'd appreciate some help with please.
I have now got my axes jogging correctly from the KMotionCNC Jog buttons, and so I'm trying to get an axis homing routine for X & Z set up with some limited success. I have been having some strange things happening. At least they seem strange to me, but you'll probably see what's going on. I'll describe it as best I can.
I started by using SimpleHomeIndexFunction.c & SimpleHomeIndexFunctionTest.c. I set up the correct call parameters for my Z axis only (I prefer to deal with one problem at a time) in the Test program, remmed out the X & Y sections of the code and got that working successfully. I don't currently have an Index signal, so I'm just using the Limit switch for both functions. So far, so good.
I then swapped the Z axis parameters for the X axis ones and that worked too.
Time to put them both together - I put the appropriate parameters into the Z & X sections, leaving the Y section still remmed and tried it out. That's where the wheels fell off for me. I was running it as C Program #4 in KMotion and it started out homing the Z axis, but then just stopping in the called routine (I presume) because it no longer printed out the success or otherwise text on the Command Screen as it had previously. It made no attempt to move on to the X axis and the green running 'flag' was left on in the C Programs window.
I tried adding printf statements through the code to try to diagnose where it had reached before stopping, but these were rather random as to whether they would print or not, which I thought rather strange too. Sometimes it was as if they were being caught in a buffer somewhere and suddenly it would print several of them all at once. It appears that I've got the syntax incorrect on the 'Jog Axis' one, but I can't see why. Eventually, it did nothing (visible) when I hit Run again so I started KMotionCNC to make sure that the I could still jog the axes. They worked, and then the Home program would run the Z axis again each time, but still not the X.
After some testing, I discovered that if I ran the Home program (which homed Z only) then jogged the Z axis in KMCNC, the X axis would then immediately home correctly. It is as if the jogging in KMCNC somehow snaps the Homing program out of its dead spot and it then continues! This probably all makes sense to you, but it surely doesn't to me in my ignorance!
I'd appreciate knowing where I have gone wrong please. My files are attached.
Additionally, there are three 'return's after the 'Homing failed' messages in the SimpleHomeIndexFunctionTest code which I can't make out the reason for. Would you mind please explaining their purpose for me? I've remmed them out and left them in - it makes no difference to the problem.
Thanks very much & have a great day!
Peter