File tree Expand file tree Collapse file tree 3 files changed +8
-2
lines changed
ethercat_generic_plugins/ethercat_generic_slave/src
ethercat_interface/include/ethercat_interface Expand file tree Collapse file tree 3 files changed +8
-2
lines changed Original file line number Diff line number Diff line change @@ -25,7 +25,7 @@ size_t type2bytes(std::string type)
25
25
return 1 ;
26
26
} else if (type == " int16" || type == " uint16" ) {
27
27
return 2 ;
28
- } else if (type == " int32" || type == " uint32" ) {
28
+ } else if (type == " int32" || type == " uint32" || type == " float " || type == " real32 " ) {
29
29
return 4 ;
30
30
} else if (type == " int64" || type == " uint64" ) {
31
31
return 8 ;
Original file line number Diff line number Diff line change @@ -65,6 +65,8 @@ class EcPdoChannelManager
65
65
last_value = static_cast <double >(EC_READ_U64 (domain_address));
66
66
} else if (data_type == " int64" ) {
67
67
last_value = static_cast <double >(EC_READ_S64 (domain_address));
68
+ } else if (data_type == " real32" || data_type == " float" ) {
69
+ last_value = static_cast <double >(EC_READ_REAL (domain_address));
68
70
} else if (data_type == " bool" ) {
69
71
last_value = (EC_READ_U8 (domain_address) & data_mask) ? 1 : 0 ;
70
72
} else {
@@ -92,6 +94,8 @@ class EcPdoChannelManager
92
94
EC_WRITE_U64 (domain_address, static_cast <uint64_t >(value));
93
95
} else if (data_type == " int64" ) {
94
96
EC_WRITE_S64 (domain_address, static_cast <int64_t >(value));
97
+ } else if (data_type == " real32" || data_type == " float" ) {
98
+ EC_WRITE_REAL (domain_address, static_cast <float >(value));
95
99
} else {
96
100
buffer_ = EC_READ_U8 (domain_address);
97
101
if (popcount (data_mask) == 1 ) {
Original file line number Diff line number Diff line change @@ -51,6 +51,8 @@ class SdoConfigEntry
51
51
EC_WRITE_U64 (buffer, static_cast <uint64_t >(data));
52
52
} else if (data_type == " int64" ) {
53
53
EC_WRITE_S64 (buffer, static_cast <int64_t >(data));
54
+ } else if (data_type == " real32" || data_type == " float" ) {
55
+ EC_WRITE_REAL (buffer, static_cast <float >(data));
54
56
}
55
57
}
56
58
@@ -105,7 +107,7 @@ class SdoConfigEntry
105
107
return 1 ;
106
108
} else if (type == " int16" || type == " uint16" ) {
107
109
return 2 ;
108
- } else if (type == " int32" || type == " uint32" ) {
110
+ } else if (type == " int32" || type == " uint32" || type == " float " || type == " real32 " ) {
109
111
return 4 ;
110
112
} else if (type == " int64" || type == " uint64" ) {
111
113
return 8 ;
You can’t perform that action at this time.
0 commit comments