[bug]信号机电路系统逻辑没有正确处理驱动状态
All checks were successful
local-test分支打包构建docker并发布运行 / Docker-Build (push) Successful in 5m29s
All checks were successful
local-test分支打包构建docker并发布运行 / Docker-Build (push) Successful in 5m29s
This commit is contained in:
parent
5433ae43d6
commit
fc6b51cc24
15
third_party/interlock/beijing12/interlock.go
vendored
15
third_party/interlock/beijing12/interlock.go
vendored
@ -2,6 +2,7 @@
|
|||||||
package beijing12
|
package beijing12
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"bytes"
|
||||||
"context"
|
"context"
|
||||||
"fmt"
|
"fmt"
|
||||||
"joylink.club/bj-rtsts-server/sys_error"
|
"joylink.club/bj-rtsts-server/sys_error"
|
||||||
@ -169,16 +170,22 @@ func (i *interlockProxy) initInterlockProxy() {
|
|||||||
|
|
||||||
func (i *interlockProxy) handleFromCiData(n int, data []byte) {
|
func (i *interlockProxy) handleFromCiData(n int, data []byte) {
|
||||||
data = data[:n]
|
data = data[:n]
|
||||||
logger().Info(fmt.Sprintf("收到联锁驱动及应答器报文数据:%x", data))
|
logger().Info(fmt.Sprintf("收到联锁驱动及应答器报文数据,长度%d", n))
|
||||||
if n+len(i.fromCIBytes) == fromCIBytesLen { //暂时以此作为报文尾判定条件
|
if len(i.fromCIBytes) != 0 { //报文头已经存进去了
|
||||||
i.fromCIBytes = append(i.fromCIBytes, data...)
|
i.fromCIBytes = append(i.fromCIBytes, data...)
|
||||||
} else { //非报文尾
|
if len(i.fromCIBytes) < fromCIBytesLen { //当存储的报文长度不足预期长度
|
||||||
|
return
|
||||||
|
}
|
||||||
|
} else if bytes.HasPrefix(data, []byte{0xff, 0xff}) { //判断是否是报文头
|
||||||
i.fromCIBytes = append(i.fromCIBytes, data...)
|
i.fromCIBytes = append(i.fromCIBytes, data...)
|
||||||
return
|
return
|
||||||
|
} else {
|
||||||
|
return
|
||||||
}
|
}
|
||||||
//处理联锁报文
|
//处理联锁报文
|
||||||
msg := &fromCiMsg{}
|
msg := &fromCiMsg{}
|
||||||
err := msg.decode(i.fromCIBytes)
|
err := msg.decode(i.fromCIBytes)
|
||||||
|
logger().Info(fmt.Sprintf("解析完整联锁驱动及应答器报文数据:%x", i.fromCIBytes))
|
||||||
i.fromCIBytes = i.fromCIBytes[:0] //清空联锁报文存储
|
i.fromCIBytes = i.fromCIBytes[:0] //清空联锁报文存储
|
||||||
if err != nil {
|
if err != nil {
|
||||||
logger().Error(fmt.Sprintf("解析来自CI的数据出错:%s", err.Error()))
|
logger().Error(fmt.Sprintf("解析来自CI的数据出错:%s", err.Error()))
|
||||||
@ -186,9 +193,9 @@ func (i *interlockProxy) handleFromCiData(n int, data []byte) {
|
|||||||
}
|
}
|
||||||
//处理驱动数据
|
//处理驱动数据
|
||||||
if i.simulation != nil {
|
if i.simulation != nil {
|
||||||
|
logger().Info(fmt.Sprintf("解析出的驱动数据:%x", msg.driveData))
|
||||||
i.simulation.HandleInterlockDriverInfo(i.runConfig.Code, msg.driveData)
|
i.simulation.HandleInterlockDriverInfo(i.runConfig.Code, msg.driveData)
|
||||||
}
|
}
|
||||||
logger().Info(fmt.Sprintf("解析出联锁驱动数据:%x", msg.driveData))
|
|
||||||
//处理应答器数据
|
//处理应答器数据
|
||||||
for _, datum := range msg.baliseTelegramData {
|
for _, datum := range msg.baliseTelegramData {
|
||||||
indexBalise2 := i.indexBalise[datum.leuIndex]
|
indexBalise2 := i.indexBalise[datum.leuIndex]
|
||||||
|
@ -458,6 +458,9 @@ func (s *VerifySimulation) HandleInterlockDriverInfo(code string, driveBytes []b
|
|||||||
for i, b := range driveInfo {
|
for i, b := range driveInfo {
|
||||||
qdData := m.QdList[i]
|
qdData := m.QdList[i]
|
||||||
for _, relayId := range qdData.RefRelays {
|
for _, relayId := range qdData.RefRelays {
|
||||||
|
if b {
|
||||||
|
|
||||||
|
}
|
||||||
err := wd.SetQdBit(relayId, b)
|
err := wd.SetQdBit(relayId, b)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
slog.Error("联锁驱动数据设置出错", "error", err)
|
slog.Error("联锁驱动数据设置出错", "error", err)
|
||||||
|
Loading…
Reference in New Issue
Block a user