![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
LIGHT2
Diff: CAN/function_CAN.cpp
- Revision:
- 241:fb5b57e3f157
- Parent:
- 238:4e660aa77eb7
- Child:
- 243:b235d67d25ba
diff -r 8ac5c6162bc1 -r fb5b57e3f157 CAN/function_CAN.cpp --- a/CAN/function_CAN.cpp Fri Jul 30 06:04:10 2021 +0000 +++ b/CAN/function_CAN.cpp Tue Apr 05 05:12:12 2022 +0000 @@ -506,8 +506,9 @@ } case CRX_SET_TORQUE_SENSOR_PULSE_PER_TORQUE: { - TORQUE_SENSOR_PULSE_PER_TORQUE = (float) ((int16_t) (msg.data[1] | msg.data[2] << 8) * 0.01f); - spi_eeprom_write(RID_TORQUE_SENSOR_PULSE_PER_TORQUE, (int16_t) (TORQUE_SENSOR_PULSE_PER_TORQUE*100.0f)); +// TORQUE_SENSOR_PULSE_PER_TORQUE = (float) ((int16_t) (msg.data[1] | msg.data[2] << 8) * 0.01f); + TORQUE_SENSOR_PULSE_PER_TORQUE = ((float) ((int16_t) (msg.data[1] | msg.data[2] << 8)))*0.001f; + spi_eeprom_write(RID_TORQUE_SENSOR_PULSE_PER_TORQUE, (int16_t) (TORQUE_SENSOR_PULSE_PER_TORQUE*1000.0f)); break; } @@ -1125,7 +1126,7 @@ temp_msg.id = CID_TX_INFO; temp_msg.len = 3; temp_msg.data[0] = (uint8_t) CTX_SEND_TORQUE_SENSOR_PULSE_PER_TORQUE; - int temp_torque_sensor_pulse_per_torque = (int) (TORQUE_SENSOR_PULSE_PER_TORQUE * 100.0f); + int16_t temp_torque_sensor_pulse_per_torque = (int16_t) (TORQUE_SENSOR_PULSE_PER_TORQUE * 1000.0f); temp_msg.data[1] = (uint8_t) temp_torque_sensor_pulse_per_torque; temp_msg.data[2] = (uint8_t) (temp_torque_sensor_pulse_per_torque >> 8);