Open AndyThirtover opened 5 years ago
Here's how I got it to work:
def set_speed(speedval):
regsettings=OrderedDict((
('A1', 12000),
('V1', 4000),
('AMAX', 20000),
('VMAX', speedval),
('DMAX', 9000),
('D1', 600)
))
regactions='WWWWWW'
assert len(regsettings)==len(regactions)
currently=mot.md.readWriteMultiple(regsettings,regactions)
Once again crude - but I shall think about it some more.
Regards
Andy
Consider:
print("Set speed to 40") mot.updateSettings({'maxrpm':40}) time.sleep(1) # in case it takes time to make a difference print("Goto 10") mot.async_goto(10) while mot.are_we_there_yet() != 0: time.sleep(0.05)
print("STOPPED - SPEED CHANGE ON THE FLY") print("Set speed to 80") mot.updateSettings({'maxrpm':80}) print("Goto 50") mot.async_goto(50)
time.sleep(5) print("Set speed to 160") mot.updateSettings({'maxrpm':160})
In the first case the speed change is safe. In the second case the speed change causes the motor to squeal but not move. There is a little movement after about 0.5 second.
It is possible that the chip has to do a pile of calculations when speed is changed and during this time it does not service the motor.
It is more probable that I've misunderstood what updateSettings actually does.
I expected to see something like: self.md.readWriteMultiple(regsettings,regactions) Where VMAX would get written to the register.
Regards
Andy