From 7ec4eb44e42ff61ba906f914ffc882b210391883 Mon Sep 17 00:00:00 2001 From: thesai <1021828630@qq.com> Date: Mon, 19 Feb 2024 13:39:24 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=B1=8F=E8=94=BD=E9=97=A8?= =?UTF-8?q?=E9=97=A8=E6=8E=A7=E7=AE=B1ecs=E9=80=BB=E8=BE=91=E5=BC=95?= =?UTF-8?q?=E8=B5=B7=E7=9A=84bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sys/circuit_sys/psd.go | 59 ++++++++++++++++++++++++++++++------------ 1 file changed, 42 insertions(+), 17 deletions(-) diff --git a/sys/circuit_sys/psd.go b/sys/circuit_sys/psd.go index df54209..4236d8f 100644 --- a/sys/circuit_sys/psd.go +++ b/sys/circuit_sys/psd.go @@ -94,31 +94,56 @@ func (p *PsdSys) Update(world ecs.World) { // 门控箱按钮驱动继电器 func mkxBtnDriveRelay(mkx *component.Mkx, pmc *component.PlatformMkxCircuit, psdCircuit *component.PsdCircuit) { //PCB - pcbpl := component.BitStateType.Get(mkx.PCBPL).Val - pcb := component.BitStateType.Get(mkx.PCB).Val - component.RelayDriveType.Get(pmc.PCBJ).Td = !pcbpl && pcb + if mkx.PCB != nil { + pcb := component.BitStateType.Get(mkx.PCB).Val + pcbpl := false + if mkx.PCBPL != nil { + pcbpl = component.BitStateType.Get(mkx.PCBPL).Val + } + component.RelayDriveType.Get(pmc.PCBJ).Td = !pcbpl && pcb + } //POB - pobpl := component.BitStateType.Get(mkx.POBPL).Val - pob := component.BitStateType.Get(mkx.POB).Val - component.RelayDriveType.Get(pmc.POBJ).Td = !pobpl && pob + if mkx.POB != nil { + pob := component.BitStateType.Get(mkx.POB).Val + pobpl := false + if mkx.POBPL != nil { + pobpl = component.BitStateType.Get(mkx.POBPL).Val + } + component.RelayDriveType.Get(pmc.POBJ).Td = !pobpl && pob + } //PAB - pabpl := component.BitStateType.Get(mkx.PABPL).Val - pab := component.BitStateType.Get(mkx.PAB).Val - component.RelayDriveType.Get(pmc.PABJ).Td = !pabpl && pab + if mkx.PAB != nil { + pab := component.BitStateType.Get(mkx.PAB).Val + pabpl := false + if mkx.PABPL != nil { + pabpl = component.BitStateType.Get(mkx.PABPL).Val + } + component.RelayDriveType.Get(pmc.PABJ).Td = !pabpl && pab + } //WRZF - wrzfpl := component.BitStateType.Get(mkx.WRZFPL).Val - wrzf := component.BitStateType.Get(mkx.WRZF).Val - component.RelayDriveType.Get(pmc.WRZFJ).Td = !wrzfpl && wrzf + if mkx.WRZF != nil { + wrzf := component.BitStateType.Get(mkx.WRZF).Val + wrzfpl := false + if mkx.WRZFPL != nil { + wrzfpl = component.BitStateType.Get(mkx.WRZFPL).Val + } + component.RelayDriveType.Get(pmc.WRZFJ).Td = !wrzfpl && wrzf + } //QKQR - qkqrpl := component.BitStateType.Get(mkx.QKQRPL).Val - qkqr := component.BitStateType.Get(mkx.QKQR).Val - component.RelayDriveType.Get(pmc.QKQRJ).Td = !qkqrpl && qkqr + if mkx.QKQR != nil { + qkqr := component.BitStateType.Get(mkx.QKQR).Val + qkqrpl := false + if mkx.QKQRPL != nil { + qkqrpl = component.BitStateType.Get(mkx.QKQRPL).Val + } + component.RelayDriveType.Get(pmc.QKQRJ).Td = !qkqrpl && qkqr + } //MPL - if psdCircuit != nil { + if psdCircuit != nil && mkx.MPL != nil { component.RelayDriveType.Get(psdCircuit.MPLJ).Td = component.BitStateType.Get(mkx.MPL).Val } //JXTCPL - if psdCircuit != nil { + if psdCircuit != nil && mkx.JXTCPL != nil { component.RelayDriveType.Get(psdCircuit.JXTCPLJ).Td = component.BitStateType.Get(mkx.JXTCPL).Val } }