mirror of
https://github.com/dalathegreat/Battery-Emulator.git
synced 2025-10-05 10:49:42 +02:00
Fix compilation error on Tesla
This commit is contained in:
parent
12dbd662b8
commit
e7629b971d
2 changed files with 12 additions and 3 deletions
|
@ -132,10 +132,10 @@ void update_values_tesla_model_3_battery()
|
|||
stat_batt_power = (volts * amps); //TODO, check if scaling is OK
|
||||
|
||||
min_temp = (min_temp * 10);
|
||||
temperature_min = convert2unsignedint16(min_temp);
|
||||
temperature_min = convert2unsignedInt16(min_temp);
|
||||
|
||||
max_temp = (max_temp * 10);
|
||||
temperature_max = convert2unsignedint16(max_temp);
|
||||
temperature_max = convert2unsignedInt16(max_temp);
|
||||
|
||||
cell_max_voltage = cell_max_v;
|
||||
|
||||
|
@ -394,3 +394,12 @@ the first, for a few cycles, then stop all messages which causes the contactor
|
|||
}
|
||||
}
|
||||
}
|
||||
uint16_t convert2unsignedInt16(int16_t signed_value)
|
||||
{
|
||||
if(signed_value < 0){
|
||||
return(65535 + signed_value);
|
||||
}
|
||||
else{
|
||||
return (uint16_t)signed_value;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -40,6 +40,6 @@ extern uint8_t LEDcolor;
|
|||
void update_values_tesla_model_3_battery();
|
||||
void receive_can_tesla_model_3_battery(CAN_frame_t rx_frame);
|
||||
void send_can_tesla_model_3_battery();
|
||||
uint16_t convert2unsignedint16(uint16_t signed_value);
|
||||
uint16_t convert2unsignedInt16(int16_t signed_value);
|
||||
|
||||
#endif
|
Loading…
Add table
Add a link
Reference in a new issue