【bug】车库门操作、状态发送等逻辑中的bug

This commit is contained in:
thesai 2024-03-27 14:15:34 +08:00
parent 01b0655eb5
commit 33ed496dcd
2 changed files with 33 additions and 29 deletions

View File

@ -82,6 +82,10 @@ func newRepository(id string, version string) *Repository {
keyMap: make(map[string]*Key),
platformMap: make(map[string]*Platform),
centralizedMap: make(map[string]*proto.CentralizedStationRef),
ckmMap: make(map[string]*Ckm),
ckmPslMap: make(map[string]*CkmPsl),
xcjMap: make(map[string]*Xcj),
PipeMap: make(map[string]*Pipe), //ISCS 管线
PipeFittingMap: make(map[string]*PipeFitting), //ISCS 管件
CircuitBreakerMap: make(map[string]*CircuitBreaker), //ISCS 断路器

View File

@ -27,13 +27,13 @@ func (p *CkmSys) Update(world ecs.World) {
return
}
posCom := component.FixedPositionTransformType.Get(entry)
remote := true //是否远程模式
local := true //是否本地模式
circuit := component.CkmCircuitType.Get(entry) //目前不考虑没有车库门电路的情况
//车库门PSL
if entry.HasComponent(component.CkmPslType) {
ckmPsl := component.CkmPslType.Get(entry)
component.RelayDriveType.Get(circuit.MPLJ).Td = component.BitStateType.Get(ckmPsl.MPLA).Val
remote = component.BitStateType.Get(ckmPsl.MMSA).Val
local = component.BitStateType.Get(ckmPsl.MMSA).Val
}
//门开/关继电器及状态
if posCom.Pos == consts.TwoPosMin {
@ -46,7 +46,11 @@ func (p *CkmSys) Update(world ecs.World) {
//门故障继电器及状态
component.RelayDriveType.Get(circuit.MGZJ).Td = entry.HasComponent(component.CkmStateLossTag)
//开/关门继电器驱动状态
if remote {
if local {
ckmPsl := component.CkmPslType.Get(entry)
component.RelayDriveType.Get(circuit.KMJ).Td = component.BitStateType.Get(ckmPsl.KMA).Val
component.RelayDriveType.Get(circuit.GMJ).Td = component.BitStateType.Get(ckmPsl.GMA).Val
} else {
kmBit, err := worldData.QueryQdBit(component.UidType.Get(circuit.KMJ).Id)
if err == nil {
component.RelayDriveType.Get(circuit.KMJ).Td = kmBit
@ -59,10 +63,6 @@ func (p *CkmSys) Update(world ecs.World) {
} else {
slog.Error(err.Error())
}
} else {
ckmPsl := component.CkmPslType.Get(entry)
component.RelayDriveType.Get(circuit.KMJ).Td = component.BitStateType.Get(ckmPsl.KMA).Val
component.RelayDriveType.Get(circuit.GMJ).Td = component.BitStateType.Get(ckmPsl.GMA).Val
}
//驱动
if component.BitStateType.Get(circuit.GMJ).Val {