From d05c25aa4823e9d2aa812e9c0e3d1d66bb9861dd Mon Sep 17 00:00:00 2001
From: fctom1215 <fctom1215@outlook.com>
Date: 星期六, 29 八月 2020 10:47:17 +0800
Subject: [PATCH] 坐标

---
 lib/src/main/cpp/test_items2/operate_gear.cpp |   26 +++++++++++++++++---------
 1 files changed, 17 insertions(+), 9 deletions(-)

diff --git a/lib/src/main/cpp/test_items2/operate_gear.cpp b/lib/src/main/cpp/test_items2/operate_gear.cpp
index 157d2a7..d365cc7 100644
--- a/lib/src/main/cpp/test_items2/operate_gear.cpp
+++ b/lib/src/main/cpp/test_items2/operate_gear.cpp
@@ -47,9 +47,10 @@
     if (setup == 0) {
         return true;
     } else if (setup == 1) {
-        if (sensor.value != GEAR_N)
+        if (sensor.value != GEAR_N) {
             oldGear = sensor.value;
-
+            DEBUG("鍑嗗棣栨鎹㈡尅 GEAR = %d", oldGear);
+        }
         switch (sensor.value) {
             case GEAR_1: {
                 expectGear = GEAR_2;
@@ -89,49 +90,56 @@
         }
     } else if (setup == 2) {
         if (sensor.value == GEAR_N || sensor.value == oldGear) {
-
+            DEBUG("绛夊緟棣栨鎹㈡尅");
         } else if (sensor.value != expectGear) {
             // 鏈寜鎸囦护鎿嶄綔鎸′綅锛屼笉鍚堟牸
-            DEBUG("鏈寜鎸囦护鎿嶄綔鎸′綅");
+            DEBUG("棣栨鎹㈡尅閿欒 GEAR %d  甯屾湜 %d", sensor.value, expectGear);
             AddExamFault(31, rtkTime);
             return false;
         } else {
             // 鍦ㄦ鎸′綅琛岄┒涓�瀹氳窛绂伙紝鍐嶆墽琛屼笅涓�涓�
+            DEBUG("棣栨鎹㈡尅鎴愬姛锛屼笅涓�涓�...");
             oldGear = expectGear;
             shiftTime = *rtkTime;
             setup = 3;
         }
     } else if (setup == 3) {
-        if (TimeGetDiff(&shiftTime, rtkTime) >= D_SEC(4)) {
+        if (TimeGetDiff(rtkTime, &shiftTime) >= D_SEC(3)) {
             setup = 4;
             char buff[128];
             expectGear += 0 - upDownShift;
             sprintf(buff, "璇�%s鍒�%d鎸�", upDownShift > 0 ? "鍑�": "鍔�", expectGear - GEAR_N);
+            PlayTTS(buff, NULL);
+
+            DEBUG("%s", buff);
+            DEBUG("鍑嗗浜屾鎹㈡尅 甯屾湜 %d", expectGear);
         }
     } 
     else if (setup == 4) {
         if (sensor.value == GEAR_N || sensor.value == oldGear) {
-
+            DEBUG("绛夊緟浜屾鎹㈡尅");
         } else if (sensor.value != expectGear) {
             // 鏈寜鎸囦护鎿嶄綔鎸′綅锛屼笉鍚堟牸
-            DEBUG("鏈寜鎸囦护鎿嶄綔鎸′綅");
+            DEBUG("浜屾鎹㈡尅閿欒 GEAR %d  甯屾湜 %d", sensor.value, expectGear);
             AddExamFault(31, rtkTime);
             return false;
         } else {
             // 鍦ㄦ鎸′綅琛岄┒涓�瀹氳窛绂伙紝鍐嶆墽琛屼笅涓�涓�
             shiftTime = *rtkTime;
             setup = 5;
+            DEBUG("浜屾鎹㈡尅鎴愬姛锛屼笅涓�涓�...");
         }
     } else if (setup == 5) {
-        if (TimeGetDiff(&shiftTime, rtkTime) >= D_SEC(5)) {
+        if (TimeGetDiff(rtkTime, &shiftTime) >= D_SEC(3)) {
             PlayTTS("鍔犲噺鎸′綅鎿嶄綔缁撴潫", NULL);
+            DEBUG("鍔犲噺鎸′綅鎿嶄綔缁撴潫");
             return false;
         }
     }
 
     if (ReadOdo() - maxMoveDistance > 120) {
         // 鏈寜鎸囦护鎿嶄綔鎸′綅锛屼笉鍚堟牸
-        DEBUG("鏈寜鎸囦护鎿嶄綔鎸′綅");
+        DEBUG("鏈寜鎸囦护鎿嶄綔鎸′綅锛岃秴鏃�");
         AddExamFault(31, rtkTime);
         return false;
     }

--
Gitblit v1.8.0