This commit is contained in:
xzb 2023-11-29 14:10:18 +08:00
parent 901009ce13
commit 7a75716196

View File

@ -58,8 +58,10 @@ type TrainBtm struct {
lastTelegram *TrainBaliseTelegram lastTelegram *TrainBaliseTelegram
} }
const SB_LEN = 16
func NewTrainBtm() *TrainBtm { func NewTrainBtm() *TrainBtm {
return &TrainBtm{scannedBalises: make(chan *TrainBaliseTelegram, 16)} return &TrainBtm{scannedBalises: make(chan *TrainBaliseTelegram, SB_LEN)}
} }
// 应答器计数器加1[0,255] // 应答器计数器加1[0,255]
@ -95,7 +97,9 @@ func (t *TrainBtm) Scanning(aboveBalise bool, telegram *TrainBaliseTelegram) {
} }
// //
if isNewTbt { if isNewTbt {
if len(t.scannedBalises) < SB_LEN {
t.scannedBalises <- telegram t.scannedBalises <- telegram
}
t.baliseMessageCounterAdd1() t.baliseMessageCounterAdd1()
} }
// //