From 6d6f675d0bf6bcfd6afec95be24c8b982ae3ee1d Mon Sep 17 00:00:00 2001
From: fctom1215 <fctom1215@outlook.com>
Date: 星期六, 14 三月 2020 23:44:01 +0800
Subject: [PATCH] 修改车辆传感器,未完成。

---
 lib/src/main/cpp/driver_test.cpp |   28 ++++++++++++----------------
 1 files changed, 12 insertions(+), 16 deletions(-)

diff --git a/lib/src/main/cpp/driver_test.cpp b/lib/src/main/cpp/driver_test.cpp
index 1429252..91672cc 100644
--- a/lib/src/main/cpp/driver_test.cpp
+++ b/lib/src/main/cpp/driver_test.cpp
@@ -101,9 +101,6 @@
 #define RTK_BUFFER_SIZE            100
 #define CAR_MODEL_CACHE_SIZE      10
 
-static pthread_mutex_t rtk_clock_mutex = PTHREAD_MUTEX_INITIALIZER;
-struct RtkTime rtkClock;
-
 static rtk_info *RtkBuffer = NULL;
 static int RtkBufferNum = 0, RtkBufferIn = 0;
 
@@ -121,9 +118,6 @@
 
 void DriverTestInit(void)
 {
-    pthread_mutex_init(&rtk_clock_mutex, NULL);
-    memset(&rtkClock, 0, sizeof(rtkClock));
-
     ExamStart = false;
     memset(&MapList, 0, sizeof(MapList));
     MapNum = 0;
@@ -397,16 +391,10 @@
     }
 }
 
-void GetRtkClock(struct RtkTime *s)
-{
-    pthread_mutex_lock(&rtk_clock_mutex);
-    *s = rtkClock;
-    pthread_mutex_unlock(&rtk_clock_mutex);
-}
-
 void UpdateRTKInfo(const rtk_info *s)
 {
-    pthread_mutex_lock(&rtk_clock_mutex);
+    struct RtkTime rtkClock;
+
     rtkClock.YY = s->YY;
     rtkClock.MM = s->MM;
     rtkClock.DD = s->DD;
@@ -414,7 +402,10 @@
     rtkClock.mm = s->mm;
     rtkClock.ss = s->ss;
     rtkClock.mss = s->dss;
-    pthread_mutex_unlock(&rtk_clock_mutex);
+
+    if (ExamStart) {
+        ExecuteExam(&rtkClock);     // 鎵ц鏃犻渶杞﹁締瀹氫綅鐨勯」鐩�
+    }
 
     if (s->qf == 3) {
         RtkBuffer[RtkBufferIn] = *s;
@@ -517,10 +508,15 @@
     }
 }
 
+static void ExecuteExam(const struct RtkTime* rtkTime)
+{
+
+}
+
 static void ExecuteExam(double speed, int move, double azimuth, const struct RtkTime* rtkTime)
 {
     if (move != 0) {
-        if (ReadSensor(SENSOR_SEATBELT) == 0 && !reportSeatbeltEject) {
+        if (ReadCarStatus(SEATBELT) == EJECT_SEATBELT && !reportSeatbeltEject) {
             DEBUG("涓嶇郴瀹夊叏甯�");
             reportSeatbeltEject = true;
             AddExamFault(1, rtkTime);

--
Gitblit v1.8.0