We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 8996cdb commit 44c0676Copy full SHA for 44c0676
ros2_socketcan/src/socket_can_id.cpp
@@ -136,8 +136,13 @@ CanId & CanId::identifier(const IdT id)
136
constexpr auto MAX_STANDARD = 0x07EFU;
137
static_assert(MAX_EXTENDED <= EXTENDED_ID_MASK, "Max extended id value is wrong");
138
static_assert(MAX_STANDARD <= STANDARD_ID_MASK, "Max extended id value is wrong");
139
- const auto max_id = is_extended() ? MAX_EXTENDED : MAX_STANDARD;
140
- if (max_id < id) {
+ auto max_id = MAX_STANDARD;
+ auto unmasked_id = id;
141
+ if (is_extended()) {
142
+ max_id = MAX_EXTENDED;
143
+ unmasked_id = id & ~(EXTENDED_MASK);
144
+ }
145
+ if (max_id < unmasked_id) {
146
throw std::domain_error{"CanId would be truncated!"};
147
}
148
// Clear and set
0 commit comments