aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBlaster4385 <venkatesh@tablaster.dev>2025-01-13 19:34:33 +0530
committerBlaster4385 <venkatesh@tablaster.dev>2025-01-13 19:36:21 +0530
commita8e48c9cf4694a13113bb14a2849a8347a717b27 (patch)
tree9f0a2144ef1c660e03687eeb02acd8f0fa6d1cb3
parentccaf20fb5b748eafae6b286ba9173c0a4f0ffb27 (diff)
refactor(main|app.go): simplified logging
-rw-r--r--app.go9
-rw-r--r--main.go3
2 files changed, 7 insertions, 5 deletions
diff --git a/app.go b/app.go
index 0b0c3b9..d0ab2de 100644
--- a/app.go
+++ b/app.go
@@ -166,12 +166,11 @@ func (a *App) sendCommand(data []byte) error {
return fmt.Errorf("failed to get output endpoint: %v", err)
}
- written, err := outEndpoint.Write(data)
- if err == nil {
- fmt.Printf("Success on endpoint 0x%02x! Sent %d bytes\n", endpoint, written)
- return nil
+ _, err = outEndpoint.Write(data)
+ if err != nil {
+ return fmt.Errorf("failed to send on any endpoint")
}
- return fmt.Errorf("failed to send on any endpoint")
+ return nil
}
func (a *App) ExportGrid(filename string, grid [][]bool) error {
diff --git a/main.go b/main.go
index b6954a3..e49ca20 100644
--- a/main.go
+++ b/main.go
@@ -106,6 +106,7 @@ func daemonMode(app *App) {
}
func handleDaemonPattern(app *App, filename string, ctx context.Context) {
+ fmt.Println("Startng custom mode...")
grid, err := app.ParseCSV(filename)
if err != nil {
handleError(fmt.Errorf("parsing CSV file: %w", err))
@@ -120,6 +121,7 @@ func handleDaemonPattern(app *App, filename string, ctx context.Context) {
func daemonTemperatureDisplay(app *App, ctx context.Context) {
ticker := time.NewTicker(3 * time.Second)
defer ticker.Stop()
+ fmt.Println("Startng temperature mode...")
go func() {
for {
@@ -154,6 +156,7 @@ func daemonTemperatureDisplay(app *App, ctx context.Context) {
func daemonUsageDisplay(app *App, ctx context.Context) {
ticker := time.NewTicker(3 * time.Second)
defer ticker.Stop()
+ fmt.Println("Startng usage mode...")
go func() {
for {