42 lines
875 B
Plaintext
42 lines
875 B
Plaintext
//CNCExtension Hal Component
|
|
|
|
component collisionavoid "Avoid Collisions";
|
|
|
|
pin in float xaxis;
|
|
pin in float yaxis;
|
|
pin in float zaxis;
|
|
|
|
pin in bit chuck;
|
|
pin in bit table;
|
|
|
|
pin out bit stop;
|
|
|
|
option singleton yes; // makes no sense to have more than one of these components running
|
|
option userspace yes;
|
|
|
|
license "GPL";
|
|
;;
|
|
|
|
#include <stdio.h> /* Standard input/output definitions */
|
|
|
|
|
|
void user_mainloop(void)
|
|
{
|
|
FOR_ALL_INSTS() //needed for resaons
|
|
{
|
|
while(1)
|
|
{
|
|
usleep(500);
|
|
if(chuck == 1 && xaxis > 107 && yaxis < 32 && zaxis < -25 ) stop = 1;
|
|
else if(table == 1 && xaxis > 107 && yaxis < 32 && zaxis < -25 ) stop = 1;
|
|
else stop = 0;
|
|
|
|
}
|
|
}
|
|
exit(0);
|
|
}
|
|
|
|
|
|
|
|
|