فهرست منبع

change controller_changan_s05. test window and lock ok. wheel can control. light ok.

yuchuli 2 ماه پیش
والد
کامیت
dd6718bbd1
1فایلهای تغییر یافته به همراه39 افزوده شده و 4 حذف شده
  1. 39 4
      src/controller/controller_changan_s05/main.cpp

+ 39 - 4
src/controller/controller_changan_s05/main.cpp

@@ -215,12 +215,45 @@ void executeDecition(const iv::brain::decition &decition)
     }
 
 
+    static int nlreq = 0;
+    static int nrreq = 0;
     if(decition.leftlamp() == true && decition.rightlamp() == false)
+    {
         SetMsgSignal("ECU_103","ADS_UDLCTurnLightReq",3.0);
-    else if(decition.leftlamp() == false && decition.rightlamp() == true)
-        SetMsgSignal("ECU_103","ADS_UDLCTurnLightReq",4.0);
+        nlreq = 10;
+        nrreq = 0;
+    }
     else
-        SetMsgSignal("ECU_103","ADS_UDLCTurnLightReq",0.0);
+    {
+        if(decition.leftlamp() == false && decition.rightlamp() == true)
+        {
+            SetMsgSignal("ECU_103","ADS_UDLCTurnLightReq",4.0);
+            nrreq = 10;
+            nlreq = 0;
+        }
+        else
+        {
+            if((nlreq == 0)  && (nrreq == 0))
+            {
+                SetMsgSignal("ECU_103","ADS_UDLCTurnLightReq",0.0);
+            }
+            else
+            {
+            if(nlreq > 0)
+            {
+                nlreq--;
+                SetMsgSignal("ECU_103","ADS_UDLCTurnLightReq",1.0);
+ //               std::cout<<"turn off left."<<std::endl;
+
+            }
+            else
+            {
+                nrreq--;
+                SetMsgSignal("ECU_103","ADS_UDLCTurnLightReq",2.0);
+            }
+            }
+        }
+    }
 
 
 }
@@ -525,7 +558,7 @@ void ExecSend()
     pxraw106->CopyFrom(xraw);
 
     int64_t nnow = std::chrono::system_clock::now().time_since_epoch().count();
-    if((nnow - gnchronodecitionext)<1000)
+    if((nnow - gnchronodecitionext)<1e9)
     {
         if(gbdecitionextupdate)
         {
@@ -545,6 +578,8 @@ void ExecSend()
             iv::can::canraw * pxraw105 = xmsg.add_rawmsg();
             pxraw105->CopyFrom(xraw);
 
+            std::cout<<" send 105"<<std::endl;
+
             gbdecitionextupdate = false;
         }
     }