From 39573da26137913422e6a4b8646eddfa8ef52c50 Mon Sep 17 00:00:00 2001
From: lizhanwei <Dana_Lee1016@126.com>
Date: 星期一, 20 一月 2020 14:52:20 +0800
Subject: [PATCH] upate cc

---
 lib/src/main/cpp/master/comm_if.h   |    2 +
 lib/src/main/cpp/driver_test.cpp    |   19 ++++-----
 lib/src/main/cpp/master/comm_if.cpp |   41 ++++++++++++++++++++
 lib/src/main/cpp/rtk_module/rtk.cpp |    6 +-
 4 files changed, 55 insertions(+), 13 deletions(-)

diff --git a/lib/src/main/cpp/driver_test.cpp b/lib/src/main/cpp/driver_test.cpp
index fc226e2..41b802d 100644
--- a/lib/src/main/cpp/driver_test.cpp
+++ b/lib/src/main/cpp/driver_test.cpp
@@ -153,7 +153,7 @@
         MapList[MapNum].map.point = (PointF *)malloc(sizeof(PointF) * pointNum);
         for (int i = 0; i < pointNum; ++i) {
             MapList[MapNum].map.point[i].X = map[i][0];
-            MapList[MapNum].map.point[i].Y = map[i][0];
+            MapList[MapNum].map.point[i].Y = map[i][1];
         }
     }
 
@@ -162,7 +162,7 @@
         MapList[MapNum].map2.point = (PointF *)malloc(sizeof(PointF) * pointNum2);
         for (int i = 0; i < pointNum2; ++i) {
             MapList[MapNum].map2.point[i].X = map2[i][0];
-            MapList[MapNum].map2.point[i].Y = map2[i][0];
+            MapList[MapNum].map2.point[i].Y = map2[i][1];
         }
     }
 
@@ -293,6 +293,8 @@
 {
     bool err = false;
 
+    DEBUG("StartDriverExam %d", start);
+
     if (MapNum == 0) {
         err = true;
         MA_SendExamStatus(0, -1);
@@ -376,9 +378,13 @@
                 CurrExamMapId = EnterMap(CarModel, MapList, MapNum);
                 int mtype = GetMapType(CurrExamMapId, MapList, MapNum);
 
+                DEBUG("CurrExamMapId %d mtype %d", CurrExamMapId, mtype);
+
                 switch (mtype) {
                     case MAP_TYPE_PARK_BUTTOM:
                         DEBUG("杩涘叆鍊掕溅鍏ュ簱鍦哄湴");
+                        MA_SendDebugInfo("杩涘叆鍊掕溅鍏ュ簱鍦哄湴 %d", CurrExamMapId);
+
                         StartParkBottom();
                         CurrExamStatus = 0;
                         break;
@@ -405,14 +411,6 @@
         rtkTime.ss = RtkBuffer[index].ss;
         rtkTime.mss = RtkBuffer[index].dss;
 
-        static int en = 0;
-        static int gcc = 0;
-
-        if (gcc % 100 == 0) {
-            AddExamFault(++en, &rtkTime);
-        }
-        gcc++;
-
         if (CurrExamMapId >= 0) {
             if (CurrExamStatus == 0) {
                 int mtype = GetMapType(CurrExamMapId, MapList, MapNum);
@@ -436,6 +434,7 @@
             if (CurrExamStatus != 0) {
                 if (ExitMap(CarModel, CurrExamMapId, MapList, MapNum)) {
                     DEBUG("閫�鍑哄満鍦� %d", CurrExamMapId);
+                    MA_SendDebugInfo("閫�鍑哄満鍦� %d", CurrExamMapId);
                     CurrExamMapId = -1;
                 }
             }
diff --git a/lib/src/main/cpp/master/comm_if.cpp b/lib/src/main/cpp/master/comm_if.cpp
index 50236fc..798b389 100644
--- a/lib/src/main/cpp/master/comm_if.cpp
+++ b/lib/src/main/cpp/master/comm_if.cpp
@@ -45,6 +45,8 @@
 #define ID_SM_EXAM_BRIEF         0x000C
 #define ID_SM_ENTER_MAP         0x000D
 #define ID_SM_CAR               0x000E
+#define ID_SM_RTCM_IND           0x000F
+#define ID_SM_DEBUG_INFO        0x0010
 
 static int OnOff = 0xFFFF;
 
@@ -313,6 +315,45 @@
     SendMsgToMainProc(ID_SM_CAR, sb.GetString());
 }
 
+void MA_SendRtcmInd(int length)
+{
+    if (!(OnOff & BV(3))) return;
+
+    StringBuffer sb;
+    Writer<StringBuffer> writer(sb);
+
+    writer.StartObject();
+    writer.Key("length");
+    writer.Int(length);
+    writer.EndObject();
+
+    SendMsgToMainProc(ID_SM_RTCM_IND, sb.GetString());
+}
+
+void MA_SendDebugInfo(const char *str, ...)
+{
+    if (!(OnOff & BV(4)))
+        return;
+
+    va_list argp;
+    char buffer[1024];
+
+    va_start(argp, str);
+    vsprintf(buffer, str, argp);
+    va_end(argp);
+
+    StringBuffer sb;
+    Writer<StringBuffer> writer(sb);
+
+    writer.StartObject();
+
+    writer.Key("info");
+    writer.String(buffer);
+    writer.EndObject();
+
+    SendMsgToMainProc(ID_SM_DEBUG_INFO, sb.GetString());
+}
+
 void MA_MainProcMsgEntry(int cmd, const char *value)
 {
     switch (cmd) {
diff --git a/lib/src/main/cpp/master/comm_if.h b/lib/src/main/cpp/master/comm_if.h
index 36694fd..34a6cae 100644
--- a/lib/src/main/cpp/master/comm_if.h
+++ b/lib/src/main/cpp/master/comm_if.h
@@ -64,5 +64,7 @@
 void MA_SendRtkBrief(const struct rtkBrief *brief);
 void MA_SendCarPosition(const struct carBrief *brief);
 void MA_SendExamWrong(vector<ExamFault> &ExamFaultList);
+void MA_SendRtcmInd(int length);
+void MA_SendDebugInfo(const char *str, ...);
 
 #endif //MYAPPLICATION2_COMM_IF_H
diff --git a/lib/src/main/cpp/rtk_module/rtk.cpp b/lib/src/main/cpp/rtk_module/rtk.cpp
index 9d3a6e1..7f39953 100644
--- a/lib/src/main/cpp/rtk_module/rtk.cpp
+++ b/lib/src/main/cpp/rtk_module/rtk.cpp
@@ -346,7 +346,7 @@
     CurrRTKInfo.DD = str2int(s->nmea_value[1].data + 2, 2);
     CurrRTKInfo.YY = str2int(s->nmea_value[1].data + 4, 2);
 
-    CurrRTKInfo.qf = str2int(s->nmea_value[6].data, s->nmea_value[6].length);
+    CurrRTKInfo.qf = 3;//str2int(s->nmea_value[6].data, s->nmea_value[6].length);
 
     // NOTE: RTK妯″潡鏄互鍗楀寳鍚戜负X杞达紝瑗夸笢鍚戜负Y杞达紝鎴戜滑浜ゆ崲涓嬶紝浠ョ鍚堜竴鑸�昏緫
     str2float(&CurrRTKInfo.y, s->nmea_value[2].data, s->nmea_value[2].length);
@@ -355,8 +355,8 @@
     static double sbx = -12;
     static double sby = 27;
 
-//    CurrRTKInfo.x = sbx;
-//    CurrRTKInfo.y = sby;
+    CurrRTKInfo.x = (-2.8984 - 4.913)/2;
+    CurrRTKInfo.y = (31.6962 + 29.4974)/2;
 
     sbx += 0.01;
     sby += 0.01;

--
Gitblit v1.8.0