Ian Hua / Quadcopter-mbedRTOS
Revision:
38:ef65533cca32
Parent:
37:29feef05d848
Child:
39:02782ad251db
diff -r 29feef05d848 -r ef65533cca32 RTOS-Threads/src/Task3.cpp
--- a/RTOS-Threads/src/Task3.cpp	Tue May 13 05:28:05 2014 +0000
+++ b/RTOS-Threads/src/Task3.cpp	Tue May 13 13:05:03 2014 +0000
@@ -24,6 +24,8 @@
 
 FLIGHT_MODE mode = ATTITUDE;
 
+int voltageUpdate = 0;
+
 
 
 
@@ -76,6 +78,9 @@
             break;
     }
 
+    for (int i = 1; i < 3; i++)
+        inputYPR[i] = constrainInputYPR(inputYPR[i]);
+
     /* Lost signal (throttle): */
     if (rxModule[2].stallTimer.read_us() > 18820) {
         for (int i = 0; i < 5; i++)
@@ -85,9 +90,13 @@
             RCCommand[i] = constrainRCCommand(RCCommand[i]);
     }
 
-    if (box_demo) {
-        BT.printf("\nA%3.2f\nT%2.2f\n", altimeter.Altitude_m(), altimeter.Temp_C());
-        BT.printf("\nV%2.2f\n", voltageSense*VOLTAGE_SCALE);
+    if (voltageUpdate > 3) {
+        if (box_demo) {
+            BT.printf("\nV%2.2f\n", voltageSense*VOLTAGE_SCALE);
+        }
+        voltageUpdate = 0;
+    } else {
+        voltageUpdate++;
     }
 //Timer
 }
@@ -116,6 +125,20 @@
         return input;
 }
 
+int constrainInputYaw(int input)
+{
+}
+
+int constrainInputYPR(int input)
+{
+    if (input < -45)
+        return -45;
+    else if (input > 45)
+        return 45;
+    else
+        return input;
+}
+
 void uartDecoder(char input)
 {
     switch (input) {