Ian Hua / Quadcopter-mbedRTOS
Revision:
31:3dde2201e54d
Parent:
30:d9b988f8d84f
Child:
32:7a9be7761c46
diff -r d9b988f8d84f -r 3dde2201e54d RTOS-Threads/src/Task2_Slave.cpp
--- a/RTOS-Threads/src/Task2_Slave.cpp	Mon May 12 04:43:38 2014 +0000
+++ b/RTOS-Threads/src/Task2_Slave.cpp	Mon May 12 05:12:19 2014 +0000
@@ -1,7 +1,7 @@
 /* File:        Task2_Slave.cpp
  * Author:      Trung Tin Ian HUA
  * Date:        May 2014
- * Purpose:     Thread2: Gyro sample and PID Control loop
+ * Purpose:     Thread2S: Gyro sample and Slave PID control loop (rate)
  * Settings:    200Hz
  * Timing:      290us
  */
@@ -17,15 +17,10 @@
 
 bool counterESC = false;
 
-#ifdef TIME_TASK2S
-Timer _t2s;
-#endif
+//Timer
 void Task2_Slave(void const *argument)
 {
-#ifdef TIME_TASK2S
-    _t2s.reset();
-    _t2s.start();
-#endif
+//Timer
     imu.getRotation(&gx, &gy, &gz);
     gyro[0] = gx + 60;
     gyro[1] = gy - 15;
@@ -34,9 +29,8 @@
     for (int i = 0; i < 3; i++)
         gyro[i] /= (float) 32.8;
 
-#ifndef TIME_TASK2S
+//Timer
     if (armed) {
-#endif
         yawPIDrate.setSetPoint(inputYPR[0]);
 
         switch (mode) {
@@ -71,18 +65,14 @@
                 counterESC = true;
                 break;
         }
-#ifndef TIME_TASK2S
+//Timer
+
+        if (adjust_check)
+            BT.printf("%3.2f %3.2f %3.2f\n", adjust[0], adjust[1], adjust[2]);
     }
-#endif
-
-    if (adjust_check)
-        BT.printf("%3.4f %3.4f %3.4f\n", adjust[0], adjust[1], adjust[2]);
 
     if (gyro_out)
         BT.printf("%3d %3d %3d\n", (int) gyro[0], (int) gyro[1], (int) gyro[2]);
 
-#ifdef TIME_TASK2S
-    _t2s.stop();
-    BT.printf("%d\n", _t2s.read_us());
-#endif
+//Timer
 }