From b8dc207a0ed28d15f6bbcd256b1cd5976760b65e Mon Sep 17 00:00:00 2001 From: tiger_zhou Date: Thu, 4 Jul 2024 17:39:56 +0800 Subject: [PATCH] =?UTF-8?q?=E5=88=97=E8=BD=A6=E6=8E=A7=E5=88=B6=E6=B6=88?= =?UTF-8?q?=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- message_server/train_control_ms.go | 7 ++++++- rts-sim-testing-message | 2 +- ts/simulation/wayside/memory/train_tcc_graphic.go | 5 +++++ 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/message_server/train_control_ms.go b/message_server/train_control_ms.go index 8799976..ae270c3 100644 --- a/message_server/train_control_ms.go +++ b/message_server/train_control_ms.go @@ -18,7 +18,12 @@ func NewTrainControlMs(vs *memory.VerifySimulation, mapId int32) ms_api.MsgTask trainId := fmt.Sprintf("%v", key) ts := value.(*state_proto.TrainState) ttcc := ts.Tcc - tcc := &state_proto.TrainControlStateMsg{Buttons: ttcc.Buttons, DriverKey: ttcc.DriverKey, DirKey: ttcc.DirKey, PushHandler: ttcc.PushHandler} + lights := make([]*state_proto.TrainControlState_ControlLight, 0) + for _, light := range ttcc.LightMaps { + lights = append(lights, &state_proto.TrainControlState_ControlLight{Id: light.Id, Val: light.Val}) + } + tcc := &state_proto.TrainControlStateMsg{Buttons: ttcc.Buttons, DriverKey: ttcc.DriverKey, DirKey: ttcc.DirKey, PushHandler: ttcc.PushHandler, Lights: lights} + err := mqtt.GetMsgClient().PubTrainControlState(vs.SimulationId, trainId, tcc) if err != nil { slog.Error("发送列车控制mqtt失败", err) diff --git a/rts-sim-testing-message b/rts-sim-testing-message index 2ac805b..6cdf88a 160000 --- a/rts-sim-testing-message +++ b/rts-sim-testing-message @@ -1 +1 @@ -Subproject commit 2ac805b05486bf569c0aa00233f485be1d85848e +Subproject commit 6cdf88a92d573fdb6502047d10abd1af7d0e40a2 diff --git a/ts/simulation/wayside/memory/train_tcc_graphic.go b/ts/simulation/wayside/memory/train_tcc_graphic.go index 35e32bf..3be9dda 100644 --- a/ts/simulation/wayside/memory/train_tcc_graphic.go +++ b/ts/simulation/wayside/memory/train_tcc_graphic.go @@ -93,6 +93,11 @@ func initTrainTcc(vs *VerifySimulation, runDir bool, breaking int32) *state_prot tcc := &state_proto.TrainControlState{} if tccGI != nil { + tcc.LightMaps = make(map[string]*state_proto.TrainControlState_ControlLight) + for _, light := range tccGI.TccLights { + tcc.LightMaps[light.Code] = &state_proto.TrainControlState_ControlLight{Id: light.Common.Id, Val: light.InitialState} + } + btns := make([]*state_proto.TrainControlState_ControlButton, 0) for _, b := range tccGI.TccButtons { btn := &state_proto.TrainControlState_ControlButton{Id: b.Common.Id, Passed: false}