SHENG-HEN HSIEH / Mbed 2 deprecated VDU_2021

Dependencies:   mbed imu_driver

Files at this revision

API Documentation at this revision

Comitter:
open4416
Date:
Tue Mar 10 14:56:08 2020 +0000
Parent:
21:e01a019fae2f
Child:
23:100661e2ad70
Commit message:
version use in test 2020/3/10

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
--- a/main.cpp	Wed Mar 04 08:44:55 2020 +0000
+++ b/main.cpp	Tue Mar 10 14:56:08 2020 +0000
@@ -107,7 +107,7 @@
 
                     //Basic IMU test
                     POST();
-
+//                    printf("%d,%d,%d,%d,%d\n",FL_online,FR_online,RL_online,RR_online,PSU_online);
                     //Check if state transition only when all module online
                     if (VDU_FLT != 0) {                 //Check if any error
                         VDU_STAT = VDU_Fault;
@@ -211,6 +211,12 @@
                         RST_HMI = 0;
                         RST_cmd = 1;
                         FLT_print = 0;                  //Stop error printing
+//                        FL_online = 5;              // 0 indicate detection timeout
+//                        FR_online = 5;              // reset value is 3 to hold for 0.03sec
+//                        RL_online = 5;              // -1 per 100Hz task
+//                        RR_online = 5;
+//                        PSU_online = 5;
+                        VDU_FLT = 0;
                         VDU_STAT = VDU_PowerOn;
                         printf("VDU rebooting...\n");
                         printf("QDrive rebooting...\n");
@@ -236,6 +242,7 @@
 //            pc.printf("%.3f,%.3f,%.3f\n\r", imu.imuProcessedData.accel[0], imu.imuProcessedData.accel[1], imu.imuProcessedData.accel[2]);
 //            pc.printf("%.3f,%.3f,%.3f\n\r", YR_imu, Ax_imu, Ay_imu);
 //            pc.printf("%.3f,%.3f,%.3f\n\r", Roll_imu, Pitch_imu, Yaw_imu);
+//            pc.printf("%.3f\n\r", Trq_HMI*100.0f);
 
         }
         // End of high speed loop
@@ -252,8 +259,14 @@
             // Print out error mesagge if exist, 0.5Hz repeative
             if(FLT_print != 0) {
                 //Merge Faults
-                FLT_Post = FL_FLT_Post|FR_FLT_Post|RL_FLT_Post|RR_FLT_Post;
-                FLT_Run = FL_FLT_Run|FR_FLT_Run|RL_FLT_Run|RR_FLT_Run;
+
+                //USE THIS FOR FULL FUNCTION
+//                FLT_Post = FL_FLT_Post|FR_FLT_Post|RL_FLT_Post|RR_FLT_Post;
+//                FLT_Run = FL_FLT_Run|FR_FLT_Run|RL_FLT_Run|RR_FLT_Run;
+
+                //ONLY FOR TEST TODO
+                FLT_Post = RL_FLT_Post;     // Use only for single module test
+                FLT_Run = RL_FLT_Run;       //2020/3/10
 
                 //UART
                 FLT_print_cnt += FLT_print;
@@ -337,7 +350,7 @@
     }
 
     //Check ShutDrv voltage when running
-    if(VDU_STAT == VDU_Run) {                
+    if(VDU_STAT == VDU_Run) {
         if(SDn_voltage < 8.0f) {
             VDU_FLT |= ShDVol_VDUFLTCode;       //Shutdown circuit unclosed or uv
         }
@@ -462,7 +475,8 @@
                 FL_online = 5;
                 //If fault
                 if(FL_DSM == 3U) {
-                    VDU_FLT |= DSM_VDUFLTCode;                  //DSM Fault
+                    // USE THIS FOR FULL FUNCTION
+//                    VDU_FLT |= DSM_VDUFLTCode;                  //DSM Fault
                 }
                 break;
 
@@ -477,7 +491,8 @@
                 FR_Trq_est = tmp * 0.01f;
                 FR_online = 5;
                 if(FR_DSM == 3U) {
-                    VDU_FLT |= DSM_VDUFLTCode;                  //DSM Fault
+                    // USE THIS FOR FULL FUNCTION
+//                    VDU_FLT |= DSM_VDUFLTCode;                  //DSM Fault
                 }
                 break;
 
@@ -507,7 +522,8 @@
                 RR_Trq_est = tmp * 0.01f;
                 RR_online = 5;
                 if(RR_DSM == 3U) {
-                    VDU_FLT |= DSM_VDUFLTCode;                  //DSM Fault
+                    // USE THIS FOR FULL FUNCTION
+//                    VDU_FLT |= DSM_VDUFLTCode;                  //DSM Fault
                 }
                 break;