Skip to content

Commit

Permalink
Toyota safety: integer division bug
Browse files Browse the repository at this point in the history
  • Loading branch information
Commaremote committed Jun 17, 2018
1 parent 9a268f3 commit 0dcd84d
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion board/safety/safety_toyota.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ static void toyota_rx_hook(CAN_FIFOMailBox_TypeDef *to_push) {
torque_meas_new = to_signed(torque_meas_new, 16);

// scale by dbc_factor
torque_meas_new *= dbc_eps_torque_factor / 100;
torque_meas_new = (torque_meas_new * dbc_eps_torque_factor) / 100;

// increase torque_meas by 1 to be conservative on rounding
torque_meas_new += (torque_meas_new > 0 ? 1 : -1);
Expand Down

0 comments on commit 0dcd84d

Please sign in to comment.