Log in

View Full Version : Tasks Question


DjMaddius
21-01-2011, 15:39
Iv got a task running and i have a problem.

I cant control anything that isnt static, like solenoids and such. Any way around this?

davidalln
21-01-2011, 15:48
I'm not exactly positive what you're asking, but this thread might help you out: http://www.chiefdelphi.com/forums/showthread.php?t=82398&highlight=task+tutorial

DjMaddius
21-01-2011, 17:07
Thanks, that helped quite a bit.

Though now im having a separate problem with it. When i declate the task:


Task scissorLiftTask("Scissor Lift Task", (FUNCPTR)scissorMovePos);


I get the error


error: argument of type `void (BuiltinDefaultCode::)(int)' does not match `int (*)(...)'


My function for the task is as follows:


void scissorMovePos(int argPtr)
{
ScissorsLiftTaskStruct* args = (ScissorsLiftTaskStruct*)argPtr;
while(true)
{
if(curPOS != POS)
{
switch(POS)
{
case 0: // DOWN
args->solenoids[1]->Set(true);
break;

case 1: // SIDE HIGH

break;

case 2: // SIDE MID

break;

case 3: // SIDE LOW

break;

case 4: // MID LOW

break;

case 5: // MID MID

break;

case 6: // MID HIGH

break;

default: // DOWN

break;
}
curPOS = POS;
}
}
}



EDIT:;

Also, im getting this error:

error: incompatible types in assignment of `Solenoid* (*)[9]' to `Solenoid*[9]'


with this line:

scissorLiftTaskArgs.solenoids = &m_solenoids;


Declarations of the two objects involved in the above error:

struct ScissorsLiftTaskStruct
{
Solenoid *solenoids[(NUM_SOLENOIDS+1)];
};

Solenoid *m_solenoids[(NUM_SOLENOIDS+1)];