mirror of
https://github.com/dalathegreat/Battery-Emulator.git
synced 2025-10-05 02:39:57 +02:00
Add div0 safeguard
This commit is contained in:
parent
82ddae71c3
commit
4f6120ffe2
1 changed files with 3 additions and 1 deletions
|
@ -286,7 +286,9 @@ void send_setup_info() { //Ensemble information
|
||||||
//Modules in series (not really how EV packs work, but let's map it to a reasonable Pylon value)
|
//Modules in series (not really how EV packs work, but let's map it to a reasonable Pylon value)
|
||||||
PYLON_7320.data.u8[2] = (datalayer.battery.info.number_of_cells / 15);
|
PYLON_7320.data.u8[2] = (datalayer.battery.info.number_of_cells / 15);
|
||||||
//Capacity in AH
|
//Capacity in AH
|
||||||
PYLON_7320.data.u8[6] = (datalayer.battery.info.total_capacity_Wh / (datalayer.battery.status.voltage_dV / 10));
|
if(datalayer.battery.status.voltage_dV > 10){ //div0 safeguard
|
||||||
|
PYLON_7320.data.u8[6] = (datalayer.battery.info.total_capacity_Wh / (datalayer.battery.status.voltage_dV / 10));
|
||||||
|
}
|
||||||
|
|
||||||
#ifdef SEND_0
|
#ifdef SEND_0
|
||||||
ESP32Can.CANWriteFrame(&PYLON_7310);
|
ESP32Can.CANWriteFrame(&PYLON_7310);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue