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

Add value <-> registers converter helpers. #1413

Merged
merged 5 commits into from
Mar 9, 2023
Merged

Add value <-> registers converter helpers. #1413

merged 5 commits into from
Mar 9, 2023

Conversation

janiversen
Copy link
Collaborator

@janiversen janiversen commented Mar 7, 2023

One of the more frequent problems, "I am trying to read/write a float register", this is of course not 1 register but 2 or 4 registers.

This PR add helpers functions to easily convert:

  • int to registers (INT16, INT32, INT64)
  • registers to int
  • float to registers (FLOAT32, FLOAT64)
  • registers to float
  • string to registers
  • registers to string

@janiversen janiversen merged commit 35507c6 into dev Mar 9, 2023
@janiversen janiversen deleted the convert_values branch March 9, 2023 14:30
pymodbus/client/mixin.py Show resolved Hide resolved
pymodbus/client/mixin.py Show resolved Hide resolved
@alexrudd2 alexrudd2 restored the convert_values branch March 9, 2023 17:08
@janiversen janiversen deleted the convert_values branch March 9, 2023 17:19
@alexrudd2
Copy link
Collaborator

I had undeleted the branch to get dfc36b2, but no longer need it. :)

@janiversen
Copy link
Collaborator Author

you are living a dangerous life :-)

You restore branch "convert_values" and tell me you no longer need it, which I just deleted about a minute ago, but your new PR uses "convert-values"....not much room for errors. Luckily I was awake and not on auto-pilot.

Not a problem, just the highlight of my day.

@alexrudd2
Copy link
Collaborator

you are living a dangerous life :-)

You restore branch "convert_values" and tell me you no longer need it, which I just deleted about a minute ago, but your new PR uses "convert-values"....not much room for errors. Luckily I was awake and not on auto-pilot.

Not a problem, just the highlight of my day.

Haha, for danger I also use system Python and not a virtual environment. 😱

Actually, I was on my way to delete convert_values again when I noticed you deleted it 3 minutes before me...

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 21, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants