Skip to content

Conversation

@munnik
Copy link

@munnik munnik commented Oct 4, 2024

With this serial library, we don't have any issues with the even parity anymore. Also, this serial library is still maintained.

Options can be passed to the read and write methods to set the UnitID, Endianess and WordOrder. This is especially helpfull when the client is shared between multiple goroutines that each do a request to a different modbus slave.

@simonvetter
Copy link
Owner

Hi there,

thanks for the PR. I haven't had much issues with parity so far, so I'd need to be able to troubleshoot that more in detail.

This is especially helpfull when the client is shared between multiple goroutines that each do a request to a different modbus slave.

This is usually really easily solved by having the goroutines in question sharing a mutex and doing something like this:

mutex.Lock()
client.SetUnitId(...)
client.SetEncoding(...)
err = client.WriteRegister(...)
mutex.Unlock()

Since they're already sharing a client, sharing an additional mutex shouldn't require too much boilerplate.

Would that work for you ? I'd like to avoid dealing with that additional complexity at the client level, if possible.

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

Successfully merging this pull request may close these issues.

2 participants