@@ -202,7 +202,8 @@ def _run_positional_ramp(self, pos, newpos, speed):
202202 # Collapse speed range to -5 to 5
203203 speed *= 0.05
204204 dur = abs ((newpos - pos ) / speed )
205- cmd = (f"port { self .port } ; combi 0 { self ._combi } ; select 0 ; pid { self .port } 0 1 s4 0.0027777778 0 5 0 .1 3 ; "
205+ cmd = (f"port { self .port } ; combi 0 { self ._combi } ; select 0 ; selrate { self ._interval } ; "
206+ f"pid { self .port } 0 1 s4 0.0027777778 0 5 0 .1 3; "
206207 f"set ramp { pos } { newpos } { dur } 0\r " )
207208 self ._write (cmd )
208209 with self ._hat .rampcond [self .port ]:
@@ -258,7 +259,8 @@ def run_to_position(self, degrees, speed=None, blocking=True, direction="shortes
258259
259260 def _run_for_seconds (self , seconds , speed ):
260261 self ._runmode = MotorRunmode .SECONDS
261- cmd = (f"port { self .port } ; combi 0 { self ._combi } ; select 0 ; pid { self .port } 0 0 s1 1 0 0.003 0.01 0 100; "
262+ cmd = (f"port { self .port } ; combi 0 { self ._combi } ; select 0 ; selrate { self ._interval } ; "
263+ f"pid { self .port } 0 0 s1 1 0 0.003 0.01 0 100; "
262264 f"set pulse { speed } 0.0 { seconds } 0\r " )
263265 self ._write (cmd )
264266 with self ._hat .pulsecond [self .port ]:
@@ -308,7 +310,8 @@ def start(self, speed=None):
308310 raise MotorError ("Invalid Speed" )
309311 cmd = f"port { self .port } ; set { speed } \r "
310312 if self ._runmode == MotorRunmode .NONE :
311- cmd = (f"port { self .port } ; combi 0 { self ._combi } ; select 0 ; pid { self .port } 0 0 s1 1 0 0.003 0.01 0 100; "
313+ cmd = (f"port { self .port } ; combi 0 { self ._combi } ; select 0 ; selrate { self ._interval } ; "
314+ f"pid { self .port } 0 0 s1 1 0 0.003 0.01 0 100; "
312315 f"set { speed } \r " )
313316 self ._runmode = MotorRunmode .FREE
314317 self ._currentspeed = speed
0 commit comments