瀏覽代碼

//修改机械臂超时调试

chenjiabao 3 月之前
父節點
當前提交
710064d050
共有 1 個文件被更改,包括 32 次插入1 次删除
  1. 32 1
      entry/src/main/ets/pages/MechanicalArmDebugging.ets

+ 32 - 1
entry/src/main/ets/pages/MechanicalArmDebugging.ets

@@ -950,15 +950,18 @@ export struct MechanicalArmDebugging {
                       if(!this.isArmButtonEnabled) return
                       this.showConfirm('是否执行机械臂开始任务?', async() => {
                         this.etherCATg1_in0 = false;
+                        let isTimeOut = false;
                         this.loadingMessage = "机械臂开始任务执行中"
                         this.loadingController.open()
                         let timeoutId = setTimeout(() => {
+                          isTimeOut = true;
                           this.loadingController.close()
                           this.reminds = '机械臂开始任务执行超时';
                           this.remindController.open()
                           delayExecution(() => {
                             this.remindController.close()
-                          }, 2000)
+                          }, 3000);
+                          clearInterval(checkInterval);
                         }, 30000)
                         let res: object = await MechanicalArmDebuggingRequest.post('/api/v1/device/setup', {
                           deviceNo: "EC2A-IM24R00",
@@ -968,6 +971,7 @@ export struct MechanicalArmDebugging {
                         } as EtherCATInfo)
                         let checkInterval = setInterval(() => {
                           if(this.etherCATg1_in0) {
+                            if(isTimeOut) return
                             clearTimeout(timeoutId)
                             clearInterval(checkInterval)
                             this.loadingController.close()
@@ -999,10 +1003,12 @@ export struct MechanicalArmDebugging {
                       if(!this.isButtonEnabled) return
                       if(!this.isArmButtonEnabled) return
                       this.showConfirm('是否执行机械臂提起1?', async () => {
+                        let isTimeOut = false;
                         this.loadingMessage = "机械臂提起1执行中"
                         this.etherCATg1_in1 = false;
                         this.loadingController.open()
                         let timeoutId = setTimeout(() => {
+                          isTimeOut = true;
                           this.loadingController.close()
                           this.reminds = '机械臂提起1执行超时';
                           this.remindController.open()
@@ -1018,6 +1024,7 @@ export struct MechanicalArmDebugging {
                         } as EtherCATInfo)
                         let checkInterval = setInterval(() => {
                           if(this.etherCATg1_in1) {
+                            if(isTimeOut) return
                             clearTimeout(timeoutId)
                             clearInterval(checkInterval)
                             this.loadingController.close()
@@ -1049,10 +1056,12 @@ export struct MechanicalArmDebugging {
                       if(!this.isButtonEnabled) return
                       if(!this.isArmButtonEnabled) return
                       this.showConfirm('是否执行机械臂转移?', async () => {
+                        let isTimeOut = false;
                         this.loadingMessage = "机械臂转移执行中"
                         this.etherCATg1_in2 = false;
                         this.loadingController.open()
                         let timeoutId = setTimeout(() => {
+                          isTimeOut = true;
                           this.loadingController.close()
                           this.reminds = '机械臂转移执行超时';
                           this.remindController.open()
@@ -1068,6 +1077,7 @@ export struct MechanicalArmDebugging {
                         } as EtherCATInfo)
                         let checkInterval = setInterval(() => {
                           if(this.etherCATg1_in2) {
+                            if(isTimeOut) return
                             clearTimeout(timeoutId)
                             clearInterval(checkInterval)
                             this.loadingController.close()
@@ -1114,10 +1124,12 @@ export struct MechanicalArmDebugging {
                       if(!this.isButtonEnabled) return
                       if(!this.isArmButtonEnabled) return
                       this.showConfirm('是否执行机械臂提起2?', async () => {
+                        let isTimeOut = false;
                         this.loadingMessage = "机械臂提起2执行中"
                         this.etherCATg1_in3 = false;
                         this.loadingController.open()
                         let timeoutId = setTimeout(() => {
+                          isTimeOut = true;
                           this.loadingController.close()
                           this.reminds = '机械臂提起2执行超时';
                           this.remindController.open()
@@ -1133,6 +1145,7 @@ export struct MechanicalArmDebugging {
                         } as EtherCATInfo)
                         let checkInterval = setInterval(() => {
                           if(this.etherCATg1_in3) {
+                            if(isTimeOut) return
                             clearTimeout(timeoutId)
                             clearInterval(checkInterval)
                             this.loadingController.close()
@@ -1164,10 +1177,12 @@ export struct MechanicalArmDebugging {
                       if(!this.isButtonEnabled) return
                       if(!this.isArmButtonEnabled) return
                       this.showConfirm('是否执行机械臂回原点?', async () => {
+                        let isTimeOut = false;
                         this.loadingMessage = "机械臂回原点执行中"
                         this.etherCATg1_in4 = false;
                         this.loadingController.open()
                         let timeoutId = setTimeout(() => {
+                          isTimeOut = true;
                           this.loadingController.close()
                           this.reminds = '机械臂回原点执行超时';
                           this.remindController.open()
@@ -1183,6 +1198,7 @@ export struct MechanicalArmDebugging {
                         } as EtherCATInfo)
                         let checkInterval = setInterval(() => {
                           if(this.etherCATg1_in4) {
+                            if(isTimeOut) return
                             clearTimeout(timeoutId)
                             clearInterval(checkInterval)
                             this.loadingController.close()
@@ -2112,10 +2128,12 @@ export struct MechanicalArmDebugging {
                       if(!this.isButtonEnabled) return
                       if(!this.isArmButtonEnabled) return
                       this.showConfirm('是否执行机械臂开始任务?', async () => {
+                        let isTimeOut = false;
                         this.loadingMessage = "机械臂开始任务执行中"
                         this.etherCATg1_in0 = false;
                         this.loadingController.open()
                         let timeoutId = setTimeout(() => {
+                          isTimeOut = true;
                           this.loadingController.close()
                           this.reminds = '机械臂开始任务执行超时';
                           this.remindController.open()
@@ -2131,6 +2149,7 @@ export struct MechanicalArmDebugging {
                         } as EtherCATInfo)
                         let checkInterval = setInterval(() => {
                           if(this.etherCATg1_in0) {
+                            if(isTimeOut) return;
                             clearTimeout(timeoutId)
                             clearInterval(checkInterval)
                             this.loadingController.close()
@@ -2162,10 +2181,12 @@ export struct MechanicalArmDebugging {
                       if(!this.isButtonEnabled) return
                       if(!this.isArmButtonEnabled) return
                       this.showConfirm('是否执行机械臂提起1?', async () => {
+                        let isTimeOut = false;
                         this.loadingMessage = "机械臂提起1执行中"
                         this.etherCATg1_in1 = false;
                         this.loadingController.open()
                         let timeoutId = setTimeout(() => {
+                          isTimeOut = true;
                           this.loadingController.close()
                           this.reminds = '机械臂提起1执行超时';
                           this.remindController.open()
@@ -2181,6 +2202,7 @@ export struct MechanicalArmDebugging {
                         } as EtherCATInfo)
                         let checkInterval = setInterval(() => {
                           if(this.etherCATg1_in1) {
+                            if(isTimeOut) return;
                             clearTimeout(timeoutId)
                             clearInterval(checkInterval)
                             this.loadingController.close()
@@ -2212,10 +2234,12 @@ export struct MechanicalArmDebugging {
                       if(!this.isButtonEnabled) return
                       if(!this.isArmButtonEnabled) return
                       this.showConfirm('是否执行机械臂转移?', async () => {
+                        let isTimeOut = false;
                         this.loadingMessage = "机械臂转移执行中"
                         this.etherCATg1_in2 = false;
                         this.loadingController.open()
                         let timeoutId = setTimeout(() => {
+                          isTimeOut = true;
                           this.loadingController.close()
                           this.reminds = '机械臂转移执行超时';
                           this.remindController.open()
@@ -2231,6 +2255,7 @@ export struct MechanicalArmDebugging {
                         } as EtherCATInfo)
                         let checkInterval = setInterval(() => {
                           if(this.etherCATg1_in2) {
+                            if(isTimeOut) return;
                             clearTimeout(timeoutId)
                             clearInterval(checkInterval)
                             this.loadingController.close()
@@ -2277,10 +2302,12 @@ export struct MechanicalArmDebugging {
                       if(!this.isButtonEnabled) return
                       if(!this.isArmButtonEnabled) return
                       this.showConfirm('是否执行机械臂提起2?', async () => {
+                        let isTimeOut = false;
                         this.loadingMessage = "机械臂提起2执行中"
                         this.etherCATg1_in3 = false;
                         this.loadingController.open()
                         let timeoutId = setTimeout(() => {
+                          isTimeOut = true;
                           this.loadingController.close()
                           this.reminds = '机械臂提起2执行超时';
                           this.remindController.open()
@@ -2296,6 +2323,7 @@ export struct MechanicalArmDebugging {
                         } as EtherCATInfo)
                         let checkInterval = setInterval(() => {
                           if(this.etherCATg1_in3) {
+                            if(isTimeOut) return;
                             clearTimeout(timeoutId)
                             clearInterval(checkInterval)
                             this.loadingController.close()
@@ -2327,10 +2355,12 @@ export struct MechanicalArmDebugging {
                       if(!this.isButtonEnabled) return
                       if(!this.isArmButtonEnabled) return
                       this.showConfirm('是否执行机械臂回原点?', async () => {
+                        let isTimeOut = false;
                         this.loadingMessage = "机械臂回原点执行中"
                         this.etherCATg1_in4 = false;
                         this.loadingController.open()
                         let timeoutId = setTimeout(() => {
+                          isTimeOut = true;
                           this.loadingController.close()
                           this.reminds = '机械臂回原点执行超时';
                           this.remindController.open()
@@ -2346,6 +2376,7 @@ export struct MechanicalArmDebugging {
                         } as EtherCATInfo)
                         let checkInterval = setInterval(() => {
                           if(this.etherCATg1_in4) {
+                            if(isTimeOut) return;
                             clearTimeout(timeoutId)
                             clearInterval(checkInterval)
                             this.loadingController.close()