Skip to content

Commit

Permalink
Remove unused baudrate
Browse files Browse the repository at this point in the history
  • Loading branch information
JeromeGalan committed Aug 22, 2022
1 parent 3071428 commit 82d469f
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 43 deletions.
11 changes: 0 additions & 11 deletions pyluos/device.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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)
Expand Down
32 changes: 0 additions & 32 deletions pyluos/services/void.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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)
Expand All @@ -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")
Expand Down

0 comments on commit 82d469f

Please sign in to comment.