mirror of
https://github.com/dalathegreat/Battery-Emulator.git
synced 2025-10-05 10:49:42 +02:00
Improve safety for stopping charge/discharge when battery is full/empty
This commit is contained in:
parent
2b6ad122bb
commit
28a337684d
1 changed files with 4 additions and 2 deletions
|
@ -130,7 +130,8 @@ void update_machineryprotection() {
|
|||
|
||||
// Battery is fully charged. Dont allow any more power into it
|
||||
// Normally the BMS will send 0W allowed, but this acts as an additional layer of safety
|
||||
if (datalayer.battery.status.reported_soc == 10000) //Scaled SOC% value is 100.00%
|
||||
if (datalayer.battery.status.reported_soc == 10000 ||
|
||||
datalayer.battery.status.real_soc == 10000) //Either Scaled OR Real SOC% value is 100.00%
|
||||
{
|
||||
if (!battery_full_event_fired) {
|
||||
set_event(EVENT_BATTERY_FULL, 0);
|
||||
|
@ -145,7 +146,8 @@ void update_machineryprotection() {
|
|||
// Battery is empty. Do not allow further discharge.
|
||||
// Normally the BMS will send 0W allowed, but this acts as an additional layer of safety
|
||||
if (datalayer.battery.status.bms_status == ACTIVE) {
|
||||
if (datalayer.battery.status.reported_soc == 0) { //Scaled SOC% value is 0.00%
|
||||
if (datalayer.battery.status.reported_soc == 0 ||
|
||||
datalayer.battery.status.real_soc == 0) { //Either Scaled OR Real SOC% value is 0.00%, time to stop
|
||||
if (!battery_empty_event_fired) {
|
||||
set_event(EVENT_BATTERY_EMPTY, 0);
|
||||
battery_empty_event_fired = true;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue