Skip to content

Commit

Permalink
remove hardcoded uart_id=1 from ModbusRTU in serial.py, see #7 and #43
Browse files Browse the repository at this point in the history
  • Loading branch information
brainelectronics committed Dec 30, 2022
1 parent ebb8258 commit a934bda
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions umodbus/serial.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@ class ModbusRTU(Modbus):
:type pins: List[int, int]
:param ctrl_pin: The control pin
:type ctrl_pin: int
:param uart_id: The ID of the used UART
:type uart_id: int
"""
def __init__(self,
addr: int,
Expand All @@ -52,10 +54,11 @@ def __init__(self,
stop_bits: int = 1,
parity: Optional[int] = None,
pins: List[int, int] = None,
ctrl_pin: int = None):
ctrl_pin: int = None,
uart_id: int = 1):
super().__init__(
# set itf to Serial object, addr_list to [addr]
Serial(uart_id=1,
Serial(uart_id=uart_id,
baudrate=baudrate,
data_bits=data_bits,
stop_bits=stop_bits,
Expand Down

0 comments on commit a934bda

Please sign in to comment.