EasyModbusTCP.NET icon indicating copy to clipboard operation
EasyModbusTCP.NET copied to clipboard

Serial Port Parity

Open wecoxSand opened this issue 3 years ago • 1 comments

Using an empty constructor to generate a ModbusClient, then setting its properties. Setting ModbusClient.Parity = Parity.None; before calling .Connect() results in the internal serialport still creating with Parity.Even

wecoxSand avatar Jan 21 '22 17:01 wecoxSand

It all boils down to this deprecable getter/setter

        public Parity Parity
        {
            get
            {
                if (serialport != null)
                    return parity;
                else
                    return Parity.Even;
            }
            set
            {
                if (serialport != null)
                    parity = value;
            }
        }

Definining a property with the same name of an enum is a terrible idea. Also Parity.Even is returned when serialport is null.

Padanian avatar Jan 25 '22 20:01 Padanian