From bbaff11f2c550f857826c13e41959e78fa6069d8 Mon Sep 17 00:00:00 2001 From: randhid <35934754+randhid@users.noreply.github.com> Date: Thu, 4 May 2023 10:28:29 -0400 Subject: [PATCH] Revert " Remove cfg from encoded motor structure " (#2323) --- components/motor/gpio/motor_encoder.go | 2 ++ components/motor/gpio/motor_encoder_test.go | 5 ++++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/components/motor/gpio/motor_encoder.go b/components/motor/gpio/motor_encoder.go index d3e3282c9724..2a552b93253c 100644 --- a/components/motor/gpio/motor_encoder.go +++ b/components/motor/gpio/motor_encoder.go @@ -113,6 +113,7 @@ func newEncodedMotor( cancelCtx, cancel := context.WithCancel(context.Background()) em := &EncodedMotor{ Named: name.AsNamed(), + cfg: motorConfig, ticksPerRotation: int64(motorConfig.TicksPerRotation), real: localReal, cancelCtx: cancelCtx, @@ -174,6 +175,7 @@ type EncodedMotor struct { resource.AlwaysRebuild activeBackgroundWorkers sync.WaitGroup + cfg Config real motor.LocalMotor encoder encoder.Encoder diff --git a/components/motor/gpio/motor_encoder_test.go b/components/motor/gpio/motor_encoder_test.go index 11fbb073f2e0..46668c397e14 100644 --- a/components/motor/gpio/motor_encoder_test.go +++ b/components/motor/gpio/motor_encoder_test.go @@ -20,6 +20,8 @@ import ( "go.viam.com/rdk/resource" ) +// setupMotorWithEncoder(encType string) {} + func nowNanosTest() uint64 { return uint64(time.Now().UnixNano()) } @@ -91,6 +93,7 @@ func TestMotorEncoder1(t *testing.T) { }) t.Run("encoded motor testing SetPower interrupt GoFor", func(t *testing.T) { + t.Skip() test.That(t, motorDep.goForInternal(context.Background(), 1000, 1000), test.ShouldBeNil) test.That(t, fakeMotor.Direction(), test.ShouldEqual, 1) test.That(t, fakeMotor.PowerPct(), test.ShouldBeGreaterThan, float32(0)) @@ -274,7 +277,7 @@ func TestMotorEncoder1(t *testing.T) { } func TestMotorEncoderIncremental(t *testing.T) { - t.Skip() + // t.Skip() logger := golog.NewTestLogger(t) undo := SetRPMSleepDebug(1, false) defer undo()