diff --git a/Software/USER_SETTINGS.h b/Software/USER_SETTINGS.h index a194dfab..2ffef21b 100644 --- a/Software/USER_SETTINGS.h +++ b/Software/USER_SETTINGS.h @@ -93,6 +93,7 @@ /* Automatic Precharge settings (Optional) If you have a battery that expects an external voltage applied before opening contactors (within the battery), configure this section */ //#define PRECHARGE_CONTROL //Enable this line to control a modified HIA4V1 (see wiki) by PWM on the PRECHARGE_PIN. +//#define MEB_BATTERY_DC_CHARGEPORT //Enable this line if using DC Chargeport of MEB battery to precharge /* Other options */ //#define EQUIPMENT_STOP_BUTTON // Enable this to allow an equipment stop button connected to the Battery-Emulator to disengage the battery diff --git a/Software/src/battery/MEB-BATTERY.cpp b/Software/src/battery/MEB-BATTERY.cpp index 8c9f84ad..20bbb96e 100644 --- a/Software/src/battery/MEB-BATTERY.cpp +++ b/Software/src/battery/MEB-BATTERY.cpp @@ -618,6 +618,7 @@ void update_values_battery() { //This function maps all the values fetched via datalayer_extended.meb.BMS_warning_lamp_req = BMS_warning_lamp_req; datalayer_extended.meb.BMS_Kl30c_Status = BMS_Kl30c_Status; datalayer_extended.meb.BMS_voltage_intermediate_dV = (BMS_voltage_intermediate - 2000) * 10 / 2; + datalayer_extended.meb.BMS_voltage_HV_charge_port_dV = (DC_voltage_chargeport - 2000) * 10 / 2; datalayer_extended.meb.BMS_voltage_dV = BMS_voltage * 10 / 4; datalayer_extended.meb.isolation_resistance = isolation_resistance_kOhm * 5; datalayer_extended.meb.battery_heating = battery_heating_active; diff --git a/Software/src/communication/precharge_control/precharge_control.cpp b/Software/src/communication/precharge_control/precharge_control.cpp index 761b75c1..9a2fdf47 100644 --- a/Software/src/communication/precharge_control/precharge_control.cpp +++ b/Software/src/communication/precharge_control/precharge_control.cpp @@ -39,7 +39,11 @@ void handle_precharge_control() { unsigned long currentTime = millis(); #ifdef MEB_BATTERY int32_t target_voltage = datalayer.battery.status.voltage_dV; +#ifdef MEB_BATTERY_DC_CHARGEPORT + int32_t external_voltage = datalayer_extended.meb.BMS_voltage_HV_charge_port_dV; +#else int32_t external_voltage = datalayer_extended.meb.BMS_voltage_intermediate_dV; +#endif #endif // Handle actual state machine. This first turns on Negative, then Precharge, then Positive, and finally turns OFF precharge diff --git a/Software/src/datalayer/datalayer_extended.h b/Software/src/datalayer/datalayer_extended.h index f3f4849f..959e3bd4 100644 --- a/Software/src/datalayer/datalayer_extended.h +++ b/Software/src/datalayer/datalayer_extended.h @@ -630,6 +630,7 @@ typedef struct { bool BMS_error_lamp_req = 0; bool BMS_warning_lamp_req = 0; int32_t BMS_voltage_intermediate_dV = 0; + int32_t BMS_voltage_HV_charge_port_dV = 0; int32_t BMS_voltage_dV = 0; uint8_t balancing_active = 0; bool balancing_request = 0; diff --git a/Software/src/devboard/webserver/advanced_battery_html.cpp b/Software/src/devboard/webserver/advanced_battery_html.cpp index b7439f37..8a33addc 100644 --- a/Software/src/devboard/webserver/advanced_battery_html.cpp +++ b/Software/src/devboard/webserver/advanced_battery_html.cpp @@ -1149,6 +1149,7 @@ String advanced_battery_processor(const String& var) { default: content += String("?"); } + content += "