diff --git a/skylab/make_skylab.go b/skylab/make_skylab.go index 80d18a2..483d15e 100644 --- a/skylab/make_skylab.go +++ b/skylab/make_skylab.go @@ -284,8 +284,6 @@ func main() { // then we need to make a header template. v := &SkylabFile{} - fmt.Printf("running %s on %s\n", os.Args[0], os.Getenv("GOFILE")) - basePath, err := filepath.Abs(os.Args[1]) if err != nil { panic(err) diff --git a/skylab/skylab_gen.go b/skylab/skylab_gen.go index d90023d..a3864f4 100644 --- a/skylab/skylab_gen.go +++ b/skylab/skylab_gen.go @@ -1,4 +1,4 @@ -// generated by gen_skylab.go at 2023-05-20 12:46:09.664376329 -0500 CDT m=+0.002839937 DO NOT EDIT! +// generated by gen_skylab.go at 2023-05-22 08:37:01.7251166 -0500 CDT m=+0.002980842 DO NOT EDIT! package skylab @@ -232,6 +232,8 @@ var idMap = map[uint32]bool{ 0x117: true, } +// FromCanFrame creates a Packet from a given CAN ID and data payload. +// If the CAN ID is unknown, it will return an error. func FromCanFrame(id uint32, data []byte) (Packet, error) { if !idMap[id] { return nil, errors.New("Unknown Id") @@ -1554,7 +1556,7 @@ type BmsModule struct { // 1 C Temperature float32 `json:"temperature"` // Idx is the packet index. The accepted range is 0-36 - Idx uint32 + Idx uint32 `json:"idx"` } func (p *BmsModule) CANId() (uint32, error) { @@ -2541,7 +2543,7 @@ func (p *VisionRearviewCommand) String() string { type TrackerEnable struct { Enable uint8 `json:"enable"` // Idx is the packet index. The accepted range is 0-6 - Idx uint32 + Idx uint32 `json:"idx"` } func (p *TrackerEnable) CANId() (uint32, error) { @@ -3631,7 +3633,7 @@ type TrackerData struct { // 0.01 C Temperature uint16 `json:"temperature"` // Idx is the packet index. The accepted range is 0-6 - Idx uint32 + Idx uint32 `json:"idx"` } func (p *TrackerData) CANId() (uint32, error) { diff --git a/skylab/templates/golang.go.tmpl b/skylab/templates/golang.go.tmpl index d09e9ec..9cbc497 100644 --- a/skylab/templates/golang.go.tmpl +++ b/skylab/templates/golang.go.tmpl @@ -41,7 +41,7 @@ type {{$structName}} struct { {{- end}} {{- if .Repeat }} // Idx is the packet index. The accepted range is 0-{{.Repeat}} - Idx uint32 + Idx uint32 `json:"idx"` {{- end }} } @@ -110,6 +110,8 @@ var idMap = map[uint32]bool{ {{- end}} } +// FromCanFrame creates a Packet from a given CAN ID and data payload. +// If the CAN ID is unknown, it will return an error. func FromCanFrame(id uint32, data []byte) (Packet, error) { if !idMap[id] { return nil, errors.New("Unknown Id")