Carbon Fibre / Mbed 2 deprecated Motor_test_harness

Dependencies:   Classic_PID iC_MU mbed-rtos mbed

Revision:
3:f8a5c1cee1fa
Parent:
2:dc684c402296
Child:
4:4dafa4113982
--- a/main.cpp	Wed May 27 07:13:54 2015 +0000
+++ b/main.cpp	Wed May 27 10:07:39 2015 +0000
@@ -65,11 +65,11 @@
 bool AutofocusFlag = true;
 bool ManualfocusFlag = false;
 bool Mode = AUTO;
-bool joystick = true;
+bool joystick = false;
 bool scoping = false;
 
 extern int LastPanPosition;
-extern int LastTiltPosition;
+extern int Last_M_Position;
 float Pan_JoyStickDem = 0.8;
 float Tilt_JoyStickDem = 0.8;
 float Demand_Count_Rate = 0.0;
@@ -79,7 +79,7 @@
 extern float Tilt_motor_max_count_rate; //encoder counts / ms
 
 extern float T_Position; // True Tilt Position (Degrees)
-extern float T_sf;  // counts per degree
+extern float T_Encoder_sf;  // counts per degree
 extern int DoMove;
 extern float s_profile;
 extern float P_vel;
@@ -191,7 +191,7 @@
     // Initalise Tilt PID Loop
     TiltVelocityPID.setProcessLimits(Tilt_motor_max_count_rate, (Tilt_motor_max_count_rate*-1));
     TiltVelocityPID.setSetPoint(0);
-    LastTiltPosition = tilt_ic_mu.ReadPOSITION() >> 1;
+    Last_M_Position = tilt_ic_mu.ReadPOSITION() >> 1;
 
     // Initalise Anti-Lock RtosTimer thread
     RtosTimer Anti_Lock_timer(Anti_Lock, osTimerPeriodic);
@@ -199,7 +199,7 @@
 
     pc.baud(921600);
     
-    T_Position = 360 - (TiltPos.ReadPOSITION()/T_sf);    // Prime the system on startup, this is not used once running.
+    T_Position = 360 - (TiltPos.ReadPOSITION()/T_Encoder_sf);    // Prime the system on startup, this is not used once running.
     P = T_Position;                                      // Priming
     pc.printf("\n\r Startup: T_Position = %f, P = %f, \n\r", T_Position, P);
     
@@ -208,7 +208,7 @@
         if(pc.readable()) {
             ServiceKeyboard();
         }
-        //T_Position = TiltPos.ReadPOSITION()/T_sf;
+        //T_Position = TiltPos.ReadPOSITION()/T_Encoder_sf;
         Demand_Count_Rate = TiltVelocityPID.getSetPoint();
 
         if(1==0) {
@@ -219,7 +219,7 @@
          if(scoping) {
             P_Error = T_Position - P;
             pc.printf("\n\r %f, %f, %f, %f, %f", Time, Tilt_JoyStickDem, P_Error, T_Position, P);
-            Time = Time + 0.05;
+            Time = Time + 0.025;
         }
 
        // if(DoMove ==1) {
@@ -228,7 +228,7 @@
 
 
 
-        Thread::wait(50);
+        Thread::wait(25);
         // Update the Zoom and Focus Demands
         //UpdateCamera(Zoom_Joystick.read(),Focus_Pot.read());