Skip to content

Commit 0dcd84d

Browse files
author
Commaremote
committed
Toyota safety: integer division bug
1 parent 9a268f3 commit 0dcd84d

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

board/safety/safety_toyota.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ static void toyota_rx_hook(CAN_FIFOMailBox_TypeDef *to_push) {
3636
torque_meas_new = to_signed(torque_meas_new, 16);
3737

3838
// scale by dbc_factor
39-
torque_meas_new *= dbc_eps_torque_factor / 100;
39+
torque_meas_new = (torque_meas_new * dbc_eps_torque_factor) / 100;
4040

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

0 commit comments

Comments
 (0)