Minor changes

This commit is contained in:
id101010
2015-06-07 13:41:07 +02:00
parent 802d3df373
commit 3d98ca93bc
2 changed files with 12 additions and 12 deletions

View File

@@ -28,10 +28,10 @@ void int_init(void){
// PID controller implementatoin for the y-axis
int16_t pixy_PID_Y(int16_t x, int16_t w)
{
float e;
static float esum;
static float eold;
float y;
float e = 0;
static float esum = 0;
static float eold = 0;
float y = 0;
e = (float)(x - w); // calculate the controller offset
@@ -45,16 +45,16 @@ int16_t pixy_PID_Y(int16_t x, int16_t w)
eold = e; // save the previous value
return (int16_t) y;
return (int16_t)y;
}
// PID controller implementation for the x-axis
int16_t pixy_PID_X(int16_t x, int16_t w)
{
float e;
static float esum;
static float eold;
float y;
float e = 0;
static float esum = 0;
static float eold = 0;
float y = 0;
e = (float)(x - w); // calculate the controller offset
@@ -68,5 +68,5 @@ int16_t pixy_PID_X(int16_t x, int16_t w)
eold = e; // save the previous value
return (int16_t) y;
return (int16_t)y;
}