From 8a09b209f1c546a2fa15329e8f69b4a4f89557c9 Mon Sep 17 00:00:00 2001
From: yy1717 <fctom1215@outlook.com>
Date: 星期五, 21 八月 2020 18:59:19 +0800
Subject: [PATCH] 自适应触发和个子项修改。
---
lib/src/main/cpp/test_items2/operate_gear.cpp | 11 ++++++-----
1 files changed, 6 insertions(+), 5 deletions(-)
diff --git a/lib/src/main/cpp/test_items2/operate_gear.cpp b/lib/src/main/cpp/test_items2/operate_gear.cpp
index 564cbee..5a81d6b 100644
--- a/lib/src/main/cpp/test_items2/operate_gear.cpp
+++ b/lib/src/main/cpp/test_items2/operate_gear.cpp
@@ -19,7 +19,6 @@
static int setup;
static double maxMoveDistance;
-static double gearMoveDistance;
static void TtsBack(int seq)
{
@@ -37,6 +36,8 @@
bool TestOperateGear(const struct RtkTime *rtkTime)
{
+ static struct RtkTime shiftTime;
+
car_sensor_value_t sensor = ReadCarSensorValue(GEAR);
if (sensor.name != GEAR)
@@ -92,11 +93,11 @@
return false;
} else {
// 鍦ㄦ鎸′綅琛岄┒涓�瀹氳窛绂伙紝鍐嶆墽琛屼笅涓�涓�
- gearMoveDistance = ReadOdo();
+ shiftTime = *rtkTime;
setup = 3;
}
} else if (setup == 3) {
- if (ReadOdo() - gearMoveDistance > 10) {
+ if (TimeGetDiff(&shiftTime, rtkTime) >= D_SEC(5)) {
setup = 4;
char buff[128];
expectGear += 0 - upDownShift;
@@ -113,11 +114,11 @@
return false;
} else {
// 鍦ㄦ鎸′綅琛岄┒涓�瀹氳窛绂伙紝鍐嶆墽琛屼笅涓�涓�
- gearMoveDistance = ReadOdo();
+ shiftTime = *rtkTime;
setup = 5;
}
} else if (setup == 5) {
- if (ReadOdo() - gearMoveDistance > 10) {
+ if (TimeGetDiff(&shiftTime, rtkTime) >= D_SEC(5)) {
PlayTTS("鍔犲噺鎸′綅鎿嶄綔缁撴潫", NULL);
return false;
}
--
Gitblit v1.8.0