فهرست منبع

change controller_changan_a07, test ok.

yuchuli 1 ماه پیش
والد
کامیت
effa83b47d
1فایلهای تغییر یافته به همراه44 افزوده شده و 4 حذف شده
  1. 44 4
      src/controller/controller_changan_a07/main.cpp

+ 44 - 4
src/controller/controller_changan_a07/main.cpp

@@ -202,12 +202,48 @@ void executeDecition(const iv::brain::decition &decition)
     }
 
 
+    static int nlreq = 0;
+    static int nrreq = 0;
     if(decition.leftlamp() == true && decition.rightlamp() == false)
+    {
         SetMsgSignal("ECU_30A","ADS_UDLCTurnLightReq",3.0);
-    else if(decition.leftlamp() == false && decition.rightlamp() == true)
-        SetMsgSignal("ECU_30A","ADS_UDLCTurnLightReq",4.0);
+        nlreq = 30;
+        nrreq = 0;
+    }
     else
-        SetMsgSignal("ECU_30A","ADS_UDLCTurnLightReq",0.0);
+    {
+        if(decition.leftlamp() == false && decition.rightlamp() == true)
+        {
+            SetMsgSignal("ECU_30A","ADS_UDLCTurnLightReq",4.0);
+            nrreq = 30;
+            nlreq = 0;
+        }
+        else
+        {
+            if((nlreq == 0)  && (nrreq == 0))
+            {
+                SetMsgSignal("ECU_30A","ADS_UDLCTurnLightReq",0.0);
+            }
+            else
+            {
+            if(nlreq > 0)
+            {
+                nlreq--;
+                SetMsgSignal("ECU_30A","ADS_UDLCTurnLightReq",1.0);
+ //               std::cout<<"turn off left."<<std::endl;
+
+            }
+            else
+            {
+                nrreq--;
+                SetMsgSignal("ECU_30A","ADS_UDLCTurnLightReq",2.0);
+                std::cout<<" set light off"<<std::endl;
+            }
+            }
+        }
+    }
+
+
 
 
 }
@@ -509,7 +545,7 @@ void ExecSend()
     pxrawB2->CopyFrom(xraw);
 
     int64_t nnow = std::chrono::system_clock::now().time_since_epoch().count();
-    if((nnow - gnchronodecitionext)<1000)
+    if((nnow - gnchronodecitionext)<1e9)
     {
         if(gbdecitionextupdate)
         {
@@ -529,6 +565,8 @@ void ExecSend()
             iv::can::canraw * pxraw2CA = xmsg.add_rawmsg();
             pxraw2CA->CopyFrom(xraw);
 
+            std::cout<<" send 2ca."<<std::endl;
+
             gbdecitionextupdate = false;
         }
     }
@@ -556,6 +594,8 @@ void ExecSend()
         std::cout<<"ExecSend serialize error."<<std::endl;
     }
 
+//    std::cout<<" send can."<<std::endl;
+
 
 }