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/DroneControlPanel.vue |   32 +++++++++++++++++++++++---------
 1 files changed, 23 insertions(+), 9 deletions(-)

diff --git a/src/components/g-map/DroneControlPanel.vue b/src/components/g-map/DroneControlPanel.vue
index af2311f..ea8956a 100644
--- a/src/components/g-map/DroneControlPanel.vue
+++ b/src/components/g-map/DroneControlPanel.vue
@@ -118,7 +118,7 @@
               <span>Take off</span>
             </Button>
           </DroneControlPopover>
-          <Button :loading="cmdItem.loading" size="small" ghost @click="sendControlCmd(cmdItem, index)">
+          <Button :loading="cmdItem.loading" size="small" ghost @click="sendControlCmd(cmdItem, 0)">
           {{ cmdItem.operateText }}
           </Button>
         </div>
@@ -269,7 +269,7 @@
   return store.state.clientId
 })
 
-const initCmdList = baseCmdList.find(item => item.cmdKey === DeviceCmd.ReturnHome)
+const initCmdList = baseCmdList.find(item => item.cmdKey === DeviceCmd.ReturnHome) as DeviceCmdItem
 const cmdItem = ref(initCmdList)
 
 const {
@@ -284,7 +284,10 @@
     action: cmdItem.action
   }, false)
   if (result && flightController.value) {
+    message.success('Return home successful')
     exitFlightCOntrol()
+  } else {
+    message.error('Failed to return home')
   }
   cmdItem.loading = false
 }
@@ -346,7 +349,7 @@
   maxSpeed: MAX_SPEED,
   rthAltitude: null as null | number,
   rcLostAction: LostControlActionInCommandFLight.RETURN_HOME,
-  exitWaylineWhenRcLost: WaylineLostControlActionInCommandFlight.RETURN_HOME
+  exitWaylineWhenRcLost: WaylineLostControlActionInCommandFlight.EXEC_LOST_ACTION
 })
 
 function onShowTakeoffToPointPopover () {
@@ -357,7 +360,7 @@
   takeoffToPointPopoverData.securityTakeoffHeight = null
   takeoffToPointPopoverData.rthAltitude = null
   takeoffToPointPopoverData.rcLostAction = LostControlActionInCommandFLight.RETURN_HOME
-  takeoffToPointPopoverData.exitWaylineWhenRcLost = WaylineLostControlActionInCommandFlight.RETURN_HOME
+  takeoffToPointPopoverData.exitWaylineWhenRcLost = WaylineLostControlActionInCommandFlight.EXEC_LOST_ACTION
 }
 
 async function onTakeoffToPointConfirm (confirm: boolean) {
@@ -396,10 +399,10 @@
 useMqtt(deviceTopicInfo)
 
 // 飞行控制
-const drcState = computed(() => {
-  return store.state.deviceState?.dockInfo[props.sn]?.link_osd?.drc_state === DrcStateEnum.CONNECTED
-})
-const flightController = ref(drcState.value)
+// const drcState = computed(() => {
+//   return store.state.deviceState?.dockInfo[props.sn]?.link_osd?.drc_state === DrcStateEnum.CONNECTED
+// })
+const flightController = ref(false)
 
 async function onClickFightControl () {
   if (flightController.value) {
@@ -452,7 +455,7 @@
 }
 
 // drc mqtt message
-const { drcInfo } = useDroneControlMqttEvent(props.sn)
+const { drcInfo, errorInfo } = useDroneControlMqttEvent(props.sn)
 
 const {
   handleKeyup,
@@ -688,6 +691,17 @@
   }
   cameraAimPopoverData.visible = false
 }
+
+watch(() => errorInfo, (errorInfo) => {
+  if (errorInfo.value) {
+    message.error(errorInfo.value)
+    console.error(errorInfo.value)
+    errorInfo.value = ''
+  }
+}, {
+  immediate: true,
+  deep: true
+})
 </script>
 
 <style lang='scss' scoped>

--
Gitblit v1.9.3