fix skylab template

This commit is contained in:
saji 2023-05-20 14:54:10 -05:00
parent c18f556de8
commit 38ac8d8e55

View file

@ -118,13 +118,13 @@ func FromCanFrame(id uint32, data []byte) (Packet, error) {
{{- range $p := .Packets }} {{- range $p := .Packets }}
{{- if $p.Repeat }} {{- if $p.Repeat }}
case {{ Nx (int $p.Id) $p.Repeat $p.Offset | mapf "0x%X" | strJoin ", " -}}: case {{ Nx (int $p.Id) $p.Repeat $p.Offset | mapf "0x%X" | strJoin ", " -}}:
var res *{{camelCase $p.Name true}} var res = &{{camelCase $p.Name true}}{}
res.UnmarshalPacket(data) res.UnmarshalPacket(data)
res.Idx = id - {{$p.Id | printf "0x%X" }} res.Idx = id - {{$p.Id | printf "0x%X" }}
return res, nil return res, nil
{{- else }} {{- else }}
case {{ $p.Id | printf "0x%X" }}: case {{ $p.Id | printf "0x%X" }}:
var res *{{camelCase $p.Name true}} var res = &{{camelCase $p.Name true}}{}
res.UnmarshalPacket(data) res.UnmarshalPacket(data)
return res, nil return res, nil
{{- end}} {{- end}}