From 034c8209f6e6f17bf5b6f265e2a3ef58f05b2c80 Mon Sep 17 00:00:00 2001 From: xengineering Date: Thu, 30 May 2024 17:10:08 +0200 Subject: software: Switch back from .Log() to .Cat() Logging the bytes is not really readable because of time stamp prefixes. --- software/communication/interface.go | 7 +++---- software/main.go | 5 ++++- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/software/communication/interface.go b/software/communication/interface.go index d6111cc..672617e 100644 --- a/software/communication/interface.go +++ b/software/communication/interface.go @@ -2,7 +2,6 @@ package communication import ( "fmt" - "log" "go.bug.st/serial" ) @@ -32,13 +31,13 @@ func NewSerialInterface() (SerialInterface, error) { return iface, nil } -func (i *SerialInterface) Log() { +func (i *SerialInterface) Cat() error { for { data, err := i.Read() if err != nil { - log.Fatal(err) + return err } - log.Printf("RX: '%s'\n", string(data)) + fmt.Printf("%s", string(data)) } } diff --git a/software/main.go b/software/main.go index d0d3a8c..d0ca2cd 100644 --- a/software/main.go +++ b/software/main.go @@ -12,5 +12,8 @@ func main() { log.Fatal(err) } - iface.Log() + err = iface.Cat() + if err != nil { + log.Fatal(err) + } } -- cgit v1.2.3-70-g09d2