for learning

Dependencies:   mbed FastPWM

Revision:
47:fdcb8bd86fd6
Parent:
46:2694daea349b
Child:
48:889798ff9329
--- a/main.cpp	Mon Jan 20 08:05:21 2020 +0000
+++ b/main.cpp	Tue Jan 21 13:39:27 2020 +0000
@@ -107,10 +107,10 @@
 enum _CONTROL_MODE {
     //control mode
     MODE_NO_ACT = 0,                                    //0
-    MODE_VALVE_OPEN_LOOP,                               //1
-    MODE_VALVE_POSITION_CONTROL,                        //2
-
-    MODE_JOINT_CONTROL,             //3
+    MODE_VALVE_POSITION_CONTROL,                        //1
+    MODE_JOINT_CONTROL,                                 //2
+    
+    MODE_VALVE_OPEN_LOOP,                               //3
     MODE_JOINT_POSITION_TORQUE_CONTROL_VALVE_POSITION,  //4
     MODE_VALVE_POSITION_TORQUE_CONTROL_LEARNING,        //5
 
@@ -483,11 +483,6 @@
                 break;
             }
 
-            case MODE_VALVE_OPEN_LOOP: {
-                V_out = (float) Vout.ref;
-                break;
-            }
-
             case MODE_VALVE_POSITION_CONTROL: {
                 VALVE_POS_CONTROL(valve_pos.ref);
                 break;
@@ -521,6 +516,11 @@
 
                 break;
             }
+            
+            case MODE_VALVE_OPEN_LOOP: {
+                V_out = (float) Vout.ref;
+                break;
+            }
 
             case MODE_JOINT_POSITION_TORQUE_CONTROL_VALVE_POSITION: {
                 float VALVE_POS_RAW_POS_FB = 0.0f; // Valve Position by Position Feedback