Browse Source

移除手柄图标,优化方向盘接入,优化油门计算

caner 2 years ago
parent
commit
b06ac95050
3 changed files with 5 additions and 12 deletions
  1. 2 2
      electron/logiControl.js
  2. 1 1
      electron/main.js
  3. 2 9
      src/App.vue

+ 2 - 2
electron/logiControl.js

@@ -6,10 +6,10 @@ try {
     data = new HID.HID(logitech[0].vendorId, logitech[0].productId);
     data = new HID.HID(logitech[0].vendorId, logitech[0].productId);
     data.on('data', (db) => {
     data.on('data', (db) => {
         if (process.connected){ process.send(db)}else{
         if (process.connected){ process.send(db)}else{
-            throw {type:'err',data:'process.connected=false'}
+            throw {type:'err',text:'process.connected=false'}
         }
         }
     })
     })
 } catch (error) {
 } catch (error) {
     if (data) data.close()
     if (data) data.close()
-    process.send({ type: 'err', data: error + '' })
+    process.send({ type: 'err', text: error + '' })
 }
 }

+ 1 - 1
electron/main.js

@@ -132,7 +132,7 @@ class MainSerivce {
   connectLogi() {
   connectLogi() {
     this.contrlEvent = fork(join(__dirname, './logiControl.js'));
     this.contrlEvent = fork(join(__dirname, './logiControl.js'));
     this.contrlEvent.on('message', msg => {
     this.contrlEvent.on('message', msg => {
-      if (!msg || msg.type === 'err') {
+      if (!msg || msg.type === 'err' || !msg.data || !msg.data[44]) {
         this.contrlEvent.disconnect()
         this.contrlEvent.disconnect()
         this.contrlEvent.kill(msg.pid ?? 'SIGKILL')
         this.contrlEvent.kill(msg.pid ?? 'SIGKILL')
         this.contrlEvent = null
         this.contrlEvent = null

+ 2 - 9
src/App.vue

@@ -27,7 +27,6 @@ const isLogin = ref(false)
 const remoteVideo = ref()
 const remoteVideo = ref()
 const showLoading = ref(true)
 const showLoading = ref(true)
 const winMaxOrMin = ref(false)
 const winMaxOrMin = ref(false)
-const contrlState = ref(false)
 const micState = ref(false)
 const micState = ref(false)
 const audioState = ref(false)
 const audioState = ref(false)
 const audioStateNum = ref(0)
 const audioStateNum = ref(0)
@@ -55,10 +54,10 @@ function countContrlData(v: number) {
   const num = parseInt(v.toString(), 10)
   const num = parseInt(v.toString(), 10)
   if (conctrlNum.value % 2) {
   if (conctrlNum.value % 2) {
     // 倒档
     // 倒档
-    return num <= 128 ? 0 : Math.abs((255 - num) - 128)
+    return Math.floor(num / 2)
   }
   }
   // 前进
   // 前进
-  return num <= 128 ? 255 : ((255 - num) + 128)
+  return Math.floor(((128 - (num / 2)) + 128))
 }
 }
 
 
 // 关闭
 // 关闭
@@ -229,12 +228,6 @@ window.$electron.send('close-loading')
     />
     />
     <div class="marke">
     <div class="marke">
       <div class="marke-left">
       <div class="marke-left">
-        <!-- 手柄状态 -->
-        <Icon
-          name="gemePad"
-          :size="30"
-          :color="contrlState ? '#00CED1' : 'rgba(0, 0, 0, 0.3)'"
-        />
         <!-- 音频状态 -->
         <!-- 音频状态 -->
         <Record
         <Record
           class="marke-audio"
           class="marke-audio"