/******************************************************************************* AlphaBot Task.c *******************************************************************************/ void DoNothing(void) {} #ifdef FALSE //--- PENDING #include #include "AlphaBot.h" //------------------------------------------------------------------------------ _idat TaskData TaskQueue[MAX_TASKQUEUE_SIZE]; _idat uchar ucTaskQueueLen = 0; //------------------------------------------------------------------------------ bool SetTask_Reverse(Side eSide) { if( ucTaskQueueLen + 6 > MAX_TASKQUEUE_SIZE ) { CommStatusCode( STAT_ERROR, ST_TASK_QUEUE_FULL ); return FALSE; } TaskQueue_Add( T_STOP, MEDIUM ); SetTask_Drive(-SPEED_NORMAL, -SPEED_NORMAL, 8 ); TaskQueue_Add( T_STOP, HARD ); if( eSide != ANYSIDE ) TaskQueue_Add( T_TURN, eSide ); else { TaskQueue_Add( T_SWEEP, 0 ); TaskQueue_Add( T_TURN, 0/* ucLastSweepResult */ ); // with streatenig the head } SetTask_Drive(SPEED_NORMAL, SPEED_NORMAL, 12 ); return TRUE; } // SetTask_Reverse //------------------------------------------------------------------------------ bool SetTask_Drive( char cSpeedLeft, char cSpeedRight, uchar ucMilageMax ) { ulong ulDriveParam; //-- pack all drive parameters into one ulong ulDriveParam = cSpeedLeft > 0 ? cSpeedLeft : 100-cSpeedLeft; ulDriveParam << 8; ulDriveParam += cSpeedRight > 0 ? cSpeedRight : 100-cSpeedRight; ulDriveParam << 8; ulDriveParam += ucMilageMax; return TaskQueue_Add( T_DRIVE, ulDriveParam ); } // SetTask_Drive //------------------------------------------------------------------------------ bool TaskQueue_Add ( TaskType Task, ulong Param ) { if( ucTaskQueueLen < MAX_TASKQUEUE_SIZE ) { TaskQueue[ucTaskQueueLen].Task = Task; TaskQueue[ucTaskQueueLen].Param = Param; ucTaskQueueLen++; return TRUE; } else return FALSE; } // TaskQueue_Add //----------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------- void TaskQueue_Remove(void) { if( ucTaskQueueLen > 0 ) { ucTaskQueueLen--; memmove( &TaskQueue[0], &TaskQueue[1], ucTaskQueueLen * sizeof(TaskData) ); } } // TaskQueue_Remove //----------------------------------------------------------------------------------------- #endif