From 43b84dc0fb8f81154a4015b873690f4c4b274130 Mon Sep 17 00:00:00 2001 From: saji Date: Thu, 6 Jul 2023 15:22:00 -0500 Subject: [PATCH] remove vcantest (use canplayer instead) --- cmd/gotelem/cli/socketcan.go | 35 +---------------------------------- 1 file changed, 1 insertion(+), 34 deletions(-) diff --git a/cmd/gotelem/cli/socketcan.go b/cmd/gotelem/cli/socketcan.go index c16cdbd..3ad1708 100644 --- a/cmd/gotelem/cli/socketcan.go +++ b/cmd/gotelem/cli/socketcan.go @@ -3,14 +3,12 @@ package cli import ( - "strings" "time" "github.com/kschamplin/gotelem" "github.com/kschamplin/gotelem/skylab" "github.com/kschamplin/gotelem/socketcan" "github.com/urfave/cli/v2" - "golang.org/x/exp/slog" ) // this file adds socketCAN commands and functionality when building on linux. @@ -43,7 +41,6 @@ type socketCANService struct { } func (s *socketCANService) Status() { - return } func (s *socketCANService) String() string { @@ -59,16 +56,11 @@ func (s *socketCANService) Start(cCtx *cli.Context, deps svcDeps) (err error) { logger := deps.Logger broker := deps.Broker - if cCtx.String("can") == "" { + if cCtx.IsSet("can") { logger.Info("no can device provided") return } - // vcan demo system - make fake packets. - if strings.HasPrefix(cCtx.String("can"), "v") { - go vcanTest(cCtx.String("can")) - } - s.sock, err = socketcan.NewCanSocket(cCtx.String("can")) if err != nil { logger.Error("error opening socket", "err", err) @@ -151,28 +143,3 @@ Various helper utilties for CAN bus on sockets. }, }, } - -func vcanTest(devname string) { - sock, err := socketcan.NewCanSocket(devname) - if err != nil { - slog.Error("error opening socket", "err", err) - return - } - testPkt := skylab.WslMotorCurrentVector{ - Iq: 0.1, - Id: 0.2, - } - - id, data, _ := skylab.ToCanFrame(&testPkt) - testFrame := gotelem.Frame{ - Id: id, - Data: data, - Kind: gotelem.CanSFFFrame, - } - - for { - slog.Info("sending test packet") - sock.Send(&testFrame) - time.Sleep(1 * time.Second) - } -}