Ejemplo n.º 1
0
LDD_TError FLASH1_Erase(LDD_TDeviceData *DeviceDataPtr, LDD_FLASH_TAddress FromAddress, LDD_FLASH_TDataSize Size)
{
  FLASH1_TDeviceDataPtr DeviceDataPrv = (FLASH1_TDeviceDataPtr)DeviceDataPtr; /* Auxiliary variable - pointer to an internal state structure */

  if (!(DeviceDataPrv->CurrentOperationStatus == LDD_FLASH_IDLE) && /* If some operation is already in progress return error. */\
     !(DeviceDataPrv->CurrentOperationStatus == LDD_FLASH_STOP) && \
     !(DeviceDataPrv->CurrentOperationStatus == LDD_FLASH_FAILED)) {
    return ERR_BUSY;
  }
  if (RangeCheck(FromAddress, Size) != (LDD_TError)ERR_OK) { /* Is an address range of desired operation out of used flash memory areas? */
    return ERR_PARAM_ADDRESS;          /* If yes, return error. */
  }
  if (((FromAddress & FLASH1_ERASABLE_UNIT_MASK) != 0U) || ((Size & FLASH1_ERASABLE_UNIT_MASK) != 0U)){ /* Is the desired area misaligned to erasable unit borders? */
    return ERR_PARAM_ADDRESS;          /* If yes, return error. */
  }
  /* Filling of the internal state structure */
  DeviceDataPrv->CurrentOperation = LDD_FLASH_ERASE; /* Set the current operation type */
  DeviceDataPrv->CurrentOperationStatus = LDD_FLASH_START; /* Set the current operation status to START */
  DeviceDataPrv->DataCounter = Size;   /* Reset Data counter */
  DeviceDataPrv->CurrentDataPtr = NULL; /* Reset the "Data pointer" for the operation */
  DeviceDataPrv->CurrentFlashAddress = FromAddress; /* Reset the "From address" for the operation */
  DeviceDataPrv->CurrentDataSize = FLASH1_ERASABLE_UNIT_SIZE; /* Set the current data size */
  DeviceDataPrv->CurrentCommand = LDD_FLASH_ERASE_SECTOR; /* Set the current operation flash command */
  return ERR_OK;                       /* Return with no error */
}
Ejemplo n.º 2
0
int operatorDriveTrain()
{
  int ErrorCode;

	//ToggleCheck(btnOldNewDrive, btnOldNewDrivePressed, (int) OldNewDrive);
	ToggleCheck(btnFrontBackDrive, btnFrontBackDrivePressed, (int) FrontBackDrive);

	if (OldNewDrive == PLAIN)
	{
	  // Deadband control for each axis.
	  if(!(abs(stkDriveX) > JOYSTICKDEADZONE))     stkDriveX = 0;
	  if(!(abs(stkDriveY) > JOYSTICKDEADZONE))     stkDriveY = 0;
	  if(!(abs(stkDriveS) > JOYSTICKDEADZONE * 2)) stkDriveS = 0;

		JoystickMax = 127+((10)+(0-cos(atan((stkDriveY/stkDriveX)*4)*(10))));
		JoystickPower = sqrt(pow(stkDriveY,2)+pow(stkDriveX,2)+pow(stkDriveS,2));
	  motorLeftFrontDrive = stkDriveY + stkDriveX + stkDriveS;
		motorLeftBackDrive =  stkDriveY + stkDriveX - stkDriveS;
		motorRightFrontDrive = stkDriveY - stkDriveX - stkDriveS;
		motorRightBackDrive =  stkDriveY - stkDriveX + stkDriveS;
	}
	else
	{
		if((abs(stkDriveY) > JOYSTICKDEADZONE) || (abs(stkDriveX) > JOYSTICKDEADZONE))	//If the Joystick has been pushed far enough
		{
		  motorLeftFrontDrive = stkDriveY + stkDriveX;
		  motorLeftBackDrive = stkDriveY + stkDriveX;
		  motorRightFrontDrive = stkDriveY - stkDriveX;
		  motorRightBackDrive = stkDriveY - stkDriveX;
		}
		else
		{
			motorLeftFrontDrive = 0;
			motorLeftBackDrive = 0;
			motorRightFrontDrive = 0;
			motorRightBackDrive = 0;
		}
	}

	// Make sure our values are within the appropriate range
	RangeCheck(0-MOTORDRIVEMAX, motorLeftFrontDrive, MOTORDRIVEMAX);
	RangeCheck(0-MOTORDRIVEMAX, motorLeftBackDrive, MOTORDRIVEMAX);
	RangeCheck(0-MOTORDRIVEMAX, motorRightFrontDrive, MOTORDRIVEMAX);
	RangeCheck(0-MOTORDRIVEMAX, motorRightBackDrive, MOTORDRIVEMAX);

	return ErrorCode;
}
Ejemplo n.º 3
0
  /// Delete element i (1-based). Move last element to position i.
  void DeleteElement (int i)
  {
#ifdef CHECK_ARRAY_RANGE
    RangeCheck (i);
#endif

    this->data[i-1] = this->data[this->size-1];
    this->size--;
  }
Ejemplo n.º 4
0
static void OptBytesPerLine (const char* Opt, const char* Arg)
/* Handle the --bytes-per-line option */
{
    /* Convert the argument to a number */
    unsigned long Val = CvtNumber (Opt, Arg);

    /* Check for a valid range */
    RangeCheck (Opt, Val, MIN_BYTESPERLINE, MAX_BYTESPERLINE);

    /* Use the value */
    BytesPerLine = (unsigned char) Val;
}
Ejemplo n.º 5
0
static void OptComments (const char* Opt, const char* Arg)
/* Handle the --comments option */
{
    /* Convert the argument to a number */
    unsigned long Val = CvtNumber (Opt, Arg);

    /* Check for a valid range */
    RangeCheck (Opt, Val, MIN_COMMENTS, MAX_COMMENTS);

    /* Use the value */
    Comments = (unsigned char) Val;
}
Ejemplo n.º 6
0
static void OptArgumentColumn (const char* Opt, const char* Arg)
/* Handle the --argument-column option */
{
    /* Convert the argument to a number */
    unsigned long Val = CvtNumber (Opt, Arg);

    /* Check for a valid range */
    RangeCheck (Opt, Val, MIN_ACOL, MAX_ACOL);

    /* Use the value */
    ACol = (unsigned char) Val;
}
Ejemplo n.º 7
0
index
create( const Name& model_name, const index n_nodes )
{
  if ( n_nodes == 0 )
  {
    throw RangeCheck();
  }

  const Token model = kernel().model_manager.get_modeldict()->lookup( model_name );
  if ( model.empty() )
    throw UnknownModelName( model_name );

  // create
  const index model_id = static_cast< index >( model );

  return kernel().node_manager.add_node( model_id, n_nodes );
}
Ejemplo n.º 8
0
/* ===================================================================*/
LDD_TError FLASH1_Read(LDD_TDeviceData *DeviceDataPtr, LDD_FLASH_TAddress FromAddress, LDD_TData *ToPtr, LDD_FLASH_TDataSize Size)
{
  FLASH1_TDeviceDataPtr DeviceDataPrv = (FLASH1_TDeviceDataPtr)DeviceDataPtr; /* Auxiliary variable - pointer to an internal state structure */

  if (!(DeviceDataPrv->CurrentOperationStatus == LDD_FLASH_IDLE) && /* If some operation is already in progress return error */\
     !(DeviceDataPrv->CurrentOperationStatus == LDD_FLASH_STOP) && \
     !(DeviceDataPrv->CurrentOperationStatus == LDD_FLASH_FAILED)) {
    return ERR_BUSY;
  }
  if (RangeCheck(FromAddress, Size) != (LDD_TError)ERR_OK) {
    return ERR_PARAM_ADDRESS;
  }
  /* Filling of the internal state structure */
  DeviceDataPrv->CurrentOperation = LDD_FLASH_READ; /* Set the current operation type */
  DeviceDataPrv->CurrentOperationStatus = LDD_FLASH_START; /* Set the current operation status to START */
  DeviceDataPrv->DataCounter = Size;   /* Reset Data counter */
  DeviceDataPrv->CurrentDataPtr = (uint8_t *)ToPtr; /* Reset the "To pointer" for the operation */
  DeviceDataPrv->CurrentFlashAddress = FromAddress; /* Reset the "From address" for the operation */
  DeviceDataPrv->CurrentDataSize = 1U; /* Set the current data size */
  return ERR_OK;                       /* Return with no error */
}
Ejemplo n.º 9
0
/* ===================================================================*/
LDD_TError FLASH1_Write(LDD_TDeviceData *DeviceDataPtr, LDD_TData *FromPtr, LDD_FLASH_TAddress ToAddress, LDD_FLASH_TDataSize Size)
{
  FLASH1_TDeviceDataPtr DeviceDataPrv = (FLASH1_TDeviceDataPtr)DeviceDataPtr; /* Auxiliary variable - pointer to an internal state structure */

  if (!(DeviceDataPrv->CurrentOperationStatus == LDD_FLASH_IDLE) && /* If some operation is already in progress return error */\
     !(DeviceDataPrv->CurrentOperationStatus == LDD_FLASH_STOP) && \
     !(DeviceDataPrv->CurrentOperationStatus == LDD_FLASH_FAILED)) {
    return ERR_BUSY;
  }
  if (RangeCheck(ToAddress, Size) != (LDD_TError)ERR_OK) { /* Is the given flash memory area in the allowed range? */
    return ERR_PARAM_ADDRESS;          /* If no, return error */
  }
  /* Filling of the internal state structure */
  DeviceDataPrv->CurrentOperation = LDD_FLASH_WRITE; /* Set the current operation type */
  DeviceDataPrv->CurrentOperationStatus = LDD_FLASH_START; /* Set the current operation status to START */
  DeviceDataPrv->CurrentCommand = LDD_FLASH_WRITE_LONG_WORD; /* Set the flash command to be proceed for the operation */
  DeviceDataPrv->DataCounter = Size;   /* Reset Data counter */
  DeviceDataPrv->CurrentDataPtr = (uint8_t *)FromPtr; /* Reset the "From pointer" for the operation */
  DeviceDataPrv->CurrentFlashAddress = ToAddress; /* Reset the "To address" for the operation */
  DeviceDataPrv->CurrentDataSize = 0U; /* Reset Current data size */
  return ERR_OK;                       /* Return with no error */
}
Ejemplo n.º 10
0
// State machine manager.  Layout and content of dialog panel will be changed here based on state.
void ProfileWizard::UpdateState(const int change)
{
    ShowStatus(wxEmptyString);
    if (SemanticCheck(m_State, change))
    {
        m_State = (DialogState) RangeCheck(((int)m_State + change));

        if (m_State >= 0 && m_State < NUM_PAGES)
        {
            const wxBitmap& bmp = *m_bitmaps[m_State];
            m_bitmap->SetSize(bmp.GetSize());
            m_bitmap->SetBitmap(bmp);
        }

        switch (m_State)
        {
        case STATE_GREETINGS:
            SetTitle(TitlePrefix + _("Introduction"));
            m_pPrevBtn->Enable(false);
            m_pGearLabel->Show(false);
            m_pGearChoice->Show(false);
            m_pUserProperties->Show(false);
            m_pWrapUp->Show(false);
            m_pInstructions->SetLabel(_("Welcome to the PHD2 'first light' wizard"));
            m_pHelpText->SetSizeHints(wxSize(-1, TallHelpHeight));
            SetSizerAndFit(m_pvSizer);
            break;
        case STATE_CAMERA:
            SetTitle(TitlePrefix + _("Choose a Guide Camera"));
            m_pPrevBtn->Enable(true);
            m_pGearLabel->SetLabel(_("Guide Camera:"));
            m_pGearChoice->Clear();
            m_pGearChoice->Append(GuideCamera::List());
            if (m_SelectedCamera.length() > 0)
                m_pGearChoice->SetStringSelection(m_SelectedCamera);
            m_pGearLabel->Show(true);
            m_pGearChoice->Show(true);
            m_pUserProperties->Show(true);
            m_pWrapUp->Show(false);
            m_pHelpText->SetSizeHints(wxSize(-1, NormalHelpHeight));
            SetSizerAndFit(m_pvSizer);
            m_pInstructions->SetLabel(_("Select your guide camera and specify the optical properties of your guiding set-up"));
            m_pInstructions->Wrap(TextWrapPoint);
            break;
        case STATE_MOUNT:
            SetTitle(TitlePrefix + _("Choose a Mount Connection"));
            m_pPrevBtn->Enable(true);
            m_pGearLabel->SetLabel(_("Mount:"));
            m_pGearChoice->Clear();
            m_pGearChoice->Append(Scope::List());
            if (m_SelectedMount.length() > 0)
                m_pGearChoice->SetStringSelection(m_SelectedMount);
            m_pUserProperties->Show(false);
            m_pInstructions->SetLabel(_("Select your mount connection - this will determine how guide signals are transmitted"));
            break;
        case STATE_AUXMOUNT:
            if (m_PositionAware)                        // Skip this state if the selected mount is already position aware
            {
                UpdateState(change);
            }
            else
            {
                SetTitle(TitlePrefix + _("Choose an Auxiliary Mount Connection (optional)"));
                m_pGearLabel->SetLabel(_("Aux Mount:"));
                m_pGearChoice->Clear();
                m_pGearChoice->Append(Scope::AuxMountList());
                m_pGearChoice->SetStringSelection(m_SelectedAuxMount);      // SelectedAuxMount is never null
                m_pInstructions->SetLabel(_("Since your primary mount connection does not report pointing position, you may want to choose an 'Aux Mount' connection"));
            }
            break;
        case STATE_AO:
            SetTitle(TitlePrefix + _("Choose an Adaptive Optics Device (optional)"));
            m_pGearLabel->SetLabel(_("AO:"));
            m_pGearChoice->Clear();
            m_pGearChoice->Append(StepGuider::List());
            m_pGearChoice->SetStringSelection(m_SelectedAO);            // SelectedAO is never null
            m_pInstructions->SetLabel(_("Specify your adaptive optics device if desired"));
            if (change == -1)                   // User is backing up in wizard dialog
            {
                // Assert UI state for gear selection
                m_pGearGrid->Show(true);
                m_pNextBtn->SetLabel(_("Next >"));
                m_pNextBtn->SetToolTip(_("Move forward to next screen"));
                m_pWrapUp->Show(false);
            }
            break;
        case STATE_WRAPUP:
            SetTitle(TitlePrefix + _("Finish Creating Your New Profile"));
            m_pGearGrid->Show(false);
            m_pWrapUp->Show(true);
            m_pNextBtn->SetLabel(_("Finish"));
            m_pNextBtn->SetToolTip(_("Finish creating the equipment profile"));
            m_pInstructions->SetLabel(_("Enter a name for your profile and optionally launch the process to build a dark library"));
            SetSizerAndFit(m_pvSizer);
            break;
        case STATE_DONE:
            WrapUp();
            break;
        }
    }

    ShowHelp(m_State);
}
Ejemplo n.º 11
0
	bool RayTraceDataGenerator::CalcIntersect(const XMVECTOR& p1, const XMVECTOR& n, XMVECTOR* nResult, XMVECTOR* intersectLocation, float* depth)
	{
		/*
		// grid space
		vec3 grid = floor( pos ); //向下取整将坐标在网格中使用
		vec3 grid_step = sign( dir ); //获取dir(方向)的正负符号<-意思就是说获取网格的步进方向,虽然只是正负
		vec3 corner = max( grid_step, vec3( 0.0 ) );//负号->0 //应该是最后在步进方向上产生的偏差值,但是原因不明

		// ray space
		vec3 inv = vec3( 1.0 ) / dir; //取倒数使得各个方向的比值倒过来
		vec3 ratio = ( grid + corner - pos ) * inv;//corn+pos的小数部分
		vec3 ratio_step = grid_step * inv;//不懂
		//于是这个rayspace只是提供一个比值,来决定grid的步进么

		// dda <-数值微分法
		float hit = -1.0;
		for ( int i = 0; i < 128; i++ ) {
		if ( voxel( grid ) > 0.5 ) {

		hit = 1.0;
		break;   //这里应该是可以直接退出循环的,感觉没什么区别
		continue;
		}

		vec3 cp = step( ratio, ratio.yzx );//二维情况的搞清楚了,问题还有就是在三维空间上的扩展

		mask = cp * ( vec3( 1.0 ) - cp.zxy );

		grid  += grid_step  * mask;
		ratio += ratio_step * mask;
		}

		center = grid + vec3( 0.5 );//中心形式表示(跟grid应该没区别吧0 0)
		return dot(ratio - ratio_step,vec3(1.0)) * hit;//dot( ratio - ratio_step, mask ) * hit;
		//这里关心的是hit的深度好像
		*/
		//p1是起点
		XMVECTOR start = p1;
		XMVECTOR dir = n;
		XMVECTOR zero = XMVectorSetBinaryConstant(0, 0, 0, 0);
		XMVECTOR one = XMVectorSetBinaryConstant(1, 1, 1, 1);


		XMVECTOR grid;
		XMVECTOR grid_step;
		XMVECTOR grid_corner;
		grid = XMVectorFloor(start);//实际上w分量为0应该就不影响了吧(
		//好像DirectXMath没有提供Sign的函数(于是用了一个挺别扭的方法- -
		//grid_step 就是 sign_dir
		grid_step = DirectX::XMVectorOrInt(DirectX::XMVectorAndInt(dir, DirectX::XMVectorSplatSignMask()), DirectX::XMVectorSplatOne());
		grid_corner = XMVectorClamp(grid_step, zero, one);

		XMVECTOR inv;
		XMVECTOR ratio;
		XMVECTOR ratio_step;
		inv = XMVectorReciprocal(dir);
		ratio = XMVectorMultiply(XMVectorSubtract(XMVectorAdd(grid, grid_corner), start), inv);
		ratio_step = XMVectorMultiply(grid_step, inv);

		bool hit = false;
		XMVECTOR cp;
		XMVECTOR mask;
		XMVECTOR ratioyzx;
		XMVECTOR cpzxy;
		XMFLOAT4 tmp1;
		XMFLOAT4 tmp2;
		int i;
		for (i = 0; i < 128; ++i)//最大深度为128
		{
			XMStoreFloat4(&tmp1, grid);
			/*
			__try{
			if (map->At(tmp1.x, tmp1.y, tmp1.z).TexType != -1)
			{
			hit = true;
			break;
			}
			}
			__except ((GetExceptionCode() == EXCEPTION_ARRAY_BOUNDS_EXCEEDED)?EXCEPTION_EXECUTE_HANDLER:EXCEPTION_CONTINUE_SEARCH)
			{
			//捕获越界错误作为跳出条件,看看有没有问题...
			break;
			}
			*/
			//理论上来说异常的话处理代价太大,还是判断一下range吧= =
			if ((RangeCheck(tmp1.x, tmp1.y, tmp1.z)))
			{
				if (GetLocInfo(tmp1.x, tmp1.y, tmp1.z) != -1)
				{
					hit = true;
					break;
				}
			}
			/*
			修正:发生越界的时候并不一定就要终止,需要考虑到从值域外射出的射线.....
			不过就算不break效率应该也比原先的算法要高...(除了要限制一下最大遍历深度这方面
			*/


			XMStoreFloat4(&tmp1, ratio);
			tmp2.x = tmp1.y; tmp2.y = tmp1.z; tmp2.z = tmp1.x;
			ratioyzx = XMLoadFloat4(&tmp2);

			cp = XMVectorAndInt(XMVectorGreaterOrEqual(ratioyzx, ratio), XMVectorSplatOne());//1 or 0
			XMStoreFloat4(&tmp1, cp);
			tmp2.x = tmp1.z; tmp2.y = tmp1.x; tmp2.z = tmp1.y;
			cpzxy = XMLoadFloat4(&tmp2);
			mask = XMVectorMultiply(cp, XMVectorSubtract(one, cpzxy));

			grid += XMVectorMultiply(grid_step, mask);
			ratio += XMVectorMultiply(ratio_step, mask);
		}
		if (hit)
		{

			XMFLOAT4 result;
			result = tmp1; //所在方块
			if (i == 0)
			{
				//这是在方块内部的情况
				result.w = -1;
				return false;
			}
			XMVECTOR ftmp;
			ftmp = XMVectorSubtract(ratio, ratio_step);//因为取的只是mask方向的值,所以step在这里没必要乘mask
			*depth = XMVectorGetX(DirectX::XMVector3Dot(ftmp, mask));
			ftmp = XMVectorAdd(XMVectorScale(dir,*depth) , p1);
			XMStoreFloat4(&tmp1, ftmp);
			//需要全部反过来,因为上面的式子没有取反
			*intersectLocation = ftmp;
			result = tmp1;
			result.w = 0;

			XMVECTOR normal;
			normal = XMVectorMultiply(mask, grid_step);
			XMStoreFloat4(&tmp1, normal);
			//需要全部反过来,因为上面的式子没有取反
			if (tmp1.x > 0.5)
			{
				//法向量为1,0,0,后方
				*nResult = XMVectorSetBinaryConstant(1, 0, 0, 0);
			}
			else if (tmp1.x < -0.5)
			{
				//法向量为-1,0,0,前方
				*nResult = XMVectorSetBinaryConstant(-1, 0, 0, 0);
			}
			else if (tmp1.y < -0.5)
			{
				//法向量为0,-1,0,右方
				*nResult = XMVectorSetBinaryConstant(0, -1, 0, 0);
			}
			else if (tmp1.y > 0.5)
			{
				//法向量为0,1,0,左方
				*nResult = XMVectorSetBinaryConstant(0, 1, 0, 0);
			}
			else if (tmp1.z < -0.5)
			{
				//法向量为0,0,-1,上方
				*nResult = XMVectorSetBinaryConstant(0, 0, -1, 0);
			}
			else if (tmp1.z > 0.5)
			{
				//法向量为0,0,1,下方
				*nResult = XMVectorSetBinaryConstant(0, 0, 1, 0);
			}
			return true;
			//return result;
		}
		else
		{
			return false;
		}
		//上面成功的进行了判断,可以得出grid编号了,不过还要算一下相交面(
		return false;
	}
Ejemplo n.º 12
0
    String String::subString(std::size_t begin, std::size_t end) const
    {
        RangeCheck(begin, getSize());

        return String(m_string.substr(begin, end).c_str());
    }
Ejemplo n.º 13
0
    const char& String::at(std::size_t index) const
    {
        RangeCheck(index, getSize());

        return m_string[index];
    }
Ejemplo n.º 14
0
int operatorDriveTrain()
{
	int joystickDriveMax = 127;			 				//Maximum distance of drive stick from center
	int motorDriveMax = 127;							//Maximum power we want our motors to go
	float JoystickAngleSin;			 					//Sine of the Drive Stick
	float JoystickAngleCos;								//Cosine of the Drive Stick

	ToggleCheck(btnHoloStraight, btnHoloStraightPressed, (int) HolonomicMode);
	ToggleCheck(btnOldNewDrive, btnOldNewDrivePressed, bOldNewDrive);
	ToggleCheck(btnFrontBackDrive, btnFrontBackDrivePressed, bFrontBackDrive);

	if(HolonomicMode == STRAIGHT)
	{
	}
	else
	{
		if (!bOldNewDrive)
		{
			joystickDrivePower = sqrt((stkDriveX*stkDriveX)+(stkDriveY*stkDriveY));	// Calculate Joystick Hypotenuse
			JoystickAngleSin = stkDriveY/joystickDriveMax;							// Calculate Joystick Sin
			JoystickAngleCos = stkDriveX/joystickDriveMax;							// Calculate Joystick Cosin
			motorLeftDriveTrain = (JoystickAngleSin + JoystickAngleCos) * joystickDrivePower;
			motorRightDriveTrain = (JoystickAngleSin - JoystickAngleCos) * joystickDrivePower;

			if(joystickDrivePower > joystickDriveDeadzone)	//If the Joystick has been pushed far enough
			{
				RangeCheck(0-motorDriveMax, motorLeftDriveTrain, motorDriveMax);
				RangeCheck(0-motorDriveMax, motorRightDriveTrain, motorDriveMax);
			    /*motorLeftDriveTrain = (motorLeftDriveTrain > motorDriveMax) ? motorDriveMax : motorLeftDriveTrain;
				motorRightDriveTrain = (motorRightDriveTrain > motorDriveMax) ? motorDriveMax : motorRightDriveTrain;
				motorLeftDriveTrain = (motorLeftDriveTrain < (0-motorDriveMax)) ? (0-motorDriveMax) : motorLeftDriveTrain;
				motorRightDriveTrain = (motorRightDriveTrain < (0-motorDriveMax)) ? (0-motorDriveMax) : motorRightDriveTrain;*/
			}
			else
			{
				motorLeftDriveTrain = 0;
				motorRightDriveTrain = 0;
			}
		}
		/*else //Old Drive
		{
			joystickDrivePower = sqrt((stkDriveX*stkDriveX)+(stkDriveY*stkDriveY));
			motorLeftDriveTrain = stkDriveY + stkDriveX;
			motorRightDriveTrain = stkDriveY - stkDriveX;

			if(joystickDrivePower > joystickDriveDeadzone)	//If the Joystick has been pushed far enough
			{
				motorLeftDriveTrain = (motorLeftDriveTrain > motorDriveMax) ? motorDriveMax : motorLeftDriveTrain;
				motorRightDriveTrain = (motorRightDriveTrain > motorDriveMax) ? motorDriveMax : motorRightDriveTrain;
				motorLeftDriveTrain = (motorLeftDriveTrain < (0-motorDriveMax)) ? (0-motorDriveMax) : motorLeftDriveTrain;
				motorRightDriveTrain = (motorRightDriveTrain < (0-motorDriveMax)) ? (0-motorDriveMax) : motorRightDriveTrain;
			}
			else
			{
				motorLeftDriveTrain = 0;
				motorRightDriveTrain = 0;
			}
		}*/ //*********Commented because we ran out of space on the brain!
	}
	//return errorcode;
	return 0;
}