From b73f32bc8ad86a7bb5f0739ac0fd7aa4c04cce98 Mon Sep 17 00:00:00 2001
From: yy1717 <fctom1215@outlook.com>
Date: 星期三, 25 三月 2020 19:00:06 +0800
Subject: [PATCH] 加减档
---
lib/src/main/cpp/test_items2/road_exam.cpp | 43 +++++++++++++++++++++++++++++++++++++------
1 files changed, 37 insertions(+), 6 deletions(-)
diff --git a/lib/src/main/cpp/test_items2/road_exam.cpp b/lib/src/main/cpp/test_items2/road_exam.cpp
index b280802..6c9e1a6 100644
--- a/lib/src/main/cpp/test_items2/road_exam.cpp
+++ b/lib/src/main/cpp/test_items2/road_exam.cpp
@@ -14,6 +14,7 @@
#include "../master/comm_if.h"
#include "drive_straight.h"
#include "stop_car.h"
+#include "operate_gear.h"
#include <vector>
#include <list>
@@ -40,6 +41,7 @@
static bool occurCrashRedLine;
static bool occurCrashGreenLine;
static bool occurOverSpeed;
+static bool occurSecondBreak;
static int checkCrashGreenTimeout;
static char carIntersectionOfGreenLine;
static int currTurnSignalStatus;
@@ -66,9 +68,13 @@
static int startCar;
static int currExamMapIndex;
+static bool checkDoor = false;
+static bool handBreakActive = false;
+static bool reportRPMOver = false;
+
static const int MAX_ENGINE_RPM = 2500;
-static const double START_CAR_MOVE_DISTANCE = 0.5;//10.0;
-static const double START_CAR_CHECK_DOOR_DISTANCE = 0.1;//1.0;
+static const double START_CAR_MOVE_DISTANCE = 10.0;
+static const double START_CAR_CHECK_DOOR_DISTANCE = 1.0;
static const uint32_t GEAR_N_SLIDE_TIMEOUT = D_SEC(5);
static const uint32_t GEAR_ERROR_TIMEOUT = D_SEC(15);
static const uint32_t STOP_CAR_TIME = D_SEC(2);
@@ -97,6 +103,7 @@
occurCrashRedLine = false;
occurCrashGreenLine = false;
occurOverSpeed = false;
+ occurSecondBreak = false;
checkCrashGreenTimeout = 0;
carIntersectionOfGreenLine = 0;
@@ -116,14 +123,22 @@
currExamMapIndex = -1;
startCar = START_CAR_NOT_DO;
+
+ checkDoor = false;
+ handBreakActive = false;
+ reportRPMOver = false;
+}
+
+void TerminateRoadExam(void)
+{
+ TerminateDummyLightExam();
+ TerminateStopCarExam();
+ TerminateOperateGearExam();
}
static void TestRoadStartCar(const car_model *car, double speed, int moveDirect, const struct RtkTime *rtkTime)
{
double moveDistance;
- static bool checkDoor = false;
- static bool handBreakActive = false;
- static bool reportRPMOver = false;
if (startCar == START_CAR_NOT_DO) {
startPoint = car->basePoint;
@@ -186,6 +201,18 @@
}
} else {
occurOverSpeed = false;
+ }
+
+ // 鍓埞杞︽娴�
+ if (ReadCarStatus(SECOND_BREAK) == BREAK_ACTIVE) {
+ // 鍓埞杞﹁俯涓嬶紝涓嶅悎鏍�
+ if (!occurSecondBreak) {
+ DEBUG("鍓埞杞﹀姩浣滀簡");
+ occurSecondBreak = true;
+ AddExamFault(17, rtkTime);
+ }
+ } else {
+ occurSecondBreak = false;
}
// 鎸′綅鍖归厤妫�娴�
@@ -327,7 +354,6 @@
currTurnSignalStatus = ReadCarStatus(TURN_SIGNAL_LAMP);
break;
}
-
// 妫�鏌ユ槸鍚︽寔缁浆鍚�
char turnDirect = CheckCarTurn(CarModelList);
@@ -491,6 +517,8 @@
StartDriveStraightExam(currExamMapIndex, RoadMapList);
} else if (RoadMapList[currExamMapIndex].type == STOP_CAR_MAP) {
StartStopCarExam(currExamMapIndex, RoadMapList);
+ } else if (RoadMapList[currExamMapIndex].type == OP_GEAER_MAP) {
+ StartOperateGearExam(currExamMapIndex, RoadMapList);
}
}
} else if (startCar == START_CAR_DONE) {
@@ -506,6 +534,9 @@
} else if (RoadMapList[currExamMapIndex].type == STOP_CAR_MAP) {
currExamMapIndex = ExecuteStopCarExam(currExamMapIndex, RoadMapList, car,
CarModelList, speed, moveDirect, rtkTime);
+ } else if (RoadMapList[currExamMapIndex].type == OP_GEAER_MAP) {
+ currExamMapIndex = ExecuteOperateGearExam(currExamMapIndex, RoadMapList, car,
+ CarModelList, speed, moveDirect, rtkTime);
}
if (currExamMapIndex == -1) {
--
Gitblit v1.8.0