Bladeren bron

回滚钥匙左右判断;修复钥匙卡扣指令左右判断

Frankensteinly 10 maanden geleden
bovenliggende
commit
ba8361ddaa

+ 4 - 4
app/src/main/java/com/grkj/iscs/modbus/DockBean.kt

@@ -32,10 +32,10 @@ class DockBean(
             when (it) {
                 DOCK_TYPE_KEY -> {
                     // TODO 未验证
-                    val rightHasKey = (byteArray[4].toInt() shr 0) and 0x1 == 1
-                    val isRightCharging = (byteArray[4].toInt() shr 1) and 0x1 == 1
-                    val leftHasKey = (byteArray[3].toInt() shr 0) and 0x1 == 1
-                    val isLeftCharging = (byteArray[3].toInt() shr 1) and 0x1 == 1
+                    val leftHasKey = (byteArray[4].toInt() shr 0) and 0x1 == 1
+                    val isLeftCharging = (byteArray[4].toInt() shr 1) and 0x1 == 1
+                    val rightHasKey = (byteArray[3].toInt() shr 0) and 0x1 == 1
+                    val isRightCharging = (byteArray[3].toInt() shr 1) and 0x1 == 1
                     LogUtil.i("钥匙刷新状态 : $leftHasKey - $isLeftCharging - $rightHasKey - $isRightCharging")
                     if (getKeyList().isEmpty()) {
                         deviceList.add(KeyBean(0, leftHasKey, true, isLeftCharging, null, null))

+ 1 - 1
app/src/main/java/com/grkj/iscs/modbus/ModBusManager.kt

@@ -333,7 +333,7 @@ class ModBusManager(
     fun generateKeyBuckleCmd(isOpen: Boolean, index: Int): MBFrame {
         return MBFrame(
             FRAME_TYPE_WRITE,
-            byteArrayOf(0x00, 0x11, if (index == 0) 0b00010000.toByte() else 0b0000001, if (isOpen) 0x00 else 0xFF.toByte())
+            byteArrayOf(0x00, 0x11, if (index == 1) 0b00010000.toByte() else 0b00000001, if (isOpen) 0x00 else 0xFF.toByte())
         )
     }