Skip to content

Commit efe9a73

Browse files
authored
brickpi(3) raise exception if LargeMotor not used for a motor (ev3dev#549)
* brickpi(3) raise exception if LargeMotor not used for a motor * brickpi(3) raise exception if LargeMotor not used for a motor
1 parent ae97053 commit efe9a73

2 files changed

Lines changed: 4 additions & 0 deletions

File tree

‎debian/changelog‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
python-ev3dev2 (2.0.0~beta3) stable; urgency=medium
22

3+
* brickpi(3) raise exception if LargeMotor not used for a motor
34
* MoveJoyStick should use SpeedPercent
45
* renamed GyroSensor rate_and_angle to angle_and_rate
56

‎ev3dev2/motor.py‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -311,6 +311,9 @@ class Motor(Device):
311311

312312
def __init__(self, address=None, name_pattern=SYSTEM_DEVICE_NAME_CONVENTION, name_exact=False, **kwargs):
313313

314+
if platform in ('brickpi', 'brickpi3') and not isinstance(self, LargeMotor):
315+
raise Exception("{} is unaware of different motor types, use LargeMotor instead".format(platform))
316+
314317
if address is not None:
315318
kwargs['address'] = address
316319
super(Motor, self).__init__(self.SYSTEM_CLASS_NAME, name_pattern, name_exact, **kwargs)

0 commit comments

Comments
 (0)