Select Git revision
planner.ino
planner.ino 7.10 KiB
void planner()
{
for (int a=0;a<max_ax;a++)
{
if (speed[a]==null_speed) dir[a]=d_stop;
if (speed[a]>null_speed) dir[a]=d_up;
if (speed[a]<null_speed) dir[a]=d_down;
}
for (int a=0;a<max_ax;a++)
{
testpos(a);
}
running=false;
for (int a=0;a<max_ax;a++)
{
if (!sak[a]) running=true;
}
if (running!=lastrunning)
{
if (running) Serial.println("planner: running");
else
{
Serial.println("planner: stop");
for (int a=0;a<max_ax;a++)
{
if (sak[a] and usebrake[a]) setbrake(a,true);
}
if (issequence)
{
seq++;
if (seq==targetcount) {seq=0;}
delay(1000);
target[0]=targets[seq][0];
goposax(0);
}
/*else
{
if (repeat)
{
seq=0;
if (targets[0][seq]!=maxpos[0]+1)
{
delay(1000);
target[0]=targets[0][seq];
//goposax(0);
}
}
else issequence=false;
}*/
}
}
lastrunning=running;
}