diff --git a/source/Motor.m b/source/Motor.m index bfc6abf672fef26fdefd85db776b899658cb2e84..ba7e78d12fc6fe0c4b30e9f77417b443265f95a3 100755 --- a/source/Motor.m +++ b/source/Motor.m @@ -599,19 +599,23 @@ classdef Motor < MaskedHandle & dynamicprops function set.speedRegulation(motor, speedRegulation) if ~isBool(speedRegulation) error('Motor::set.speedRegulation: Given parameter is not a bool.'); - elseif motor.connectedToBrick && motor.physicalMotorConnected && ... - motor.currentSpeed ~= 0 - error(['Motor::set.speedRegulation: Cannot change speed regulation while ', ... - 'is motor is moving.']); +% elseif motor.connectedToBrick && motor.physicalMotorConnected +% pause(0.5); +% if motor.currentSpeed ~= 0 +% error(['Motor::set.speedRegulation: Cannot change speed regulation while ', ... +% 'is motor is moving.']); +% end end - if ~isempty(motor.speedRegulation) && speedRegulation ~= motor.speedRegulation + speedRegulation = str2bool(speedRegulation); + + if ~isempty(motor.speedRegulation) && (speedRegulation ~= motor.speedRegulation) if motor.sendPowerOnSet motor.sendOnStart = bitset(motor.sendOnStart, SendOnStart.Power, 1); end end - motor.speedRegulation = str2bool(speedRegulation); + motor.speedRegulation = speedRegulation; end function set.smoothStart(motor, steps)