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}