Skip to content

Commit 00a2678

Browse files
committed
Per port power limiting
1 parent 1ac33cf commit 00a2678

File tree

4 files changed

+6
-6
lines changed

4 files changed

+6
-6
lines changed

buildhat/color.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -210,4 +210,4 @@ def wait_for_new_color(self):
210210

211211
def on(self):
212212
"""Turn on the sensor and LED"""
213-
self._write(f"port {self.port} ; plimit 1 ; set -1\r")
213+
self.reverse()

buildhat/colordistance.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -199,4 +199,4 @@ def wait_for_new_color(self):
199199

200200
def on(self):
201201
"""Turn on the sensor and LED"""
202-
self._write(f"port {self.port} ; plimit 1 ; set -1\r")
202+
self.reverse()

buildhat/devices.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,7 @@ def isconnected(self):
188188

189189
def reverse(self):
190190
"""Reverse polarity"""
191-
self._write(f"port {self.port} ; plimit 1 ; set -1\r")
191+
self._write(f"port {self.port} ; port_plimit 1 ; set -1\r")
192192

193193
def get(self):
194194
"""Extract information from device
@@ -253,7 +253,7 @@ def select(self):
253253

254254
def on(self):
255255
"""Turn on sensor"""
256-
self._write(f"port {self.port} ; plimit 1 ; on\r")
256+
self._write(f"port {self.port} ; port_plimit 1 ; on\r")
257257

258258
def off(self):
259259
"""Turn off sensor"""

buildhat/motors.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ def plimit(self, plimit):
7171
"""
7272
if not (plimit >= 0 and plimit <= 1):
7373
raise MotorError("plimit should be 0 to 1")
74-
self._write(f"port {self.port} ; plimit {plimit}\r")
74+
self._write(f"port {self.port} ; port_plimit {plimit}\r")
7575

7676
def bias(self, bias):
7777
"""Bias motor
@@ -413,7 +413,7 @@ def plimit(self, plimit):
413413
"""
414414
if not (plimit >= 0 and plimit <= 1):
415415
raise MotorError("plimit should be 0 to 1")
416-
self._write(f"port {self.port} ; plimit {plimit}\r")
416+
self._write(f"port {self.port} ; port_plimit {plimit}\r")
417417

418418
def bias(self, bias):
419419
"""Bias motor

0 commit comments

Comments
 (0)