mirror of
https://github.com/undera/pylgbst.git
synced 2020-11-18 19:37:26 -08:00
peripheral:Motor: fixed _speed_abs for END_STATE_BRAKE (#48)
This commit is contained in:
parent
dff312534f
commit
d1019ac9f4
@ -254,10 +254,11 @@ class Motor(Peripheral):
|
|||||||
END_STATE_FLOAT = 0
|
END_STATE_FLOAT = 0
|
||||||
|
|
||||||
def _speed_abs(self, relative):
|
def _speed_abs(self, relative):
|
||||||
if relative is None:
|
if relative == Motor.END_STATE_BRAKE \
|
||||||
|
or relative == Motor.END_STATE_HOLD:
|
||||||
# special value for BRAKE
|
# special value for BRAKE
|
||||||
# https://lego.github.io/lego-ble-wireless-protocol-docs/index.html#output-sub-command-startpower-power
|
# https://lego.github.io/lego-ble-wireless-protocol-docs/index.html#output-sub-command-startpower-power
|
||||||
return 127
|
return relative
|
||||||
|
|
||||||
if relative < -1:
|
if relative < -1:
|
||||||
log.warning("Speed cannot be less than -1")
|
log.warning("Speed cannot be less than -1")
|
||||||
|
Loading…
x
Reference in New Issue
Block a user