Implement contactor opening in FAULT

This commit is contained in:
Daniel Öster 2025-10-01 10:25:12 +03:00
parent 895fd9a9ac
commit e235f69eff
2 changed files with 8 additions and 2 deletions

View file

@ -174,6 +174,12 @@ void FordMachEBattery::transmit_can(unsigned long currentMillis) {
if (currentMillis - previousMillis20 >= INTERVAL_20_MS) { if (currentMillis - previousMillis20 >= INTERVAL_20_MS) {
previousMillis20 = currentMillis; previousMillis20 = currentMillis;
if (datalayer.battery.status.bms_status == FAULT) {
FORD_25B.data.u8[2] = 0x01;
} else {
FORD_25B.data.u8[2] = 0x09;
}
transmit_can_frame(&FORD_25B); transmit_can_frame(&FORD_25B);
//Full vehicle emulation, not required //Full vehicle emulation, not required

View file

@ -18,7 +18,7 @@ class FordMachEBattery : public CanBattery {
static const int MAX_CELL_VOLTAGE_MV = 4250; static const int MAX_CELL_VOLTAGE_MV = 4250;
static const int MIN_CELL_VOLTAGE_MV = 2900; static const int MIN_CELL_VOLTAGE_MV = 2900;
unsigned long previousMillis10 = 0; // will store last time a 10ms CAN Message was send unsigned long previousMillis20 = 0; // will store last time a 20ms CAN Message was send
unsigned long previousMillis30 = 0; // will store last time a 10ms CAN Message was send unsigned long previousMillis30 = 0; // will store last time a 10ms CAN Message was send
unsigned long previousMillis50 = 0; // will store last time a 100ms CAN Message was send unsigned long previousMillis50 = 0; // will store last time a 100ms CAN Message was send
unsigned long previousMillis100 = 0; // will store last time a 100ms CAN Message was send unsigned long previousMillis100 = 0; // will store last time a 100ms CAN Message was send
@ -46,7 +46,7 @@ class FordMachEBattery : public CanBattery {
.ext_ID = false, .ext_ID = false,
.DLC = 8, .DLC = 8,
.ID = 0x185, .ID = 0x185,
.data = {0x03, 0x4E, 0x75, 0x32, 0x00, 0x00, 0x00, 0x00}}; .data = {0x03, 0x4E, 0x75, 0x32, 0x00, 0x80, 0x00, 0x00}};
//Messages to emulate full vehicle //Messages to emulate full vehicle
/* /*
CAN_frame FORD_47 = {.FD = false, CAN_frame FORD_47 = {.FD = false,