Hi Mark,
You might do something similar to how KStep is disabled after a period of no motion. Enable the Oiler and TimeStamp the time whenever there is motion, and if the current time is a certain amount past the TimeStamp then disable the oiler.
Code:
for (;;) // loop forever
{
WaitNextTimeSlice();
// Service Amplifier disable after no activity for a while
if (ch0->Dest != LastX || ch1->Dest != LastY || ch2->Dest != LastZ)
{
// we moved - enable KStep Amplifers
SetBit(45);
T0 = Time_sec(); // record the time and position of last motion
LastX=ch0->Dest;
LastY=ch1->Dest;
LastZ=ch2->Dest;
}
else
{
if (Time_sec() > T0 + 10.0) ClearBit(45);
}
}