Skip to content
This repository has been archived by the owner on Oct 2, 2023. It is now read-only.

bug fixes #29

Merged
merged 1 commit into from
Feb 25, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Applications/cvc_can.c
Original file line number Diff line number Diff line change
Expand Up @@ -302,7 +302,7 @@ void CAN_Send(queue_msg_t Tx_msg)
}

/**
* @brief standard parser for unpacking CAN functions into CAN_inputs table (big endian to big endian)
* @brief standard parser for unpacking CAN functions into CAN_inputs table (big endian messages)
* @param q_msg: incoming CAN message
* @param CAN_msg: reference message from CAN_dict w/ message metadata
*/
Expand All @@ -318,7 +318,7 @@ static void CAN_parser_std(queue_msg_t q_msg, uint8_t CAN_idx)
/* iterate over all bytes of input */
for (int j = 0; j < input.size; j++)
{
result = result << 8 | (uint32_t) (q_msg.data._8[input.start_byte + j] << input.start_bit);
result = (result << 8) | (uint32_t) (q_msg.data._8[input.start_byte + j] << input.start_bit);
}


Expand Down
12 changes: 6 additions & 6 deletions Applications/pm100.c
Original file line number Diff line number Diff line change
Expand Up @@ -122,15 +122,15 @@ void parameter_read_command_2(uint16_t parameter_address)
*/
void command_msg_1(uint16_t torque_command, uint16_t speed_command, uint8_t direction_command, uint8_t inverter_enable, uint8_t inverter_discharge, uint8_t speed_mode_enable, uint16_t commanded_torque_limit){
pm100_command_msg_1.data._8[0] = (torque_command & 0x00FF);
pm100_command_msg_1.data._8[1] = (torque_command & 0xFF00 >> 8);
pm100_command_msg_1.data._8[1] = ((torque_command & 0xFF00) >> 8);
pm100_command_msg_1.data._8[2] = (speed_command & 0x00FF);
pm100_command_msg_1.data._8[3] = (speed_command & 0xFF00 >> 8);
pm100_command_msg_1.data._8[3] = ((speed_command & 0xFF00) >> 8);
pm100_command_msg_1.data._8[4] = direction_command;
pm100_command_msg_1.data._8[5] = inverter_enable;
pm100_command_msg_1.data._8[5] |= inverter_discharge << 1;
pm100_command_msg_1.data._8[5] |= speed_mode_enable << 2;
pm100_command_msg_1.data._8[6] = (commanded_torque_limit & 0x00FF);
pm100_command_msg_1.data._8[7] = (commanded_torque_limit & 0xFF00 >> 8);
pm100_command_msg_1.data._8[7] = ((commanded_torque_limit & 0xFF00) >> 8);

CAN_Send(pm100_command_msg_1);
}
Expand All @@ -148,15 +148,15 @@ void command_msg_1(uint16_t torque_command, uint16_t speed_command, uint8_t dire
*/
void command_msg_2(uint16_t torque_command, uint16_t speed_command, uint8_t direction_command, uint8_t inverter_enable, uint8_t inverter_discharge, uint8_t speed_mode_enable, uint16_t commanded_torque_limit){
pm100_command_msg_2.data._8[0] = (torque_command & 0x00FF);
pm100_command_msg_2.data._8[1] = (torque_command & 0xFF00 >> 8);
pm100_command_msg_2.data._8[1] = ((torque_command & 0xFF00) >> 8);
pm100_command_msg_2.data._8[2] = (speed_command & 0x00FF);
pm100_command_msg_2.data._8[3] = (speed_command & 0xFF00 >> 8);
pm100_command_msg_2.data._8[3] = ((speed_command & 0xFF00) >> 8);
pm100_command_msg_2.data._8[4] = direction_command;
pm100_command_msg_2.data._8[5] = inverter_enable;
pm100_command_msg_2.data._8[5] |= inverter_discharge << 1;
pm100_command_msg_2.data._8[5] |= speed_mode_enable << 2;
pm100_command_msg_2.data._8[6] = (commanded_torque_limit & 0x00FF);
pm100_command_msg_2.data._8[7] = (commanded_torque_limit & 0xFF00 >> 8);
pm100_command_msg_2.data._8[7] = ((commanded_torque_limit & 0xFF00) >> 8);

CAN_Send(pm100_command_msg_2);
}
Expand Down