Browse Source

mod:新增 run_mcu_single_finish

panqiuyao 8 months ago
parent
commit
970ddc2b01

+ 6 - 1
electron/controller/socket.js

@@ -43,7 +43,12 @@ class SocketController extends Controller {
           console.log(this_data);
           if(this_data.msg_type){
             let channel = 'controller.socket.message_'+this_data.msg_type;
-            win.webContents.send(channel, this_data);
+            if(this_data.msg_type === 'run_mcu_single_finish' ){
+              this.app.electron['seeting'].webContents.send(channel, this_data);
+            }else{
+
+              win.webContents.send(channel, this_data);
+            }
           }
         }catch (e){
           console.log(e)

+ 18 - 2
frontend/src/views/Home/index.vue

@@ -45,6 +45,7 @@
 
 
     <el-button type="info"  @click="connect_mcu">链接MCU</el-button>
+    <el-button type="info"  @click="connect_mcu__init">MCU初始化</el-button>
     <el-button type="info"  @click="connect_bluetooth">连接蓝牙</el-button>
     <el-button @click="socketDisconnect">socket 断开</el-button>
     <router-link
@@ -242,14 +243,29 @@ async function connect_mcu(){
   if(clientStore.isClient){
 
     await socketStore.connectSocket();
-     socketStore.sendMessage({
+    socketStore.sendMessage({
       type: 'connect_mcu',
-       data:"connect_mcu"
+      data:"connect_mcu"
     })
   }
 
 }
 
+async function connect_mcu__init(){
+
+  if(clientStore.isClient){
+
+    await socketStore.connectSocket();
+    socketStore.sendMessage({
+      type: 'init_mcu',
+      data:"init_mcu"
+    })
+  }
+
+}
+
+
+
 async function connect_bluetooth(){
 
   await socketStore.connectSocket();

+ 6 - 5
frontend/src/views/Setting/index.vue

@@ -819,6 +819,7 @@ const imageUrl = ref(digiCamControlWEB+'preview.jpg')
 const imageUrlkey = ref(0)
 function testShoesFlip(){
   if (clientStore.isClient) {
+
     socketStore.sendMessage({
       type: 'run_mcu_single',
       data: {
@@ -840,7 +841,9 @@ function testShoesFlip(){
     });
       captureLoading.value = true;
 
-    clientStore.ipc.on(icpList.socket.message+'_run_mcu_single_finish', (event, result) =>{
+
+    clientStore.ipc.on(icpList.socket.message+'_run_mcu_single_finish', async (event, result) => {
+
       clientStore.ipc.removeAllListeners(icpList.camera.takePictures);
       clientStore.ipc.send(icpList.camera.takePictures,false);
       clientStore.ipc.on(icpList.camera.takePictures, async (event, result) => {
@@ -852,15 +855,13 @@ function testShoesFlip(){
         clientStore.ipc.removeAllListeners(icpList.camera.takePictures);
       })
 
-      clientStore.ipc.removeAllListeners(icpList.socket.message+'_run_mcu_single_finish');
 
     })
-
-
-
   }
 }
 
+
+
 </script>
 
 <style lang="scss">