Skip to content

Commit

Permalink
Use serial_for_url for opening serial port
Browse files Browse the repository at this point in the history
With this change, you can fill in, for example, `socket://localhost:7778` as the RS485 port in config.json. This opens up some possibilities:
- You have an RS485 to tcp converter near your TWC, and run TWCManager somewhere else, only connected with TCP/IP
  I would only recommend this on a secure LAN, since you have no autentication/authorization
- For testing TWCManager, you can run 2 instances of TWCManager, one as a master and one as a slave. I use this for example with the help of socat:
    `socat TCP-LISTEN:7777,reuseaddr TCP-LISTEN:7778,reuseaddr` to open 2 listening ports 7778 and 7777 that are connected to one another.
    Then, it is just a matter of having 2 TWCManagers, where you connect to 7777 first and then to 7778 with the second instance.

If you use a normal device, like `/dev/ttyUSB0` as port, this works exactly as before

Related to dracoventions#4
  • Loading branch information
tjikkun committed Jan 30, 2021
1 parent 5a7c7f2 commit 93f17cd
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/TWCManager/Interface/RS485.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ def __init__(self, master):
self.port = porta

# Connect to serial port
self.ser = self.serial.Serial(self.port, self.baud, timeout=0)
self.ser = self.serial.serial_for_url(self.port, self.baud, timeout=0)

def close(self):
# Close the serial interface
Expand Down

0 comments on commit 93f17cd

Please sign in to comment.