Chief Delphi

Chief Delphi (http://www.chiefdelphi.com/forums/index.php)
-   C/C++ (http://www.chiefdelphi.com/forums/forumdisplay.php?f=183)
-   -   Tasks Question (http://www.chiefdelphi.com/forums/showthread.php?t=89727)

DjMaddius 21-01-2011 15:39

Tasks Question
 
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

Re: Tasks Question
 
I'm not exactly positive what you're asking, but this thread might help you out: http://www.chiefdelphi.com/forums/sh...=task+tutorial

DjMaddius 21-01-2011 17:07

Re: Tasks Question
 
Thanks, that helped quite a bit.

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

Code:

Task scissorLiftTask("Scissor Lift Task", (FUNCPTR)scissorMovePos);
I get the error

Code:

error: argument of type `void (BuiltinDefaultCode::)(int)' does not match `int (*)(...)'
My function for the task is as follows:

Code:

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:
Code:

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

scissorLiftTaskArgs.solenoids = &m_solenoids;
Declarations of the two objects involved in the above error:
Code:

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

Solenoid *m_solenoids[(NUM_SOLENOIDS+1)];



All times are GMT -5. The time now is 13:07.

Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi