Subversion Repositories NaviCtrl

Compare Revisions

Ignore whitespace Rev 98 → Rev 99

/trunk/GPS.c
293,17 → 293,20
 
//------------------------------------------------------------
// Rescale xy-vector length if length limit is violated
void GPS_LimitXY(s32 *x, s32 *y, u32 limit)
// return vector length after scaling
u32 GPS_LimitXY(s32 *x, s32 *y, u32 limit)
{
double dist;
u32 dist;
 
dist = hypot(*x,*y); // the length of the vector
if ((u32)dist > limit)
dist = (u32)hypot(*x,*y); // the length of the vector
if (dist > limit)
// if vector length is larger than the given limit
{ // scale vector compontents so that the length is cut off to limit
*x = (s32)(((double)(*x) * limit) / dist);
*y = (s32)(((double)(*y) * limit) / dist);
*x = (s32)(((double)(*x) * (double)limit) / dist);
*y = (s32)(((double)(*y) * (double)limit) / dist);
dist = limit;
}
return(dist);
}
 
//------------------------------------------------------------
/trunk/uart1.c
170,10 → 170,10
" ",// "MAXDrift ", //20
"N_Speed ",
"E_Speed ",
" ",// "KalmDist_N ",
" ",// "KalmDist_E ",
" ",//25
" ",
"P-Part ",
"I-Part ",
"D-Part ",//25
"PID-Part ",
"Distance N ",
"Distance E ",
"GPS_Nick ",