|
@@ -13,6 +13,7 @@
|
|
|
#include "canmsg.pb.h"
|
|
|
#include "decition.pb.h"
|
|
|
#include <thread>
|
|
|
+#include <QMutex>
|
|
|
|
|
|
void * gpacansend;
|
|
|
void * gpadecition;
|
|
@@ -24,6 +25,8 @@ bool gbSendRun = true;
|
|
|
iv::brain::decition gdecition_def;
|
|
|
iv::brain::decition gdecition;
|
|
|
|
|
|
+QMutex gMutexDecision;
|
|
|
+
|
|
|
|
|
|
QTime gTime;
|
|
|
int gnLastSendTime = 0;
|
|
@@ -87,8 +90,8 @@ void executeDecition(const iv::brain::decition decition)
|
|
|
rightlampSig = decition.rightlamp();
|
|
|
gcontroller->control_turnsignals(leftlampSig,rightlampSig);
|
|
|
|
|
|
- if(decition.has_engine())
|
|
|
- gcontroller->control_engine(decition.engine());
|
|
|
+// if(decition.has_engine())
|
|
|
+// gcontroller->control_engine(decition.engine());
|
|
|
if(decition.has_speak())
|
|
|
gcontroller->control_speaker(decition.speak());
|
|
|
|
|
@@ -106,7 +109,9 @@ void ListenDeciton(const char * strdata,const unsigned int nSize,const unsigned
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
+ gMutexDecision.lock();
|
|
|
gdecition.CopyFrom(xdecition);
|
|
|
+ gMutexDecision.unlock();
|
|
|
gnDecitionNum = gnDecitionNumMax;
|
|
|
|
|
|
|
|
@@ -155,7 +160,9 @@ void sendthread()
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
+ gMutexDecision.lock();
|
|
|
xdecition.CopyFrom(gdecition);
|
|
|
+ gMutexDecision.unlock();
|
|
|
gnDecitionNum--;
|
|
|
}
|
|
|
executeDecition(xdecition);
|