From 32a8921f9be37aa583893e1bd5594ade5355c421 Mon Sep 17 00:00:00 2001 From: weizhihong Date: Mon, 6 Nov 2023 13:41:57 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E3=80=90=E7=BB=A7=E7=94=B5=E5=99=A8?= =?UTF-8?q?=E6=93=8D=E4=BD=9C=E8=BF=94=E5=9B=9E=E5=A4=84=E7=90=86=E7=BB=93?= =?UTF-8?q?=E6=9E=9C=E4=BF=A1=E6=81=AF=E3=80=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- fi/relay.go | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/fi/relay.go b/fi/relay.go index 34204c9..90f199a 100644 --- a/fi/relay.go +++ b/fi/relay.go @@ -30,8 +30,8 @@ func driveWjRelay(w ecs.World, entry *ecs.Entry, td bool) { } // 驱动继电器到吸起位置 -func DriveRelayUp(w ecs.World, id string) { - w.Execute(func() { +func DriveRelayUp(w ecs.World, id string) error { + result := <-ecs.Request[ecs.EmptyType](w, func() ecs.Result[ecs.EmptyType] { wd := entity.GetWorldData(w) entry, ok := wd.EntityMap[id] if ok { @@ -41,14 +41,16 @@ func DriveRelayUp(w ecs.World, id string) { driveWjRelay(w, entry, true) } } else { - fmt.Printf("未找到id=%s的继电器\n", id) + return ecs.NewErrResult(fmt.Errorf("未找到id=%s的继电器", id)) } + return ecs.NewOkEmptyResult() }) + return result.Err } // 驱动继电器到落下位置 -func DriveRelayDown(w ecs.World, id string) { - w.Execute(func() { +func DriveRelayDown(w ecs.World, id string) error { + result := <-ecs.Request[ecs.EmptyType](w, func() ecs.Result[ecs.EmptyType] { wd := entity.GetWorldData(w) entry, ok := wd.EntityMap[id] if ok { @@ -58,7 +60,9 @@ func DriveRelayDown(w ecs.World, id string) { driveWjRelay(w, entry, false) } } else { - fmt.Printf("未找到id=%s的继电器\n", id) + return ecs.NewErrResult(fmt.Errorf("未找到id=%s的继电器", id)) } + return ecs.NewOkEmptyResult() }) + return result.Err } From 010c822b13d19dc70ab2c0be0e3cd535cf0926ee Mon Sep 17 00:00:00 2001 From: joylink_zhangsai <1021828630@qq.com> Date: Mon, 6 Nov 2023 13:53:59 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=B1=8F=E8=94=BD?= =?UTF-8?q?=E9=97=A8=E6=95=85=E9=9A=9C=E6=93=8D=E4=BD=9Cbug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sys/circuit_sys/psd.go | 6 +++--- sys/device_sys/asd.go | 2 ++ 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/sys/circuit_sys/psd.go b/sys/circuit_sys/psd.go index b48385d..d212439 100644 --- a/sys/circuit_sys/psd.go +++ b/sys/circuit_sys/psd.go @@ -80,11 +80,11 @@ func (p *PsdSys) Update(world ecs.World) { //设置滑动门电机通断电状态 repo := entity.GetWorldData(world).Repo psd := repo.FindPsd(component.UidType.Get(entry).Id) - if psc.MkxGM { //优先门控箱的关门 - p.gm(asdList) - } else if psc.MkxKM { //其次门控箱的开门 + if psc.MkxKM { //优先门控箱的开门 group := psd.FindAsdGroup(8) p.km(group.Start, group.End, asdList) + } else if psc.MkxKM { //其次门控箱的关门 + p.gm(asdList) } else if !psc.InterlockMPL { //联锁操作没有被旁路 if psc.InterlockGM { p.gm(asdList) diff --git a/sys/device_sys/asd.go b/sys/device_sys/asd.go index 6e453b1..99e37d3 100644 --- a/sys/device_sys/asd.go +++ b/sys/device_sys/asd.go @@ -28,9 +28,11 @@ func (s *AsdSys) Update(world ecs.World) { if entry.HasComponent(component.AsdCannotOpenTag) { pos = consts.TwoPosMin speed = 0 + psdMotorState.TD = false } else if entry.HasComponent(component.AsdCannotCloseTag) { pos = consts.TwoPosMax speed = 0 + psdMotorState.TD = false } else if psdMotorState.TD { if psdMotorState.KM { if pos == consts.TwoPosMax {