mirror of
https://github.com/dalathegreat/Battery-Emulator.git
synced 2025-10-04 18:29:48 +02:00
Merge pull request #282 from JorgenSeemann/patch-1
Update KIA-E-GMP-BATTERY.cpp
This commit is contained in:
commit
164631a65a
1 changed files with 10 additions and 1 deletions
|
@ -51,9 +51,11 @@ CANFDMessage EGMP_7E4_ack;
|
|||
|
||||
void set_cell_voltages(CANFDMessage frame, int start, int length, int startCell) {
|
||||
for (size_t i = 0; i < length; i++) {
|
||||
if ((frame.data[start + i] * 20) > 1000) {
|
||||
datalayer.battery.status.cell_voltages_mV[startCell + i] = (frame.data[start + i] * 20);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void update_values_battery() { //This function maps all the values fetched via CAN to the correct parameters used for modbus
|
||||
|
||||
|
@ -387,6 +389,13 @@ void send_can_battery() {
|
|||
set_event(EVENT_CAN_OVERRUN, (currentMillis - previousMillis500ms));
|
||||
}
|
||||
previousMillis500ms = currentMillis;
|
||||
// Section added to close contractor
|
||||
if (datalayer.battery.status.bms_status == ACTIVE) {
|
||||
datalayer.system.status.battery_allows_contactor_closing = true;
|
||||
} else { //datalayer.battery.status.bms_status == FAULT or inverter requested opening contactors
|
||||
datalayer.system.status.battery_allows_contactor_closing = false;
|
||||
}
|
||||
// Section end
|
||||
EGMP_7E4.data[3] = KIA_7E4_COUNTER;
|
||||
canfd.tryToSend(EGMP_7E4);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue