继电器、读卡器,都用统一的modbus协议

This commit is contained in:
2024-12-12 10:30:21 +08:00
parent 25cb34f6f5
commit df9dbb0926
15 changed files with 142 additions and 127 deletions

View File

@@ -20,10 +20,10 @@ import (
func WaitCard(ctx context.Context) leaf.HandlerFunc {
g := (game.G).(game.ConfigWait)
reader, err := card_reader.NewReader(g.URL)
reader, err := card_reader.NewReader(g.Addr)
if err != nil {
if errors.Is(err, fs.ErrNotExist) {
zap.S().Errorf("读卡器串口文件不存在: %s", g.URL)
zap.S().Errorf("读卡器串口文件不存在: %s", g.Addr)
os.Exit(1)
}
zap.S().Panicf("读卡器串口连接失败 [%T]: %q", err, err)