|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
|
|
Thread Tools | Rate Thread | Display Modes |
|
|
|
#1
|
|||
|
|||
|
I am having trouble defining a task. The code and compiler errors are below. If anyone knows what I'm doing wrong, help would be greatly appreciated!
Error: Code:
C:/windriver/workspace/2011CompetitionCode/Arm.cpp:132: error: argument of type `int (LogomotionArm::)(LogomotionArm::ArmInitArgs*)' does not match `int (*)(...)' Code:
int InitialiseArm(ArmInitArgs *argsPTR)
{
while (argsPTR->armJagTask->GetForwardLimitOK())
{
argsPTR->armJagTask->Set(1);
Wait(0.01);
}
argsPTR->armJagTask->Set(0);
argsPTR->armPositionTask->Reset();
argsPTR->isInitialisingTask=false;
argsPTR->isInitialisedTask=true;
return (int)0;
}
Code:
Task armInit("ArmInit",(FUNCPTR)(InitialiseArm));
armInit.Start((INT32)(&initArgs));
|
|
#2
|
||||
|
||||
|
Re: Task FUNCPTR Issue
Team 166's Framework166 deals with this. We don't actually use the WPilib tasks, but we DO typecast our tasks into FUNCPTRs.
The main code we use is Code:
static int MainJacket(void *this_p, int a0, int a1, int a2, int a3, int a4, int a5, int a6, int a7, int a8); EDIT: This old thread mentions that the task has to have int arguments... EDIT2: I just found it: Code:
typedef int (*FUNCPTR) (...); /* ptr to function returning int */ Last edited by demosthenes2k8 : 11-03-2011 at 19:53. |
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|