Fix angle
This commit is contained in:
parent
3e35fd99a1
commit
2e88044e07
2 changed files with 2 additions and 4 deletions
|
@ -133,8 +133,7 @@ void send_can_with_id_crc(uint8_t id, uint8_t message_type, const T* data) {
|
||||||
// Copy message ID
|
// Copy message ID
|
||||||
memcpy(crc_data, (uint8_t*)&msg_l.id, sizeof(T));
|
memcpy(crc_data, (uint8_t*)&msg_l.id, sizeof(T));
|
||||||
// Copy all data bytes
|
// Copy all data bytes
|
||||||
for(int i = 1;i < CAN_MSG_MAX_LEN;i++)
|
memcpy(crc_data + 1, msg_l.buf, 6);
|
||||||
memcpy(crc_data + i,(uint8_t*)&msg_l.buf[i - 1], sizeof(T)); //As byte variable
|
|
||||||
// Calculate CRC
|
// Calculate CRC
|
||||||
uint16_t crc_value = validate_crc16(crc_data, CAN_MSG_MAX_LEN);
|
uint16_t crc_value = validate_crc16(crc_data, CAN_MSG_MAX_LEN);
|
||||||
|
|
||||||
|
@ -306,7 +305,7 @@ void listen_can(const CAN_message_t &msg) {
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case MOTOR_ANGLE:
|
case MOTOR_ANGLE:
|
||||||
memcpy(&motor_control_inputs.target_angle, &CAN_inMsg.buf[1],
|
memcpy(&motor_control_inputs.target_angle, &msg.buf[1],
|
||||||
sizeof(motor_control_inputs.target_angle));
|
sizeof(motor_control_inputs.target_angle));
|
||||||
setup_angle(motor_control_inputs.target_angle);
|
setup_angle(motor_control_inputs.target_angle);
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -62,6 +62,5 @@ def main():
|
||||||
send_target_angle(bus, args.angle)
|
send_target_angle(bus, args.angle)
|
||||||
|
|
||||||
bus.shutdown()
|
bus.shutdown()
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
main()
|
main()
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue