From 20bd5ec5a7f859c0f98f13ef62b906b1c781e51b Mon Sep 17 00:00:00 2001
From: fctom1215 <fctom1215@outlook.com>
Date: 星期日, 07 二月 2021 09:25:53 +0800
Subject: [PATCH] 暂时屏蔽获取车模型从平台  直接打开mapfragment 跳过arcgis

---
 lib/src/main/cpp/test_items/turn_a90.cpp    |    3 -
 lib/src/main/cpp/test_items/area_exam.cpp   |    2 +
 lib/src/main/cpp/rtk_module/rtk.cpp         |    2 
 lib/src/main/cpp/test_common/car_sensor.cpp |   42 ++++++++++++++++++---
 lib/src/main/cpp/mcu/mcu_if.cpp             |   22 ++++++++++
 lib/src/main/cpp/rtk_platform/platform.cpp  |   11 ++++-
 6 files changed, 70 insertions(+), 12 deletions(-)

diff --git a/lib/src/main/cpp/mcu/mcu_if.cpp b/lib/src/main/cpp/mcu/mcu_if.cpp
index 10b9b7d..c658caa 100644
--- a/lib/src/main/cpp/mcu/mcu_if.cpp
+++ b/lib/src/main/cpp/mcu/mcu_if.cpp
@@ -399,7 +399,27 @@
         case ID_MC_MCU_DFU_RSP:
             break;
         case ID_MC_CAR_INFO2:
-//            DEBUG("ID_MC_CAR_INFO2 %d", length);
+           /* DEBUG("ID_MC_CAR_INFO2 %d", length);
+
+            {
+                static char buffd[16384];
+
+                buffd[0] = 0;
+                int i = 0;
+                for (i = 0; i < length; i++) {
+                    if ((i % 32) == 0) {
+                        sprintf(buffd + strlen(buffd), "\n");
+                    }
+                    sprintf(buffd + strlen(buffd), "%02X ", data[i]);
+                    if (strlen(buffd) > 800) {
+                        DEBUG("%s <- %s...", "杞﹁締淇″彿" , buffd);
+                        buffd[0] = 0;
+                    }
+                }
+                if (strlen(buffd) > 0)
+                    DEBUG("%s <- %s", "杞﹁締淇″彿" , buffd);
+            }*/
+
             if (length > 0) {
                 PlatformStatusChanged(CAR_SENSOR_UPDATE_EVT, data, length);
             }
diff --git a/lib/src/main/cpp/rtk_module/rtk.cpp b/lib/src/main/cpp/rtk_module/rtk.cpp
index 82eab51..6c03abe 100644
--- a/lib/src/main/cpp/rtk_module/rtk.cpp
+++ b/lib/src/main/cpp/rtk_module/rtk.cpp
@@ -225,7 +225,7 @@
 #if 1
             if (VirtualIsConnected()) {     //PC妯℃嫙鐢ㄦ椂
                 static bool first = false;
-
+                DEBUG("XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX");
                 if (!first) {
                     first = true;
 
diff --git a/lib/src/main/cpp/rtk_platform/platform.cpp b/lib/src/main/cpp/rtk_platform/platform.cpp
index 8ae0701..c5238d9 100644
--- a/lib/src/main/cpp/rtk_platform/platform.cpp
+++ b/lib/src/main/cpp/rtk_platform/platform.cpp
@@ -190,7 +190,7 @@
 
 void InitPlatform(bool ayDevice, const uint8_t *phone, const char *domain_name, int port)
 {
-    DEBUG("InitPlatform");
+    DEBUG("InitPlatform phone %s ip %s port %d", phone, domain_name, port);
 
     mAyDevice = ayDevice;
 
@@ -225,7 +225,14 @@
 
 void ConfigPlatform(const rtk_platform_cfg_t *p)
 {
-    DEBUG("閰嶇疆RTK骞冲彴璧勮");
+    DEBUG("閰嶇疆RTK骞冲彴璧勮 sn %s device_model %s, imei %s, phone %02X%02X%02X%02X%02X%02X%02X%02X", p->device_sn, p->device_model, p->imei, p->phone[0],
+          p->phone[1],
+          p->phone[2],
+          p->phone[3],
+          p->phone[4],
+          p->phone[5],
+          p->phone[6],
+          p->phone[7]);
 
     AppTimer_delete(ReqRtkPlatformConfigTimeout);
 
diff --git a/lib/src/main/cpp/test_common/car_sensor.cpp b/lib/src/main/cpp/test_common/car_sensor.cpp
index 1a1a20b..173a1e5 100644
--- a/lib/src/main/cpp/test_common/car_sensor.cpp
+++ b/lib/src/main/cpp/test_common/car_sensor.cpp
@@ -225,11 +225,13 @@
 
 static void WriteCarStatus(uint16_t id, int value)
 {
+    int old_value;
     pthread_mutex_lock(&status_rw_mutex);
+    old_value = CarStatus[id];
     CarStatus[id] = value;
     pthread_mutex_unlock(&status_rw_mutex);
 
-    if (id != OBD_SPEED && id != ENGINE_RPM) {
+    if (id != OBD_SPEED && id != ENGINE_RPM && old_value != value) {
         uint8_t buffer[6];
 
         buffer[0] = HI_UINT16(id);
@@ -246,13 +248,29 @@
 static void LRLightTimeout(union sigval sig)
 {
     AppTimer_delete(LRLightTimeout);
-
-    WriteCarStatus(TURN_SIGNAL_LAMP, OFF_LIGHT);
+    if (!left_turn_signal && !right_turn_signal) {
+        WriteCarStatus(TURN_SIGNAL_LAMP, OFF_LIGHT);
+    } else if (left_turn_signal && right_turn_signal) {
+        WriteCarStatus(TURN_SIGNAL_LAMP, HAZARD_LIGHTS);
+    } else if (left_turn_signal) {
+        WriteCarStatus(TURN_SIGNAL_LAMP, LEFT_TURN_LIGHT);
+    } else {
+        WriteCarStatus(TURN_SIGNAL_LAMP, RIGHT_TURN_LIGHT);
+    }
 }
 
 static void ChangeLRLight(int light)
 {
-    WriteCarStatus(TURN_SIGNAL_LAMP, light);
+    DEBUG("ChangeLRLight %d %d", left_turn_signal, right_turn_signal);
+    if (!left_turn_signal && !right_turn_signal) {
+        WriteCarStatus(TURN_SIGNAL_LAMP, OFF_LIGHT);
+    } else if (left_turn_signal && right_turn_signal) {
+        WriteCarStatus(TURN_SIGNAL_LAMP, HAZARD_LIGHTS);
+    } else if (left_turn_signal) {
+        WriteCarStatus(TURN_SIGNAL_LAMP, LEFT_TURN_LIGHT);
+    } else {
+        WriteCarStatus(TURN_SIGNAL_LAMP, RIGHT_TURN_LIGHT);
+    }
 
     AppTimer_delete(LRLightTimeout);
     AppTimer_add(LRLightTimeout, 1500);
@@ -281,10 +299,16 @@
                 AppTimer_delete(ConfirmTurnSigalLater);
                 if (right_turn_signal) {
                     // 鍒ゅ畾涓哄弻闂�
-                    ChangeLRLight(HAZARD_LIGHTS);
+                    AppTimer_add(ConfirmTurnSigalLater, 500, HAZARD_LIGHTS);
                 } else {
                     AppTimer_add(ConfirmTurnSigalLater, 200, LEFT_TURN_LIGHT);
                 }
+            } else {
+                AppTimer_delete(ConfirmTurnSigalLater);
+                if (right_turn_signal)
+                    AppTimer_add(ConfirmTurnSigalLater, 1500, RIGHT_TURN_LIGHT);
+                else
+                    AppTimer_add(ConfirmTurnSigalLater, 1500, OFF_LIGHT);
             }
             break;
         }
@@ -295,10 +319,16 @@
                 AppTimer_delete(ConfirmTurnSigalLater);
                 if (left_turn_signal) {
                     // 鍒ゅ畾涓哄弻闂�
-                    ChangeLRLight(HAZARD_LIGHTS);
+                    AppTimer_add(ConfirmTurnSigalLater, 500, HAZARD_LIGHTS);
                 } else {
                     AppTimer_add(ConfirmTurnSigalLater, 200, RIGHT_TURN_LIGHT);
                 }
+            } else {
+                AppTimer_delete(ConfirmTurnSigalLater);
+                if (left_turn_signal)
+                    AppTimer_add(ConfirmTurnSigalLater, 1500, LEFT_TURN_LIGHT);
+                else
+                    AppTimer_add(ConfirmTurnSigalLater, 1500, OFF_LIGHT);
             }
             break;
         }
diff --git a/lib/src/main/cpp/test_items/area_exam.cpp b/lib/src/main/cpp/test_items/area_exam.cpp
index 46c71ca..556d071 100644
--- a/lib/src/main/cpp/test_items/area_exam.cpp
+++ b/lib/src/main/cpp/test_items/area_exam.cpp
@@ -111,6 +111,7 @@
             }
         } else {
             if (ExitMap(car, CurrEnterMapIndex, mapList)) {
+                DEBUG("绂诲紑鏌愪釜瀛愰」鐩� idx = %d", CurrEnterMapIndex);
                 CurrEnterMapIndex = -1;
             }
         }
@@ -189,6 +190,7 @@
             // 鏌愰」缁撴潫
             CurrExamStatus = EXAM_AREA_NONE;
             CurrExamMapIndex = -1;
+            DEBUG("缁撴潫褰撳墠椤圭洰");
         }
     }
 }
diff --git a/lib/src/main/cpp/test_items/turn_a90.cpp b/lib/src/main/cpp/test_items/turn_a90.cpp
index e9f97f8..a2eafb1 100644
--- a/lib/src/main/cpp/test_items/turn_a90.cpp
+++ b/lib/src/main/cpp/test_items/turn_a90.cpp
@@ -138,11 +138,10 @@
 
     }
 
+TEST_END:
     if (!testing) {
         MA_EnterMap(mapIndex, MAP_TYPE_TURN_90, 0);
     }
-
-TEST_END:
     return testing? 1:0;
 }
 

--
Gitblit v1.8.0