From 763e39bd71d83a6501ebdebf0d53130797bd5d73 Mon Sep 17 00:00:00 2001
From: sean.zhou <sean.zhou@dji.com>
Date: Thu, 18 May 2023 16:26:09 +0800
Subject: [PATCH] Merge branch 'v1.5.0' What's new? 1. Add new model: DJI Matrices 350 RTK. 2. Fixed some issues.

---
 src/components/g-map/use-drone-control-mqtt-event.ts |   17 ++++++++++++++++-
 1 files changed, 16 insertions(+), 1 deletions(-)

diff --git a/src/components/g-map/use-drone-control-mqtt-event.ts b/src/components/g-map/use-drone-control-mqtt-event.ts
index 4a3d299..63ade36 100644
--- a/src/components/g-map/use-drone-control-mqtt-event.ts
+++ b/src/components/g-map/use-drone-control-mqtt-event.ts
@@ -5,6 +5,7 @@
   DRCHsiInfo,
   DRCOsdInfo,
   DRCDelayTimeInfo,
+  DrcResponseInfo,
 } from '/@/types/drc'
 
 export function useDroneControlMqttEvent (sn: string) {
@@ -12,6 +13,7 @@
   const hsiInfo = ref('')
   const osdInfo = ref('')
   const delayInfo = ref('')
+  const errorInfo = ref('')
 
   function handleHsiInfo (data: DRCHsiInfo) {
     hsiInfo.value = `method: ${DRC_METHOD.HSI_INFO_PUSH}\r\n ${JSON.stringify(data)}\r\n `
@@ -23,6 +25,13 @@
 
   function handleDelayTimeInfo (data: DRCDelayTimeInfo) {
     delayInfo.value = `method: ${DRC_METHOD.DELAY_TIME_INFO_PUSH}\r\n ${JSON.stringify(data)}\r\n `
+  }
+
+  function handleDroneControlErrorInfo (data: DrcResponseInfo) {
+    if (!data.result) {
+      return
+    }
+    errorInfo.value = `Drc error code: ${data.result}, seq: ${data.output?.seq}`
   }
 
   function handleDroneControlMqttEvent (payload: any) {
@@ -43,6 +52,11 @@
         handleDelayTimeInfo(payload.data)
         break
       }
+      case DRC_METHOD.DRONE_EMERGENCY_STOP:
+      case DRC_METHOD.DRONE_CONTROL: {
+        handleDroneControlErrorInfo(payload.data)
+        break
+      }
     }
     drcInfo.value = hsiInfo.value + osdInfo.value + delayInfo.value
   }
@@ -56,6 +70,7 @@
   })
 
   return {
-    drcInfo: drcInfo
+    drcInfo: drcInfo,
+    errorInfo: errorInfo
   }
 }

--
Gitblit v1.9.3