huhao hace 1 semana
padre
commit
9862112191
Se han modificado 1 ficheros con 11 adiciones y 4 borrados
  1. 11 4
      entry/src/main/ets/pages/Index.ets

+ 11 - 4
entry/src/main/ets/pages/Index.ets

@@ -71,13 +71,13 @@ struct WorkshopPage {
     {stationName: "仓储充电位1",
       onlineStatus: 0,
       stationType: 2,
-      controlPowerStatus: 1,
+      controlPowerStatus: 0,
       devicePowerStatus: 1
     },
     {stationName: "仓储充电位2",
       onlineStatus: 0,
       stationType: 2,
-      controlPowerStatus: 1,
+      controlPowerStatus: 0,
       devicePowerStatus: 1
     }
   ]
@@ -143,6 +143,12 @@ struct WorkshopPage {
         await this.createClient();
         await this.connect();
         await this.subscribe();
+      }, 20000);
+    } catch (e) {
+      console.log('hhtest', '创建mqtt失败' + e);
+    }
+    try {
+      setTimeout(async ()=>{
         this.issueControlCommand('Charging1Set', 1)
         this.issueControlCommand('Charging2Set', 1)
       }, 30000);
@@ -962,10 +968,10 @@ struct WorkshopPage {
                   }
                 } else if (element.tag! === 'Charging1Set') {
                   device6.onlineStatus = 1
-                  device6.controlPowerStatus = element.value === 1 ? 0 : 1
+                  device6.controlPowerStatus = element.value
                 } else if (element.tag! === 'Charging2Set') {
                   device7.onlineStatus = 1
-                  device7.controlPowerStatus = element.value === 1 ? 0 : 1
+                  device7.controlPowerStatus = element.value
                 }
                 break;
               case DeviceType.RGV1:
@@ -990,6 +996,7 @@ struct WorkshopPage {
           this.stationArray[6] = device7;
           this.robotArray[0] = device8
         }
+        console.log('hhtest', 'this.stationArray======' + JSON.stringify(this.stationArray))
       } else {
         console.info('hhtest', "messageArrived error:" + JSON.stringify(err));
       }