Open skylin008 opened 1 year ago
Same thing, can't find what cause the problem nor fix it so far.
My code for Pyboard v1.0:
from pyb import Pin
Y1 = pyb.Pin(pyb.Pin.board.Y1, pyb.Pin.OUT)
Y2 = pyb.Pin(pyb.Pin.board.Y2, pyb.Pin.IN)
# self defined package
from umodbus.serial import Serial as RTUMaster
rtu_pins = (Pin('Y1'), Pin('Y2'))
host = RTUMaster(
pins = rtu_pins,
uart_id = 6,
baudrate = 9600,
)
Error message:
MPY: sync filesystems
MPY: soft reboot
Traceback (most recent call last):
File "<stdin>", line 13, in <module>
File "umodbus/serial.py", line 108, in __init__
TypeError: extra keyword arguments given
Description
Thank you shared this impressive project, I used the version:2.3.7 umodbus code, when run this code, the error shows: TypeError:extra keyword arguments given. Follow as code: `# modbus master driver for lidar
6 pieces lidar for system, address from 1 to 6
from right to left side, count closewize
system package
from machine import Pin import logging import gc from InitConfig import config import uasyncio as asyncio
log = logging.MiniLog("RtuMaster", level = logging.DEBUG) DEBUG = config.get('DEBUG', False)
MasterUartId = config.get("UART_LIDAR")
self defined package
from umodbus.serial import Serial as RTUMaster from umodbus import version
gc.collect()
version = '1.0' author = 'skylin'
register_definitions = { "HREGS":{ # read hold registers "slave_address":{ "1": 1, "2": 2, "3": 3, "4": 4, "5": 5, "6": 6 }, "register_address": 0x94, "length": 0x02, }, }
class Frame(object): def init(self,data = None): """ Data struct: """
if data is None: self.data = bytearray() else:
self.data = bytearray(data)
class FrameBuffer(object): def init(self, size): """ A FrameBuffer is used to buffer frames received from the Network over the active Bus.The FrameBuffer is designed as a FIFO and is useful to overcome the limited storing capability """ self._size = size self.data = [[memoryview(bytearray(6))] for in range(size)] self._index_write = 0 self._index_read = 0 self._null_sink = [0, 0, 0, 0] self._count = 0
class Master(object): def init(self, uart_id, baudrate = 115200, ctrlPin = None, fbSize = 128): self.rtu_pins = (Pin('A2'), Pin('A3')) self.uart_id = uart_id self.ctrlPin = ctrlPin self.baudrate = baudrate
if name == 'main':
`
Reproduction steps
1. 2. 3. ...
MicroPython version
V1.22
MicroPython board
pyboard
MicroPython Modbus version
Relevant log output
User code
Additional informations
No response