From ce568d65d1738e0dfe64e0f903c9aa8d05cd365b Mon Sep 17 00:00:00 2001
From: fctom1215 <fctom1215@outlook.com>
Date: 星期四, 27 二月 2020 22:14:50 +0800
Subject: [PATCH] 角度修正。
---
lib/src/main/cpp/test_items/park_bottom.cpp | 2
lib/src/main/cpp/test_items/turn_a90.cpp | 2
lib/src/main/cpp/driver_test.cpp | 40 ++++++++++++--------
lib/src/main/cpp/test_items/park_edge.cpp | 2
lib/src/main/cpp/test_items/stop_and_start.cpp | 2
lib/src/main/cpp/native-lib.cpp | 5 ++
lib/src/main/cpp/test_items2/common_check.cpp | 5 ++
lib/src/main/cpp/CMakeLists.txt | 3 +
lib/src/main/cpp/test_items2/common_check.h | 8 ++++
lib/src/main/cpp/driver_test.h | 5 ++
10 files changed, 53 insertions(+), 21 deletions(-)
diff --git a/lib/src/main/cpp/CMakeLists.txt b/lib/src/main/cpp/CMakeLists.txt
index 044fbc1..31b9e27 100644
--- a/lib/src/main/cpp/CMakeLists.txt
+++ b/lib/src/main/cpp/CMakeLists.txt
@@ -34,6 +34,9 @@
test_items/driving_curve.cpp
test_items/turn_a90.cpp
test_items/comm_test.cpp
+
+ test_items2/common_check.cpp
+
rtk_module/rtk.cpp
rtk_module/virtual_rtk.cpp
master/comm_if.cpp
diff --git a/lib/src/main/cpp/driver_test.cpp b/lib/src/main/cpp/driver_test.cpp
index 9a183b8..d9adce2 100644
--- a/lib/src/main/cpp/driver_test.cpp
+++ b/lib/src/main/cpp/driver_test.cpp
@@ -79,7 +79,7 @@
static int CurrExamMapIndex = -1;
static int CurrEnterMapIndex = -1;
-static int CurrExamStatus = 0; // 1 娴嬭瘯瀹屾垚 0 娴嬭瘯涓� -1 娴嬭瘯閿欒閫�鍑�
+static int CurrExamStatus = EXAM_AREA_NONE; // 1 娴嬭瘯瀹屾垚 0 娴嬭瘯涓� -1 娴嬭瘯閿欒閫�鍑�
static car_model *CarModel = NULL;
static car_model *CarModelPrev = NULL;
@@ -132,6 +132,8 @@
RtkBuffer = (rtk_info *) malloc(RTK_BUFFER_SIZE * sizeof(rtk_info));
RtkBufferNum = RtkBufferIn = 0;
+
+ CurrExamStatus = EXAM_AREA_NONE;
}
static void ReadDriverExamPrimerTimeout(union sigval sig)
@@ -397,7 +399,7 @@
if (map_id >= 0 && exam == 0) {
CurrExamMapIndex = map_id;
- CurrExamStatus = 2;
+ CurrExamStatus = EXAM_AREA_START;
}
}
@@ -497,7 +499,7 @@
MA_EnterMap(GetMapId(CurrEnterMapIndex, MapList, MapNum), 1);
CurrExamMapIndex = CurrEnterMapIndex;
- CurrExamStatus = 2;
+ CurrExamStatus = EXAM_AREA_START;
}
} else {
if (ExitMap(CarModel, CurrEnterMapIndex, MapList, MapNum)) {
@@ -513,7 +515,7 @@
if (CurrExamMapIndex >= 0) {
int mtype = GetMapType(CurrExamMapIndex, MapList, MapNum);
- if (CurrExamStatus == 2) {
+ if (CurrExamStatus == EXAM_AREA_START) {
DEBUG("CurrExamMapIndex %d mtype %d", GetMapId(CurrExamMapIndex, MapList, MapNum), mtype);
switch (mtype) {
@@ -522,20 +524,20 @@
MA_SendDebugInfo("杩涘叆鍊掕溅鍏ュ簱鍦哄湴 %d", GetMapId(CurrExamMapIndex, MapList, MapNum));
StartParkBottom(move, &rtkTime);
- CurrExamStatus = 0;
+ CurrExamStatus = EXAM_AREA_RUN;
break;
case MAP_TYPE_STOP_START:
DEBUG("杩涘叆涓婂潯璧锋鍦哄湴");
MA_SendDebugInfo("杩涘叆涓婂潯璧锋鍦哄湴 %d", GetMapId(CurrExamMapIndex, MapList, MapNum));
StartSAS(move, &rtkTime);
- CurrExamStatus = 0;
+ CurrExamStatus = EXAM_AREA_RUN;
break;
case MAP_TYPE_PART_EDGE:
DEBUG("杩涘叆渚ф柟浣嶅仠杞﹀満鍦�");
MA_SendDebugInfo("杩涘叆渚ф柟浣嶅仠杞﹀満鍦� %d", GetMapId(CurrExamMapIndex, MapList, MapNum));
StartParkEdge(move, &rtkTime);
- CurrExamStatus = 0;
+ CurrExamStatus = EXAM_AREA_RUN;
break;
case MAP_TYPE_CURVE:
break;
@@ -543,38 +545,44 @@
DEBUG("杩涘叆鐩磋杞集鍦哄湴");
MA_SendDebugInfo("杩涘叆鐩磋杞集鍦哄湴 %d", GetMapId(CurrExamMapIndex, MapList, MapNum));
StartTurnA90(move, azimuth, &rtkTime);
- CurrExamStatus = 0;
+ CurrExamStatus = EXAM_AREA_RUN;
break;
default:break;
}
- } else if (CurrExamStatus == 0) {
+ } else if (CurrExamStatus == EXAM_AREA_RUN) {
+ int testing = 0;
switch (mtype) {
case MAP_TYPE_PARK_BUTTOM:
- CurrExamStatus = TestParkBottom(&MapList[CurrExamMapIndex].map,
+ testing = TestParkBottom(&MapList[CurrExamMapIndex].map,
CarModel, CarModelPrev, speed, move, &rtkTime);
break;
case MAP_TYPE_STOP_START:
- CurrExamStatus = TestSAS(&MapList[CurrExamMapIndex].map, CarModel, CarModelPrev, speed, move, &rtkTime);
+ testing = TestSAS(&MapList[CurrExamMapIndex].map, CarModel, CarModelPrev, speed, move, &rtkTime);
break;
case MAP_TYPE_PART_EDGE:
- CurrExamStatus = TestParkEdge(&MapList[CurrExamMapIndex].map, CarModel, CarModelPrev, speed, move, &rtkTime);
+ testing = TestParkEdge(&MapList[CurrExamMapIndex].map, CarModel, CarModelPrev, speed, move, &rtkTime);
break;
case MAP_TYPE_CURVE:
break;
case MAP_TYPE_TURN_90:
- CurrExamStatus = TestTurnA90(&MapList[CurrExamMapIndex].map, CarModel, CarModelPrev, azimuth, speed, move, &rtkTime);
+ testing = TestTurnA90(&MapList[CurrExamMapIndex].map, CarModel, CarModelPrev, azimuth, speed, move, &rtkTime);
break;
default:
- CurrExamStatus = 1;
break;
+ }
+
+ if (testing > 0) {
+ CurrExamStatus = EXAM_AREA_RUN;
+ } else {
+ CurrExamStatus = EXAM_AREA_END;
}
}
- if (CurrExamStatus == 1) {
+ if (CurrExamStatus != EXAM_AREA_RUN) {
// 鏌愰」缁撴潫
//DEBUG("閫�鍑哄満鍦� %d", GetMapId(CurrExamMapIndex, MapList, MapNum));
//MA_SendDebugInfo("閫�鍑哄満鍦� %d", GetMapId(CurrExamMapIndex, MapList, MapNum));
-
+ CurrExamStatus = EXAM_AREA_NONE;
CurrExamMapIndex = -1;
}
}
diff --git a/lib/src/main/cpp/driver_test.h b/lib/src/main/cpp/driver_test.h
index 356f30f..307db69 100644
--- a/lib/src/main/cpp/driver_test.h
+++ b/lib/src/main/cpp/driver_test.h
@@ -10,6 +10,11 @@
#include <vector>
+#define EXAM_AREA_NONE 0
+#define EXAM_AREA_START 1
+#define EXAM_AREA_RUN 2
+#define EXAM_AREA_END 3
+
#define TIRE_OUTSIDE 0
#define TIRE_INSIDE 1
#define AXIAL_FRONT 0
diff --git a/lib/src/main/cpp/native-lib.cpp b/lib/src/main/cpp/native-lib.cpp
index 9fb8def..bd79e17 100644
--- a/lib/src/main/cpp/native-lib.cpp
+++ b/lib/src/main/cpp/native-lib.cpp
@@ -26,6 +26,9 @@
const int RTK_PLATFORM_PORT = 12125;
const uint8_t phone[] = {0x20,0x19,0x10,0x15,0x00,0x00,0x00,0x01};
+const char *VIRTUAL_RTK_IP = "192.168.3.52";
+const int VIRTUAL_RTK_PORT = 9001;
+
static void SendBootIndicate(union sigval sig);
int DESEncrypt(const uint8_t *key, int key_length,
@@ -245,7 +248,7 @@
InitPlatform(phone, RTK_PLATFORM_IP, RTK_PLATFORM_PORT);
AppTimer_add(SendBootIndicate, 500);
- InitVirtualDevice("192.168.86.101", 9001);
+ InitVirtualDevice(VIRTUAL_RTK_IP, VIRTUAL_RTK_PORT);
}
static void SendBootIndicate(union sigval sig) {
diff --git a/lib/src/main/cpp/test_items/park_bottom.cpp b/lib/src/main/cpp/test_items/park_bottom.cpp
index 79b0678..b0a598b 100644
--- a/lib/src/main/cpp/test_items/park_bottom.cpp
+++ b/lib/src/main/cpp/test_items/park_bottom.cpp
@@ -209,7 +209,7 @@
}
TEST_END:
- return testing ? 0 : 1;
+ return testing ? 1 : 0;
}
// 妫�娴�2鍓嶈疆鏄惁姝e悜瓒婅繃宸﹀彸鎺у埗绾�
diff --git a/lib/src/main/cpp/test_items/park_edge.cpp b/lib/src/main/cpp/test_items/park_edge.cpp
index 8656e46..2e18601 100644
--- a/lib/src/main/cpp/test_items/park_edge.cpp
+++ b/lib/src/main/cpp/test_items/park_edge.cpp
@@ -165,7 +165,7 @@
}
}
TEST_END:
- return testing ? 0 : 1;
+ return testing ? 1 : 0;
}
// 杞﹁疆鏄惁鍘嬮亾璺竟绾�
diff --git a/lib/src/main/cpp/test_items/stop_and_start.cpp b/lib/src/main/cpp/test_items/stop_and_start.cpp
index 8ce210b..47d263f 100644
--- a/lib/src/main/cpp/test_items/stop_and_start.cpp
+++ b/lib/src/main/cpp/test_items/stop_and_start.cpp
@@ -171,7 +171,7 @@
}
}
- return testing ? 0 : 1;
+ return testing ? 1 : 0;
}
// 杞﹁疆鏄惁鍘嬭竟绾�
diff --git a/lib/src/main/cpp/test_items/turn_a90.cpp b/lib/src/main/cpp/test_items/turn_a90.cpp
index cedcaf7..fa753ac 100644
--- a/lib/src/main/cpp/test_items/turn_a90.cpp
+++ b/lib/src/main/cpp/test_items/turn_a90.cpp
@@ -112,7 +112,7 @@
}
TEST_END:
- return testing?0:1;
+ return testing? 1:0;
}
// 杞﹁疆鏄惁鍘嬭竟绾�
diff --git a/lib/src/main/cpp/test_items2/common_check.cpp b/lib/src/main/cpp/test_items2/common_check.cpp
new file mode 100644
index 0000000..2fce091
--- /dev/null
+++ b/lib/src/main/cpp/test_items2/common_check.cpp
@@ -0,0 +1,5 @@
+//
+// Created by fctom on 2020/2/27.
+//
+
+#include "common_check.h"
diff --git a/lib/src/main/cpp/test_items2/common_check.h b/lib/src/main/cpp/test_items2/common_check.h
new file mode 100644
index 0000000..5860628
--- /dev/null
+++ b/lib/src/main/cpp/test_items2/common_check.h
@@ -0,0 +1,8 @@
+//
+// Created by fctom on 2020/2/27.
+//
+
+#ifndef MYAPPLICATION2_COMMON_CHECK_H
+#define MYAPPLICATION2_COMMON_CHECK_H
+
+#endif //MYAPPLICATION2_COMMON_CHECK_H
--
Gitblit v1.8.0