From 82d469f0f9fcd38b110d5757528f0468cf0656c1 Mon Sep 17 00:00:00 2001 From: JeromeGalan Date: Mon, 22 Aug 2022 16:00:01 +0200 Subject: [PATCH] Remove unused baudrate --- pyluos/device.py | 11 ----------- pyluos/services/void.py | 32 -------------------------------- 2 files changed, 43 deletions(-) diff --git a/pyluos/device.py b/pyluos/device.py index 722f8ea..a548c76 100644 --- a/pyluos/device.py +++ b/pyluos/device.py @@ -124,7 +124,6 @@ def __init__(self, host, self._poll_bg = threading.Thread(target=self._poll_and_up) self._poll_bg.daemon = True self._poll_bg.start() - self._baudrate = 1000000 def close(self): self._running = False @@ -137,16 +136,6 @@ def close(self): print("Warning: device closed on timeout, background thread is still running.") self._io.close() - @property - def baudrate(self): - return self._baudrate - - @baudrate.setter - def baudrate(self, baudrate): - self._send({'baudrate': baudrate}) - self._baudrate = baudrate - time.sleep(0.01) - def pause(self): self._pause = True time.sleep(1) diff --git a/pyluos/services/void.py b/pyluos/services/void.py index e351b5e..fa64cb5 100644 --- a/pyluos/services/void.py +++ b/pyluos/services/void.py @@ -5,7 +5,6 @@ class Void(Service): def __init__(self, id, alias, device): Service.__init__(self, 'Void', id, alias, device) - self._baudrate = 1000000 def _update(self, new_state): Service._update(self, new_state) @@ -14,28 +13,6 @@ def dxl_detect(self): self._push_value('reinit', 0) print ("To get new detected Dxl motors usable on pyluos you should recreate your Pyluos object.") - @property - def baudrate(self): - return self._baudrate - - - def _set_baudrate(self, baud): - new_val = [4, baud] - self._push_value('register', new_val) - self._baudrate = baud - - @baudrate.setter - def baudrate(self, baud): - values = [9600, 19200, 57600, 115200, 200000, 250000, 400000, 500000, 1000000] - if baud in values : - self._set_baudrate(baud) - print ("If you try to recover a motor you should start 'dxl_detect()' command and recreate your Pyluos object.") - else : - err = "Possible values are :\n" - for val in values : - err = err + "\t- " + str(val) + "\n" - raise ValueError(err) - def _factory_reset(self): new_val = [0xFF, 0] self._push_value('register', new_val) @@ -46,15 +23,6 @@ def factory_reset(self): print("you should start 'dxl_detect()' command and recreate your Pyluos object.") def retrieve_dxl(self): - values = [9600, 19200, 57600, 115200, 200000, 250000, 400000, 500000, 1000000] - for baud in values : - self._set_baudrate(baud) - time.sleep(0.1) - #self._factory_reset() - #time.sleep(0.1) - #self._set_baudrate(57600) - #time.sleep(0.5) - self._set_baudrate(1000000) time.sleep(0.5) self.dxl_detect() print("Motor reseted => baudrate : 1000000, ID : same")