From 006e2f063cf60c5c4c033ebdf938ae76d25c4efa Mon Sep 17 00:00:00 2001 From: bpds Date: Thu, 28 Dec 2023 12:13:16 +0100 Subject: [PATCH] Keep it simple remove useless Acceleration func --- adxl345/adxl345.go | 29 ----------------------------- 1 file changed, 29 deletions(-) diff --git a/adxl345/adxl345.go b/adxl345/adxl345.go index 8cd5e54..2ea4927 100644 --- a/adxl345/adxl345.go +++ b/adxl345/adxl345.go @@ -214,35 +214,6 @@ type Acceleration struct { Z int16 } -// sum returns the sum of the accelerations on the three axes -func (a Acceleration) sum() int64 { - return int64(a.X) + int64(a.Y) + int64(a.Z) -} - -// diff returns the absolute difference between the two Acceleration -func (a Acceleration) diff(b Acceleration) Acceleration { - diff := Acceleration{ - X: a.X - b.X, - Y: a.Y - b.Y, - Z: a.Z - b.Z, - } - if diff.X < 0 { - diff.X = -diff.X - } - if diff.Y < 0 { - diff.Y = -diff.Y - } - if diff.Z < 0 { - diff.Z = -diff.Z - } - return diff -} - -// isZero returns true if the Acceleration is zero -func (a Acceleration) isZero() bool { - return a.X == 0 && a.Y == 0 && a.Z == 0 -} - // String returns a string representation of the Acceleration func (a Acceleration) String() string { return fmt.Sprintf("X:%d Y:%d Z:%d", a.X, a.Y, a.Z)