Skip to content

Commit

Permalink
fix(can): parse the binding flag and pass to sensor move message (#791)
Browse files Browse the repository at this point in the history
* fix(can): parse the binding flag and pass to sensor move message

* format
  • Loading branch information
ryanthecoder authored Jul 11, 2024
1 parent a2c4b6c commit 89e20a8
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
4 changes: 4 additions & 0 deletions include/can/core/messages.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -1744,6 +1744,7 @@ struct AddSensorMoveRequest : BaseMessage<MessageId::add_sensor_move_request> {
uint8_t request_stop_condition;
can::ids::SensorId sensor_id{};
can::ids::SensorType sensor_type{};
uint8_t binding_flags;

template <bit_utils::ByteIterator Input, typename Limit>
static auto parse(Input body, Limit limit) -> AddSensorMoveRequest {
Expand All @@ -1756,6 +1757,7 @@ struct AddSensorMoveRequest : BaseMessage<MessageId::add_sensor_move_request> {
uint32_t msg_ind = 0;
uint8_t sensor_id = 0;
uint8_t sensor_type = 0;
uint8_t binding_flags = 0;

body = bit_utils::bytes_to_int(body, limit, msg_ind);
body = bit_utils::bytes_to_int(body, limit, group_id);
Expand All @@ -1766,6 +1768,7 @@ struct AddSensorMoveRequest : BaseMessage<MessageId::add_sensor_move_request> {
body = bit_utils::bytes_to_int(body, limit, request_stop_condition);
body = bit_utils::bytes_to_int(body, limit, sensor_id);
body = bit_utils::bytes_to_int(body, limit, sensor_type);
body = bit_utils::bytes_to_int(body, limit, binding_flags);
return AddSensorMoveRequest{
.message_index = msg_ind,
.group_id = group_id,
Expand All @@ -1776,6 +1779,7 @@ struct AddSensorMoveRequest : BaseMessage<MessageId::add_sensor_move_request> {
.request_stop_condition = request_stop_condition,
.sensor_id = static_cast<can::ids::SensorId>(sensor_id),
.sensor_type = static_cast<can::ids::SensorType>(sensor_type),
.binding_flags = binding_flags,
};
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,8 @@ class MotionController {
0,
hardware.get_usage_eeprom_config().get_distance_key(),
can_msg.sensor_id,
can_msg.sensor_type};
can_msg.sensor_type,
can_msg.binding_flags};
if (!enabled) {
enable_motor();
}
Expand All @@ -102,7 +103,8 @@ class MotionController {
.stop_condition = can_msg.request_stop_condition,
.usage_key = hardware.get_usage_eeprom_config().get_distance_key(),
.sensor_id = can::ids::SensorId::UNUSED,
.sensor_type = can::ids::SensorType::UNUSED};
.sensor_type = can::ids::SensorType::UNUSED,
.binding_flags = 0};
if (!enabled) {
enable_motor();
}
Expand All @@ -123,7 +125,8 @@ class MotionController {
static_cast<uint8_t>(MoveStopCondition::limit_switch),
.usage_key = hardware.get_usage_eeprom_config().get_distance_key(),
.sensor_id = can::ids::SensorId::UNUSED,
.sensor_type = can::ids::SensorType::UNUSED};
.sensor_type = can::ids::SensorType::UNUSED,
.binding_flags = 0};
if (!enabled) {
enable_motor();
}
Expand Down

0 comments on commit 89e20a8

Please sign in to comment.