factoring changes

This commit is contained in:
josiahhiggs 2024-12-22 18:35:12 +13:00
parent f55cad92f1
commit 6d96808de4
2 changed files with 50 additions and 53 deletions

View file

@ -48,7 +48,7 @@ static uint16_t battery_nominal_full_pack_energy_m0 = 600; // Kwh
//0x132 306 HVBattAmpVolt
static uint16_t battery_volts = 0; // V
static int16_t battery_amps = 0; // A
static uint16_t battery_raw_amps = 0; // A
static int16_t battery_raw_amps = 0; // A
static uint16_t battery_charge_time_remaining = 0; // Minutes
//0x252 594 BMS_powerAvailable
static uint16_t BMS_maxRegenPower = 0; //rename from battery_regenerative_limit
@ -167,11 +167,11 @@ static uint16_t BMS_packTMax = 0;
static uint16_t BMS_pcsNoFlowRequest = 0;
static uint16_t BMS_noFlowRequest = 0;
//0x2A4; 676 PCS_thermalStatus
static uint16_t PCS_chgPhATemp = 0;
static uint16_t PCS_chgPhBTemp = 0;
static uint16_t PCS_chgPhCTemp = 0;
static uint16_t PCS_dcdcTemp = 0;
static uint16_t PCS_ambientTemp = 0;
static int16_t PCS_chgPhATemp = 0;
static int16_t PCS_chgPhBTemp = 0;
static int16_t PCS_chgPhCTemp = 0;
static int16_t PCS_dcdcTemp = 0;
static int16_t PCS_ambientTemp = 0;
//0x2C4; 708 PCS_logging
static uint16_t PCS_logMessageSelect = 0;
static uint16_t PCS_dcdcMaxLvOutputCurrent = 0;
@ -179,10 +179,10 @@ static uint16_t PCS_dcdcCurrentLimit = 0;
static uint16_t PCS_dcdcLvOutputCurrentTempLimit = 0;
static uint16_t PCS_dcdcUnifiedCommand = 0;
static uint16_t PCS_dcdcCLAControllerOutput = 0;
static uint16_t PCS_dcdcTankVoltage = 0;
static int16_t PCS_dcdcTankVoltage = 0;
static uint16_t PCS_dcdcTankVoltageTarget = 0;
static uint16_t PCS_dcdcClaCurrentFreq = 0;
static uint16_t PCS_dcdcTCommMeasured = 0;
static int16_t PCS_dcdcTCommMeasured = 0;
static uint16_t PCS_dcdcShortTimeUs = 0;
static uint16_t PCS_dcdcHalfPeriodUs = 0;
static uint16_t PCS_dcdcIntervalMaxFrequency = 0;
@ -221,34 +221,34 @@ static uint8_t HVP_gpioFcContPowerEnable = 0;
static uint8_t HVP_gpioHvilEnable = 0;
static uint8_t HVP_gpioSecDrdy = 0;
static uint16_t HVP_hvp1v5Ref = 0;
static uint16_t HVP_shuntCurrentDebug = 0;
static int16_t HVP_shuntCurrentDebug = 0;
static uint8_t HVP_packCurrentMia = 0;
static uint8_t HVP_auxCurrentMia = 0;
static uint8_t HVP_currentSenseMia = 0;
static uint8_t HVP_shuntRefVoltageMismatch = 0;
static uint8_t HVP_shuntThermistorMia = 0;
static uint8_t HVP_shuntHwMia = 0;
static uint16_t HVP_dcLinkVoltage = 0;
static uint16_t HVP_packVoltage = 0;
static uint16_t HVP_fcLinkVoltage = 0;
static int16_t HVP_dcLinkVoltage = 0;
static int16_t HVP_packVoltage = 0;
static int16_t HVP_fcLinkVoltage = 0;
static uint16_t HVP_packContVoltage = 0;
static uint16_t HVP_packNegativeV = 0;
static uint16_t HVP_packPositiveV = 0;
static int16_t HVP_packNegativeV = 0;
static int16_t HVP_packPositiveV = 0;
static uint16_t HVP_pyroAnalog = 0;
static uint16_t HVP_dcLinkNegativeV = 0;
static uint16_t HVP_dcLinkPositiveV = 0;
static uint16_t HVP_fcLinkNegativeV = 0;
static int16_t HVP_dcLinkNegativeV = 0;
static int16_t HVP_dcLinkPositiveV = 0;
static int16_t HVP_fcLinkNegativeV = 0;
static uint16_t HVP_fcContCoilCurrent = 0;
static uint16_t HVP_fcContVoltage = 0;
static uint16_t HVP_hvilInVoltage = 0;
static uint16_t HVP_hvilOutVoltage = 0;
static uint16_t HVP_fcLinkPositiveV = 0;
static int16_t HVP_fcLinkPositiveV = 0;
static uint16_t HVP_packContCoilCurrent = 0;
static uint16_t HVP_battery12V = 0;
static uint16_t HVP_shuntRefVoltageDbg = 0;
static uint16_t HVP_shuntAuxCurrentDbg = 0;
static uint16_t HVP_shuntBarTempDbg = 0;
static uint16_t HVP_shuntAsicTempDbg = 0;
static int16_t HVP_shuntRefVoltageDbg = 0;
static int16_t HVP_shuntAuxCurrentDbg = 0;
static int16_t HVP_shuntBarTempDbg = 0;
static int16_t HVP_shuntAsicTempDbg = 0;
static uint8_t HVP_shuntAuxCurrentStatus = 0;
static uint8_t HVP_shuntBarTempStatus = 0;
static uint8_t HVP_shuntAsicTempStatus = 0;
@ -432,7 +432,7 @@ static uint16_t battery2_nominal_full_pack_energy_m0 = 600; // Kwh
//0x132 306 HVBattAmpVolt
static uint16_t battery2_volts = 0; // V
static int16_t battery2_amps = 0; // A
static uint16_t battery2_raw_amps = 0; // A
static int16_t battery2_raw_amps = 0; // A
static uint16_t battery2_charge_time_remaining = 0; // Minutes
//0x252 594 BMS_powerAvailable
static uint16_t BMS2_regenerative_limit = 0;
@ -547,11 +547,11 @@ static uint16_t BMS2_packTMax = 0;
static uint16_t BMS2_pcsNoFlowRequest = 0;
static uint16_t BMS2_noFlowRequest = 0;
//0x2A4; 676 PCS_thermalStatus
static uint16_t PCS2_chgPhATemp = 0;
static uint16_t PCS2_chgPhBTemp = 0;
static uint16_t PCS2_chgPhCTemp = 0;
static uint16_t PCS2_dcdcTemp = 0;
static uint16_t PCS2_ambientTemp = 0;
static int16_t PCS2_chgPhATemp = 0;
static int16_t PCS2_chgPhBTemp = 0;
static int16_t PCS2_chgPhCTemp = 0;
static int16_t PCS2_dcdcTemp = 0;
static int16_t PCS2_ambientTemp = 0;
//0x2C4; 708 PCS_logging
static uint16_t PCS2_logMessageSelect = 0;
static uint16_t PCS2_dcdcMaxLvOutputCurrent = 0;
@ -559,10 +559,10 @@ static uint16_t PCS2_dcdcCurrentLimit = 0;
static uint16_t PCS2_dcdcLvOutputCurrentTempLimit = 0;
static uint16_t PCS2_dcdcUnifiedCommand = 0;
static uint16_t PCS2_dcdcCLAControllerOutput = 0;
static uint16_t PCS2_dcdcTankVoltage = 0;
static int16_t PCS2_dcdcTankVoltage = 0;
static uint16_t PCS2_dcdcTankVoltageTarget = 0;
static uint16_t PCS2_dcdcClaCurrentFreq = 0;
static uint16_t PCS2_dcdcTCommMeasured = 0;
static int16_t PCS2_dcdcTCommMeasured = 0;
static uint16_t PCS2_dcdcShortTimeUs = 0;
static uint16_t PCS2_dcdcHalfPeriodUs = 0;
static uint16_t PCS2_dcdcIntervalMaxFrequency = 0;
@ -601,34 +601,34 @@ static uint8_t HVP2_gpioFcContPowerEnable = 0;
static uint8_t HVP2_gpioHvilEnable = 0;
static uint8_t HVP2_gpioSecDrdy = 0;
static uint16_t HVP2_hvp1v5Ref = 0;
static uint16_t HVP2_shuntCurrentDebug = 0;
static int16_t HVP2_shuntCurrentDebug = 0;
static uint8_t HVP2_packCurrentMia = 0;
static uint8_t HVP2_auxCurrentMia = 0;
static uint8_t HVP2_currentSenseMia = 0;
static uint8_t HVP2_shuntRefVoltageMismatch = 0;
static uint8_t HVP2_shuntThermistorMia = 0;
static uint8_t HVP2_shuntHwMia = 0;
static uint16_t HVP2_dcLinkVoltage = 0;
static uint16_t HVP2_packVoltage = 0;
static uint16_t HVP2_fcLinkVoltage = 0;
static int16_t HVP2_dcLinkVoltage = 0;
static int16_t HVP2_packVoltage = 0;
static int16_t HVP2_fcLinkVoltage = 0;
static uint16_t HVP2_packContVoltage = 0;
static uint16_t HVP2_packNegativeV = 0;
static uint16_t HVP2_packPositiveV = 0;
static int16_t HVP2_packNegativeV = 0;
static int16_t HVP2_packPositiveV = 0;
static uint16_t HVP2_pyroAnalog = 0;
static uint16_t HVP2_dcLinkNegativeV = 0;
static uint16_t HVP2_dcLinkPositiveV = 0;
static uint16_t HVP2_fcLinkNegativeV = 0;
static int16_t HVP2_dcLinkNegativeV = 0;
static int16_t HVP2_dcLinkPositiveV = 0;
static int16_t HVP2_fcLinkNegativeV = 0;
static uint16_t HVP2_fcContCoilCurrent = 0;
static uint16_t HVP2_fcContVoltage = 0;
static uint16_t HVP2_hvilInVoltage = 0;
static uint16_t HVP2_hvilOutVoltage = 0;
static uint16_t HVP2_fcLinkPositiveV = 0;
static int16_t HVP2_fcLinkPositiveV = 0;
static uint16_t HVP2_packContCoilCurrent = 0;
static uint16_t HVP2_battery12V = 0;
static uint16_t HVP2_shuntRefVoltageDbg = 0;
static uint16_t HVP2_shuntAuxCurrentDbg = 0;
static uint16_t HVP2_shuntBarTempDbg = 0;
static uint16_t HVP2_shuntAsicTempDbg = 0;
static int16_t HVP2_shuntRefVoltageDbg = 0;
static int16_t HVP2_shuntAuxCurrentDbg = 0;
static int16_t HVP2_shuntBarTempDbg = 0;
static int16_t HVP2_shuntAsicTempDbg = 0;
static uint8_t HVP2_shuntAuxCurrentStatus = 0;
static uint8_t HVP2_shuntBarTempStatus = 0;
static uint8_t HVP2_shuntAsicTempStatus = 0;

View file

@ -561,10 +561,8 @@ String advanced_battery_processor(const String& var) {
content +=
"<h4>BMS PCS PWM Enabled: " + String(noYes[datalayer_extended.tesla.battery_BMS_pcsPwmEnabled]) + "</h4>";
//0x352 850 BMS_energyStatus
content +=
"<h3>Early BMS 0x352:"
"</h3"; //if using older BMS <2021 and comment 0x352 without MUX
content += "<h4>Calculated SOH: " + String(nominal_full_pack_energy) * 100 / (beginning_of_life);
content += "<h3>Early BMS 0x352:</h3>"; //if using older BMS <2021 and comment 0x352 without MUX
content += "<h4>Calculated SOH: " + String(nominal_full_pack_energy * 100 / beginning_of_life) + "</h4>";
content += "<h4>Nominal Full Pack Energy: " + String(nominal_full_pack_energy) + " KWh</h4>";
content += "<h4>Nominal Energy Remaining: " + String(nominal_energy_remaining) + " KWh</h4>";
content += "<h4>Ideal Energy Remaining: " + String(ideal_energy_remaining) + " KWh</h4>";
@ -574,9 +572,8 @@ String advanced_battery_processor(const String& var) {
"<h4>Full Charge Complete: " + String(noYes[datalayer_extended.tesla.battery_full_charge_complete]) + "</h4>";
//0x352 850 BMS_energyStatus
content +=
"<h3>Late BMS 0x352 with Mux:"
"</h3"; //if using newer BMS >2021 and comment 0x352 with MUX
content += "<h4>Calculated SOH: " + String(nominal_full_pack_energy_m0) * 100 / (beginning_of_life);
"<h3>Late BMS 0x352 with Mux:</h3>"; //if using newer BMS >2021 and comment 0x352 with MUX
content += "<h4>Calculated SOH: " + String(nominal_full_pack_energy_m0 * 100 / beginning_of_life) + "</h4>";
content += "<h4>Nominal Full Pack Energy: " + String(nominal_full_pack_energy_m0) + " KWh</h4>";
content += "<h4>Nominal Energy Remaining: " + String(nominal_energy_remaining_m0) + " KWh</h4>";
content += "<h4>Ideal Energy Remaining: " + String(ideal_energy_remaining_m0) + " KWh</h4>";
@ -600,8 +597,8 @@ String advanced_battery_processor(const String& var) {
content += "<h4>Brick Voltage Min: " + String(BrickVoltageMin) + " V</h4>";
content += "<h4>Brick Temp Max Num: " + String(datalayer_extended.tesla.battery_BrickTempMaxNum) + " </h4>";
content += "<h4>Brick Temp Min Num: " + String(datalayer_extended.tesla.battery_BrickTempMinNum) + " </h4>";
content += "<h4>Brick Temp Max: " + String(BrickModelTMax) + " C</h4>";
content += "<h4>Brick Temp Min: " + String(BrickModelTMin) + " C</h4>";
content += "<h4>Brick Model Temp Max: " + String(BrickModelTMax) + " C</h4>";
content += "<h4>Brick Model Temp Min: " + String(BrickModelTMin) + " C</h4>";
//0x252 594 BMS_powerAvailable
content += "<h4>Max Regen Power: " + String(BMS_maxRegenPower) + " KW</h4>";
content += "<h4>Max Discharge Power: " + String(BMS_maxDischargePower) + " KW</h4>";