规范串口通讯
This commit is contained in:
@@ -48,7 +48,7 @@ func PushCard(ctx context.Context) leaf.HandlerFunc {
|
||||
devices := make([]*card_pusher.Device, 0)
|
||||
for i, group := range g.PushGroups {
|
||||
// 对读卡器初始化配置
|
||||
reader.SetSlave(uint8(i + 1))
|
||||
reader.SetSlave(byte(i + 1))
|
||||
err = reader.Init()
|
||||
if err != nil {
|
||||
zap.S().Panicln("读卡器初始配置失败", err)
|
||||
@@ -114,7 +114,7 @@ func PushCard(ctx context.Context) leaf.HandlerFunc {
|
||||
if body.num != 0 {
|
||||
// 若卡片就位,读取卡片信息
|
||||
if devices[body.num-1].GetOutOk() == 1 {
|
||||
reader.SetSlave(uint8(body.num))
|
||||
reader.SetSlave(byte(body.num))
|
||||
if info := reader.GetCardInfo(); info != nil {
|
||||
body.CardId = info.ID
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user