Add HV chargeport voltage to webpage and precharge.

This commit is contained in:
mvgalen 2025-04-13 12:03:29 +02:00
parent 08e9568883
commit 4b8bf6afec
5 changed files with 8 additions and 0 deletions

View file

@ -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 */ /* 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 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 */ /* Other options */
//#define EQUIPMENT_STOP_BUTTON // Enable this to allow an equipment stop button connected to the Battery-Emulator to disengage the battery //#define EQUIPMENT_STOP_BUTTON // Enable this to allow an equipment stop button connected to the Battery-Emulator to disengage the battery

View file

@ -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_warning_lamp_req = BMS_warning_lamp_req;
datalayer_extended.meb.BMS_Kl30c_Status = BMS_Kl30c_Status; 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_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.BMS_voltage_dV = BMS_voltage * 10 / 4;
datalayer_extended.meb.isolation_resistance = isolation_resistance_kOhm * 5; datalayer_extended.meb.isolation_resistance = isolation_resistance_kOhm * 5;
datalayer_extended.meb.battery_heating = battery_heating_active; datalayer_extended.meb.battery_heating = battery_heating_active;

View file

@ -39,7 +39,11 @@ void handle_precharge_control() {
unsigned long currentTime = millis(); unsigned long currentTime = millis();
#ifdef MEB_BATTERY #ifdef MEB_BATTERY
int32_t target_voltage = datalayer.battery.status.voltage_dV; 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; int32_t external_voltage = datalayer_extended.meb.BMS_voltage_intermediate_dV;
#endif
#endif #endif
// Handle actual state machine. This first turns on Negative, then Precharge, then Positive, and finally turns OFF precharge // Handle actual state machine. This first turns on Negative, then Precharge, then Positive, and finally turns OFF precharge

View file

@ -630,6 +630,7 @@ typedef struct {
bool BMS_error_lamp_req = 0; bool BMS_error_lamp_req = 0;
bool BMS_warning_lamp_req = 0; bool BMS_warning_lamp_req = 0;
int32_t BMS_voltage_intermediate_dV = 0; int32_t BMS_voltage_intermediate_dV = 0;
int32_t BMS_voltage_HV_charge_port_dV = 0;
int32_t BMS_voltage_dV = 0; int32_t BMS_voltage_dV = 0;
uint8_t balancing_active = 0; uint8_t balancing_active = 0;
bool balancing_request = 0; bool balancing_request = 0;

View file

@ -1149,6 +1149,7 @@ String advanced_battery_processor(const String& var) {
default: default:
content += String("?"); content += String("?");
} }
content += "</h4><h4>DC chargeport Voltage: " + String(datalayer_extended.meb.BMS_voltage_HV_charge_port_dV / 10.0, 1);
content += "</h4><h4>BMS error status: "; content += "</h4><h4>BMS error status: ";
switch (datalayer_extended.meb.BMS_error_status) { switch (datalayer_extended.meb.BMS_error_status) {
case 0: case 0: