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 new id call #19

Closed
wants to merge 2 commits into from
Closed

add new id call #19

wants to merge 2 commits into from

Conversation

budzianowski
Copy link
Contributor

No description provided.

Comment on lines +674 to +691
for id in motor_ids {
if id == motor_id {
let mut pack = CanPack {
ex_id: ExId {
id: motor_id,
data: 0,
mode: CanComMode::MotorId,
res: 0,
},
len: 8,
data: vec![0; 8],
};

pack.ex_id.data = ((new_motor_id as u16) << 8) | (motor_id as u16);
self.send_command(&pack);
break;
}
};
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can't we just get the motor by the index in the dictionary?

data: vec![0; 8],
};

pack.ex_id.data = ((new_motor_id as u16) << 8) | (motor_id as u16);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this seems wrong - shouldn't it just be new_motor_id (not motor_id), also, i think we should be able to do something like new_motor_id.to_le_bytes()

@codekansas
Copy link
Member

deleted upstream code

@codekansas codekansas closed this Oct 28, 2024
@codekansas codekansas deleted the add_new_id branch October 28, 2024 18:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants