Fix angle

This commit is contained in:
Valentin Dabstep 2025-05-14 20:03:10 +03:00
parent 3e35fd99a1
commit 2e88044e07
2 changed files with 2 additions and 4 deletions

View file

@ -133,8 +133,7 @@ void send_can_with_id_crc(uint8_t id, uint8_t message_type, const T* data) {
// Copy message ID
memcpy(crc_data, (uint8_t*)&msg_l.id, sizeof(T));
// Copy all data bytes
for(int i = 1;i < CAN_MSG_MAX_LEN;i++)
memcpy(crc_data + i,(uint8_t*)&msg_l.buf[i - 1], sizeof(T)); //As byte variable
memcpy(crc_data + 1, msg_l.buf, 6);
// Calculate CRC
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;
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));
setup_angle(motor_control_inputs.target_angle);
break;

View file

@ -62,6 +62,5 @@ def main():
send_target_angle(bus, args.angle)
bus.shutdown()
if __name__ == '__main__':
main()