Hi jossa,
See the ExternalButtons.c example on how to debounce an external push button and send a command like Halt to KMotionCNC. Here is the code fragment to send Halt when the external bit transitions to a solid high level:
Code:
// Handle HALT
result = Debounce(ReadBit(HALTBIT),&hcount,&hlast,&hlastsolid);
if (result == 1)
{
DoPC(PC_COMM_HALT);
}
This code can be added to a loop in your initialization C program. The Debounce function, the prototype (function definition at the beginning) for the Debounce function, the variables needed to do the debouncing, and the definition for the External Bit also need to be add as shown in the example.
To do the re-initialization you could loop back to the beginning of the Initialization program when the External Initialization button was detected. Or alternatively I believe you could just "push" the KMotionCNC User Button to cause the Init Program to be killed, reloaded, and re-executed.
HTH
Regards