-
Notifications
You must be signed in to change notification settings - Fork 92
Added real32 (Beckhoff float) and real64 (Beckhoff double) #132
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
Open
JensVanhooydonck
wants to merge
4
commits into
ICube-Robotics:main
Choose a base branch
from
JensVanhooydonck:real32-float
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
7dc0ccf
Added real32 (Beckhoff float) https://infosys.beckhoff.com/english.ph…
JensVanhooydonck e554af2
Changed EC_READ_REAL and EC_WRITE_REAL to bitcasting. EC_READ_REAL an…
JensVanhooydonck 2a5d776
Working SDO + altered casting of floats + added doubles
JensVanhooydonck d80460f
Removed unused code part SDO
JensVanhooydonck File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -43,11 +43,11 @@ class SdoConfigEntry | |||||
| EC_WRITE_U16(buffer, static_cast<uint16_t>(data)); | ||||||
| } else if (data_type == "int16") { | ||||||
| EC_WRITE_S16(buffer, static_cast<int16_t>(data)); | ||||||
| } else if (data_type == "uint32") { | ||||||
| } else if (data_type == "uint32" || data_type == "real32" || data_type == "float") { | ||||||
| EC_WRITE_U32(buffer, static_cast<uint32_t>(data)); | ||||||
| } else if (data_type == "int32") { | ||||||
| EC_WRITE_S32(buffer, static_cast<int32_t>(data)); | ||||||
| } else if (data_type == "uint64") { | ||||||
| } else if (data_type == "uint64" || data_type == "real64" || data_type == "double") { | ||||||
| EC_WRITE_U64(buffer, static_cast<uint64_t>(data)); | ||||||
| } else if (data_type == "int64") { | ||||||
| EC_WRITE_S64(buffer, static_cast<int64_t>(data)); | ||||||
|
|
@@ -79,7 +79,15 @@ class SdoConfigEntry | |||||
| } | ||||||
| // value | ||||||
| if (sdo_config["value"]) { | ||||||
| data = sdo_config["value"].as<int>(); | ||||||
| if (data_type == "float" || data_type == "real32") { | ||||||
| float floatvalue = sdo_config["value"].as<float>(); | ||||||
| data = *(int *)&floatvalue; | ||||||
| } else if (data_type == "double" || data_type == "real64") { | ||||||
| float doublevalue = sdo_config["value"].as<double>(); | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
| data = *(int *)&doublevalue; | ||||||
| } else { | ||||||
| data = sdo_config["value"].as<int>(); | ||||||
| } | ||||||
| } else { | ||||||
| std::cerr << "sdo " << index << ": missing sdo value" << std::endl; | ||||||
| return false; | ||||||
|
|
@@ -105,9 +113,9 @@ class SdoConfigEntry | |||||
| return 1; | ||||||
| } else if (type == "int16" || type == "uint16") { | ||||||
| return 2; | ||||||
| } else if (type == "int32" || type == "uint32") { | ||||||
| } else if (type == "int32" || type == "uint32" || type == "float" || type == "real32") { | ||||||
| return 4; | ||||||
| } else if (type == "int64" || type == "uint64") { | ||||||
| } else if (type == "int64" || type == "uint64" || type == "double" || type == "real64") { | ||||||
| return 8; | ||||||
| } | ||||||
| } | ||||||
|
|
||||||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.