Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Setting a new baudrate with SetPort(...) doesn't work #18

Open
gitjsdr26 opened this issue Feb 11, 2020 · 6 comments
Open

Setting a new baudrate with SetPort(...) doesn't work #18

gitjsdr26 opened this issue Feb 11, 2020 · 6 comments

Comments

@gitjsdr26
Copy link

gitjsdr26 commented Feb 11, 2020

Hi All,

I tried to set a new baudrate with SetPort() methode, but it doesn't work.
Indeed, SetPort() test if a change occured for portName only, but not the other parameters.
I suggest the following changes

public void SetPort(string portName, int baudRate = 115200, StopBits stopBits = StopBits.One, Parity parity = Parity.None, DataBits dataBits = DataBits.Eight)
{
	if (_portName != portName || _baudRate != baudRate || stopBits != _stopBits || parity != _parity || dataBits != _dataBits)
	{
		// set to error so that the connection watcher will reconnect
		// using the new port
		gotReadWriteError = true;
		logger.Trace("Port parameter changed (port name / baudrate / stopbits / parity / databits) = " + portName + " / " + baudRate + " / " + stopBits + " / " + parity + " / " + dataBits);
	}
	_portName = portName;
	_baudRate = baudRate;
	_stopBits = stopBits;
	_parity = parity;
	_dataBits = dataBits;
}
@gitjsdr26
Copy link
Author

Hi,
Is this repository still alive ?

@genemars
Copy link
Member

genemars commented Apr 2, 2020

Hi @gitjsdr26, make a pull request with this fix and I will merge it and publish a new release.
Also make sure that the code does not break backward compatibility because I have no time to test it in this very moment.

@gitjsdr26
Copy link
Author

@genemars , ok I'll do it.
I've been testing these changes for 2 monthes on my application and it works well.
Thank you
Regards

@genemars
Copy link
Member

genemars commented Apr 3, 2020

can you already make a pull-request for this?

@gitjsdr26
Copy link
Author

Yes, within 6 hours.

@gitjsdr26
Copy link
Author

It was done in #21

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants