From 3d98ca93bcc4f946636ee70ca2914edd9a7da44f Mon Sep 17 00:00:00 2001 From: id101010 Date: Sun, 7 Jun 2015 13:41:07 +0200 Subject: [PATCH] Minor changes --- common/app/pixy_control.c | 20 ++++++++++---------- common/app/screen_tracking.c | 4 ++-- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/common/app/pixy_control.c b/common/app/pixy_control.c index 8e0d8e9..5786e7a 100644 --- a/common/app/pixy_control.c +++ b/common/app/pixy_control.c @@ -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; } diff --git a/common/app/screen_tracking.c b/common/app/screen_tracking.c index 1a3daf5..508c8b3 100644 --- a/common/app/screen_tracking.c +++ b/common/app/screen_tracking.c @@ -91,8 +91,8 @@ void tracking_our_start(void* tracking_config) { int return_value; servo_x = servo_y = 500; // set a default value of 500 - pixy_rcs_set_position(0, servo_x); // - pixy_rcs_set_position(1, servo_y); // + pixy_rcs_set_position(0, servo_x); // set default + pixy_rcs_set_position(1, servo_y); // set default return_value = pixy_command("runprog", INT8(0), END_OUT_ARGS, &response, END_IN_ARGS); }