Skip to content

Commit 83b0b4c

Browse files
authored
Rename GotoAbsolutePosition to GotoPosition (#82)
Closes #74 breaking (API removed/renamed)
1 parent a49bdc2 commit 83b0b4c

6 files changed

Lines changed: 15 additions & 15 deletions

File tree

examples/SharpBrick.PoweredUp.Examples/ExampleCalibrationSteering.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,10 @@ public override async Task ExecuteAsync()
1818
await calibration.ExecuteAsync(motor);
1919
await technicMediumHub.WaitButtonClickAsync();
2020

21-
await motor.GotoAbsolutePositionAsync(CW * 50, 20, 100, SpecialSpeed.Hold, SpeedProfiles.AccelerationProfile);
21+
await motor.GotoPositionAsync(CW * 50, 20, 100, SpecialSpeed.Hold, SpeedProfiles.AccelerationProfile);
2222
await technicMediumHub.WaitButtonClickAsync();
2323

24-
await motor.GotoAbsolutePositionAsync(CCW * 50, 20, 100, SpecialSpeed.Hold, SpeedProfiles.AccelerationProfile);
24+
await motor.GotoPositionAsync(CCW * 50, 20, 100, SpecialSpeed.Hold, SpeedProfiles.AccelerationProfile);
2525
await Task.Delay(5000);
2626

2727
await technicMediumHub.SwitchOffAsync();

examples/SharpBrick.PoweredUp.Examples/ExampleMixedBag.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,9 @@ await technicMediumHub.VerifyDeploymentModelAsync(modelBuilder => modelBuilder
3232
// simple motor control
3333
var motor = technicMediumHub.A.GetDevice<TechnicXLargeLinearMotor>();
3434

35-
await motor.GotoAbsolutePositionAsync(CW * 45, 10, 100, SpecialSpeed.Brake, SpeedProfiles.None);
35+
await motor.GotoPositionAsync(CW * 45, 10, 100, SpecialSpeed.Brake, SpeedProfiles.None);
3636
await Task.Delay(2000);
37-
await motor.GotoAbsolutePositionAsync(CCW * 45, 10, 100, SpecialSpeed.Brake, SpeedProfiles.None);
37+
await motor.GotoPositionAsync(CCW * 45, 10, 100, SpecialSpeed.Brake, SpeedProfiles.None);
3838
await Task.Delay(2000);
3939
await motor.StartPowerAsync(100);
4040
await Task.Delay(5000);

examples/SharpBrick.PoweredUp.Examples/ExampleMotorControl.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,9 @@ await technicMediumHub.VerifyDeploymentModelAsync(modelBuilder => modelBuilder
3636

3737
await Task.Delay(10_000);
3838

39-
await motor.GotoAbsolutePositionAsync(45, 10, 100, SpecialSpeed.Brake, SpeedProfiles.None);
39+
await motor.GotoPositionAsync(45, 10, 100, SpecialSpeed.Brake, SpeedProfiles.None);
4040
await Task.Delay(2000);
41-
await motor.GotoAbsolutePositionAsync(-45, 10, 100, SpecialSpeed.Brake, SpeedProfiles.None);
41+
await motor.GotoPositionAsync(-45, 10, 100, SpecialSpeed.Brake, SpeedProfiles.None);
4242

4343
await technicMediumHub.SwitchOffAsync();
4444
}

examples/SharpBrick.PoweredUp.Examples/ExampleMotorInputAbsolutePosition.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -52,13 +52,13 @@ await technicMediumHub.VerifyDeploymentModelAsync(modelBuilder => modelBuilder
5252
// absolute movement to relative to zero point (SetZeroAsync or initial boot position)
5353
await technicMediumHub.RgbLight.SetRgbColorNoAsync(PoweredUpColor.Orange);
5454

55-
await motor.GotoAbsolutePositionAsync(0, 20, 100, SpecialSpeed.Brake, SpeedProfiles.None);
55+
await motor.GotoPositionAsync(0, 20, 100, SpecialSpeed.Brake, SpeedProfiles.None);
5656
await Task.Delay(1000);
57-
await motor.GotoAbsolutePositionAsync(90, 20, 100, SpecialSpeed.Brake, SpeedProfiles.None);
57+
await motor.GotoPositionAsync(90, 20, 100, SpecialSpeed.Brake, SpeedProfiles.None);
5858
await Task.Delay(1000);
59-
await motor.GotoAbsolutePositionAsync(180, 20, 100, SpecialSpeed.Brake, SpeedProfiles.None);
59+
await motor.GotoPositionAsync(180, 20, 100, SpecialSpeed.Brake, SpeedProfiles.None);
6060
await Task.Delay(1000);
61-
await motor.GotoAbsolutePositionAsync(-90, 20, 100, SpecialSpeed.Brake, SpeedProfiles.None);
61+
await motor.GotoPositionAsync(-90, 20, 100, SpecialSpeed.Brake, SpeedProfiles.None);
6262
await Task.Delay(1000);
6363

6464
await motor.GotoRealZeroAsync();

examples/SharpBrick.PoweredUp.Examples/ExampleMotorVirtualPort.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ await technicMediumHub.VerifyDeploymentModelAsync(modelBuilder => modelBuilder
2121

2222
var motorsOnVirtualPort = virtualPort.GetDevice<TechnicXLargeLinearMotor>();
2323

24-
await motorsOnVirtualPort.GotoAbsolutePositionAsync(90, -45, 10, 100, SpecialSpeed.Brake, SpeedProfiles.None);
24+
await motorsOnVirtualPort.GotoPositionAsync(90, -45, 10, 100, SpecialSpeed.Brake, SpeedProfiles.None);
2525

2626
await Task.Delay(3000);
2727

src/SharpBrick.PoweredUp/Devices/AbsoluteMotor.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ protected AbsoluteMotor(IPoweredUpProtocol protocol, byte hubId, byte portId)
4141
/// <param name="endState">After time has expired, either Float, Hold or Brake.</param>
4242
/// <param name="profile">The speed profiles used (as flags) for acceleration and deceleration</param>
4343
/// <returns></returns>
44-
public async Task<PortFeedback> GotoAbsolutePositionAsync(int absolutePosition, sbyte speed, byte maxPower, SpecialSpeed endState, SpeedProfiles profile)
44+
public async Task<PortFeedback> GotoPositionAsync(int absolutePosition, sbyte speed, byte maxPower, SpecialSpeed endState, SpeedProfiles profile)
4545
{
4646
AssertValidSpeed(speed, nameof(speed));
4747
AssertValidMaxPower(maxPower, nameof(maxPower));
@@ -78,7 +78,7 @@ public async Task<PortFeedback> GotoAbsolutePositionAsync(int absolutePosition,
7878
/// <param name="endState">After time has expired, either Float, Hold or Brake.</param>
7979
/// <param name="profile">The speed profiles used (as flags) for acceleration and deceleration</param>
8080
/// <returns></returns>
81-
public async Task<PortFeedback> GotoAbsolutePositionAsync(int absolutePosition1, int absolutePosition2, sbyte speed, byte maxPower, SpecialSpeed endState, SpeedProfiles profile)
81+
public async Task<PortFeedback> GotoPositionAsync(int absolutePosition1, int absolutePosition2, sbyte speed, byte maxPower, SpecialSpeed endState, SpeedProfiles profile)
8282
{
8383
AssertValidSpeed(speed, nameof(speed));
8484
AssertValidMaxPower(maxPower, nameof(maxPower));
@@ -102,7 +102,7 @@ public async Task<PortFeedback> GotoAbsolutePositionAsync(int absolutePosition1,
102102
return response;
103103
}
104104

105-
private async Task<int> GetAbsolutePositionAsync()
105+
private async Task<int> GetPositionAsync()
106106
{
107107
AssertIsConnected();
108108

@@ -125,7 +125,7 @@ public async Task GotoRealZeroAsync()
125125
{
126126
AssertIsConnected();
127127

128-
var currentPosition = await GetAbsolutePositionAsync();
128+
var currentPosition = await GetPositionAsync();
129129

130130
sbyte speed = 5;
131131

0 commit comments

Comments
 (0)