@@ -43,15 +43,15 @@ protected TachoMotor(IPoweredUpProtocol protocol, byte hubId, byte portId)
4343 /// </param>
4444 /// <param name="profileNumber">Specify the acceleration profile used. Defaults to standard AccelerationProfile.</param>
4545 /// <returns></returns>
46- public async Task SetAccelerationTimeAsync ( ushort timeInMs , SpeedProfiles profileNumber = SpeedProfiles . AccelerationProfile )
46+ public async Task < PortFeedback > SetAccelerationTimeAsync ( ushort timeInMs , SpeedProfiles profileNumber = SpeedProfiles . AccelerationProfile )
4747 {
4848 if ( timeInMs < 0 || timeInMs > 10_000 )
4949 {
5050 throw new ArgumentOutOfRangeException ( nameof ( timeInMs ) ) ;
5151 }
5252 AssertIsConnected ( ) ;
5353
54- await _protocol . SendMessageAsync ( new PortOutputCommandSetAccTimeMessage ( )
54+ var response = await _protocol . SendPortOutputCommandAsync ( new PortOutputCommandSetAccTimeMessage ( )
5555 {
5656 HubId = _hubId ,
5757 PortId = _portId ,
@@ -60,6 +60,8 @@ await _protocol.SendMessageAsync(new PortOutputCommandSetAccTimeMessage()
6060 Time = timeInMs ,
6161 Profile = profileNumber ,
6262 } ) ;
63+
64+ return response ;
6365 }
6466
6567 /// <summary>
@@ -73,15 +75,15 @@ await _protocol.SendMessageAsync(new PortOutputCommandSetAccTimeMessage()
7375 /// </param>
7476 /// <param name="profileNumber">Specify the deceleration profile used. Defaults to standard DecelerationProfile.</param>
7577 /// <returns></returns>
76- public async Task SetDecelerationTimeAsync ( ushort timeInMs , SpeedProfiles profileNumber = SpeedProfiles . DecelerationProfile )
78+ public async Task < PortFeedback > SetDecelerationTimeAsync ( ushort timeInMs , SpeedProfiles profileNumber = SpeedProfiles . DecelerationProfile )
7779 {
7880 if ( timeInMs < 0 || timeInMs > 10_000 )
7981 {
8082 throw new ArgumentOutOfRangeException ( nameof ( timeInMs ) ) ;
8183 }
8284 AssertIsConnected ( ) ;
8385
84- await _protocol . SendMessageAsync ( new PortOutputCommandSetDecTimeMessage ( )
86+ var response = await _protocol . SendPortOutputCommandAsync ( new PortOutputCommandSetDecTimeMessage ( )
8587 {
8688 HubId = _hubId ,
8789 PortId = _portId ,
@@ -90,6 +92,8 @@ await _protocol.SendMessageAsync(new PortOutputCommandSetDecTimeMessage()
9092 Time = timeInMs ,
9193 Profile = profileNumber ,
9294 } ) ;
95+
96+ return response ;
9397 }
9498
9599 /// <summary>
@@ -102,13 +106,13 @@ await _protocol.SendMessageAsync(new PortOutputCommandSetDecTimeMessage()
102106 /// <param name="maxPower">Maximum Power level used.</param>
103107 /// <param name="profile">The speed profiles used (as flags) for acceleration and deceleration</param>
104108 /// <returns></returns>
105- public async Task StartSpeedAsync ( sbyte speed , byte maxPower , SpeedProfiles profile )
109+ public async Task < PortFeedback > StartSpeedAsync ( sbyte speed , byte maxPower , SpeedProfiles profile )
106110 {
107111 AssertValidSpeed ( speed , nameof ( speed ) ) ;
108112 AssertValidMaxPower ( maxPower , nameof ( maxPower ) ) ;
109113 AssertIsConnected ( ) ;
110114
111- await _protocol . SendMessageAsync ( new PortOutputCommandStartSpeedMessage ( )
115+ var response = await _protocol . SendPortOutputCommandAsync ( new PortOutputCommandStartSpeedMessage ( )
112116 {
113117 HubId = _hubId ,
114118 PortId = _portId ,
@@ -118,6 +122,8 @@ await _protocol.SendMessageAsync(new PortOutputCommandStartSpeedMessage()
118122 MaxPower = maxPower ,
119123 Profile = profile ,
120124 } ) ;
125+
126+ return response ;
121127 }
122128
123129 /// <summary>
@@ -134,15 +140,15 @@ await _protocol.SendMessageAsync(new PortOutputCommandStartSpeedMessage()
134140 /// <param name="maxPower">Maximum Power level used.</param>
135141 /// <param name="profile">The speed profiles used (as flags) for acceleration and deceleration</param>
136142 /// <returns></returns>
137- public async Task StartSpeedAsync ( sbyte speedOnMotor1 , sbyte speedOnMotor2 , byte maxPower , SpeedProfiles profile )
143+ public async Task < PortFeedback > StartSpeedAsync ( sbyte speedOnMotor1 , sbyte speedOnMotor2 , byte maxPower , SpeedProfiles profile )
138144 {
139145 AssertValidSpeed ( speedOnMotor1 , nameof ( speedOnMotor1 ) ) ;
140146 AssertValidSpeed ( speedOnMotor2 , nameof ( speedOnMotor2 ) ) ;
141147 AssertValidMaxPower ( maxPower , nameof ( maxPower ) ) ;
142148 AssertIsConnected ( ) ;
143149 AssertIsVirtualPort ( ) ;
144150
145- await _protocol . SendMessageAsync ( new PortOutputCommandStartSpeed2Message ( )
151+ var response = await _protocol . SendPortOutputCommandAsync ( new PortOutputCommandStartSpeed2Message ( )
146152 {
147153 HubId = _hubId ,
148154 PortId = _portId ,
@@ -153,6 +159,8 @@ await _protocol.SendMessageAsync(new PortOutputCommandStartSpeed2Message()
153159 MaxPower = maxPower ,
154160 Profile = profile ,
155161 } ) ;
162+
163+ return response ;
156164 }
157165
158166 /// <summary>
@@ -167,13 +175,13 @@ await _protocol.SendMessageAsync(new PortOutputCommandStartSpeed2Message()
167175 /// <param name="endState">After time has expired, either Float, Hold or Brake.</param>
168176 /// <param name="profile">The speed profiles used (as flags) for acceleration and deceleration</param>
169177 /// <returns></returns>
170- public async Task StartSpeedForTimeAsync ( ushort timeInMs , sbyte speed , byte maxPower , SpecialSpeed endState , SpeedProfiles profile )
178+ public async Task < PortFeedback > StartSpeedForTimeAsync ( ushort timeInMs , sbyte speed , byte maxPower , SpecialSpeed endState , SpeedProfiles profile )
171179 {
172180 AssertValidSpeed ( speed , nameof ( speed ) ) ;
173181 AssertValidMaxPower ( maxPower , nameof ( maxPower ) ) ;
174182 AssertIsConnected ( ) ;
175183
176- await _protocol . SendMessageAsync ( new PortOutputCommandStartSpeedForTimeMessage ( )
184+ var response = await _protocol . SendPortOutputCommandAsync ( new PortOutputCommandStartSpeedForTimeMessage ( )
177185 {
178186 HubId = _hubId ,
179187 PortId = _portId ,
@@ -185,6 +193,8 @@ await _protocol.SendMessageAsync(new PortOutputCommandStartSpeedForTimeMessage()
185193 EndState = endState ,
186194 Profile = profile ,
187195 } ) ;
196+
197+ return response ;
188198 }
189199
190200 /// <summary>
@@ -203,15 +213,15 @@ await _protocol.SendMessageAsync(new PortOutputCommandStartSpeedForTimeMessage()
203213 /// <param name="endState">After time has expired, either Float, Hold or Brake.</param>
204214 /// <param name="profile">The speed profiles used (as flags) for acceleration and deceleration</param>
205215 /// <returns></returns>
206- public async Task StartSpeedForTimeAsync ( ushort timeInMs , sbyte speedOnMotor1 , sbyte speedOnMotor2 , byte maxPower , SpecialSpeed endState , SpeedProfiles profile )
216+ public async Task < PortFeedback > StartSpeedForTimeAsync ( ushort timeInMs , sbyte speedOnMotor1 , sbyte speedOnMotor2 , byte maxPower , SpecialSpeed endState , SpeedProfiles profile )
207217 {
208218 AssertValidSpeed ( speedOnMotor1 , nameof ( speedOnMotor1 ) ) ;
209219 AssertValidSpeed ( speedOnMotor2 , nameof ( speedOnMotor2 ) ) ;
210220 AssertValidMaxPower ( maxPower , nameof ( maxPower ) ) ;
211221 AssertIsConnected ( ) ;
212222 AssertIsVirtualPort ( ) ;
213223
214- await _protocol . SendMessageAsync ( new PortOutputCommandStartSpeedForTime2Message ( )
224+ var response = await _protocol . SendPortOutputCommandAsync ( new PortOutputCommandStartSpeedForTime2Message ( )
215225 {
216226 HubId = _hubId ,
217227 PortId = _portId ,
@@ -224,6 +234,8 @@ await _protocol.SendMessageAsync(new PortOutputCommandStartSpeedForTime2Message(
224234 EndState = endState ,
225235 Profile = profile ,
226236 } ) ;
237+
238+ return response ;
227239 }
228240
229241 /// <summary>
@@ -235,14 +247,14 @@ await _protocol.SendMessageAsync(new PortOutputCommandStartSpeedForTime2Message(
235247 /// <param name="endState">After time has expired, either Float, Hold or Brake.</param>
236248 /// <param name="profile">The speed profiles used (as flags) for acceleration and deceleration</param>
237249 /// <returns></returns>
238- public async Task StartSpeedForDegreesAsync ( uint degrees , sbyte speed , byte maxPower , SpecialSpeed endState , SpeedProfiles profile )
250+ public async Task < PortFeedback > StartSpeedForDegreesAsync ( uint degrees , sbyte speed , byte maxPower , SpecialSpeed endState , SpeedProfiles profile )
239251 {
240252 AssertValidDegrees ( degrees , nameof ( degrees ) ) ;
241253 AssertValidSpeed ( speed , nameof ( speed ) ) ;
242254 AssertValidMaxPower ( maxPower , nameof ( maxPower ) ) ;
243255 AssertIsConnected ( ) ;
244256
245- await _protocol . SendMessageAsync ( new PortOutputCommandStartSpeedForDegreesMessage ( )
257+ var response = await _protocol . SendPortOutputCommandAsync ( new PortOutputCommandStartSpeedForDegreesMessage ( )
246258 {
247259 HubId = _hubId ,
248260 PortId = _portId ,
@@ -254,6 +266,8 @@ await _protocol.SendMessageAsync(new PortOutputCommandStartSpeedForDegreesMessag
254266 EndState = endState ,
255267 Profile = profile ,
256268 } ) ;
269+
270+ return response ;
257271 }
258272
259273 /// <summary>
@@ -266,7 +280,7 @@ await _protocol.SendMessageAsync(new PortOutputCommandStartSpeedForDegreesMessag
266280 /// <param name="endState">After time has expired, either Float, Hold or Brake.</param>
267281 /// <param name="profile">The speed profiles used (as flags) for acceleration and deceleration</param>
268282 /// <returns></returns>
269- public async Task StartSpeedForDegreesAsync ( uint degrees , sbyte speedOnMotor1 , sbyte speedOnMotor2 , byte maxPower , SpecialSpeed endState , SpeedProfiles profile )
283+ public async Task < PortFeedback > StartSpeedForDegreesAsync ( uint degrees , sbyte speedOnMotor1 , sbyte speedOnMotor2 , byte maxPower , SpecialSpeed endState , SpeedProfiles profile )
270284 {
271285 AssertValidDegrees ( degrees , nameof ( degrees ) ) ;
272286 AssertValidSpeed ( speedOnMotor1 , nameof ( speedOnMotor1 ) ) ;
@@ -275,7 +289,7 @@ public async Task StartSpeedForDegreesAsync(uint degrees, sbyte speedOnMotor1, s
275289 AssertIsConnected ( ) ;
276290 AssertIsVirtualPort ( ) ;
277291
278- await _protocol . SendMessageAsync ( new PortOutputCommandStartSpeedForDegrees2Message ( )
292+ var response = await _protocol . SendPortOutputCommandAsync ( new PortOutputCommandStartSpeedForDegrees2Message ( )
279293 {
280294 HubId = _hubId ,
281295 PortId = _portId ,
@@ -288,6 +302,8 @@ await _protocol.SendMessageAsync(new PortOutputCommandStartSpeedForDegrees2Messa
288302 EndState = endState ,
289303 Profile = profile ,
290304 } ) ;
305+
306+ return response ;
291307 }
292308
293309 protected void AssertValidSpeed ( sbyte speed , string argumentName )
0 commit comments