diff --git a/ESPController/src/main.cpp b/ESPController/src/main.cpp index dc438ce..a7106bb 100644 --- a/ESPController/src/main.cpp +++ b/ESPController/src/main.cpp @@ -3201,7 +3201,7 @@ void send_ext_canbus_message(const uint32_t identifier, const uint8_t *buffer, c void CalculateStateOfHealth(diybms_eeprom_settings *settings) { // Value indicating what a typical discharge cycle looks like in amp-hours (normally 80% of cell for LFP) - float depth = 1000.0F * ((float)settings->currentMonitoring_batterycapacity/100.0F * (float)settings->soh_discharge_depth); + float depth = 1000.0F * ((float)settings->nominalbatcap/100.0F * (float)settings->soh_discharge_depth); float in = (float)settings->soh_total_milliamphour_in / depth; float out = (float)settings->soh_total_milliamphour_out / depth; //Take worst case diff --git a/ESPController/src/webserver_json_requests.cpp b/ESPController/src/webserver_json_requests.cpp index e922680..351e3ba 100644 --- a/ESPController/src/webserver_json_requests.cpp +++ b/ESPController/src/webserver_json_requests.cpp @@ -604,6 +604,14 @@ esp_err_t content_handler_chargeconfig(httpd_req_t *req) settings["canbusbaud"] = mysettings.canbusbaud; settings["equip_addr"] = mysettings.canbus_equipment_addr; settings["nominalbatcap"] = mysettings.nominalbatcap; + + settings["depthofdischarge"] = mysettings.soh_discharge_depth; + settings["expectedlifetime_cycles"] = mysettings.soh_lifetime_battery_cycles; + settings["total_mah_charge"] = mysettings.soh_total_milliamphour_in; + settings["total_mah_discharge"] = mysettings.soh_total_milliamphour_out; + settings["estimatebatterycycle"] = mysettings.soh_estimated_battery_cycles; + settings["stateofhealth"] = mysettings.soh_percent; + settings["chargevolt"] = mysettings.chargevolt; settings["chargecurrent"] = mysettings.chargecurrent; settings["dischargecurrent"] = mysettings.dischargecurrent; diff --git a/ESPController/web_src/default.htm b/ESPController/web_src/default.htm index 9bbb122..eb772b4 100644 --- a/ESPController/web_src/default.htm +++ b/ESPController/web_src/default.htm @@ -654,7 +654,7 @@

History

Date/time Voltage Current - SoC% + SoC%% mA In mA Out Highest Range @@ -1034,6 +1034,26 @@

Charge/Discharge configuration

+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +

Charging

diff --git a/ESPController/web_src/pagecode.js b/ESPController/web_src/pagecode.js index 09be33b..b412a18 100644 --- a/ESPController/web_src/pagecode.js +++ b/ESPController/web_src/pagecode.js @@ -2003,6 +2003,12 @@ $(function () { $("#canbusbaud").val(data.chargeconfig.canbusbaud); $("#nominalbatcap").val(data.chargeconfig.nominalbatcap); + $("#expected_cycles").val(data.chargeconfig.expectedlifetime_cycles); + $("#total_ah_charge").val(Math.trunc(data.chargeconfig.total_mah_charge/1000)); + $("#total_ah_discharge").val(Math.trunc(data.chargeconfig.total_mah_discharge/1000)); + $("#estimate_bat_cycle").val(data.chargeconfig.estimatebatterycycle); + $("#stateofhealth").val((data.chargeconfig.stateofhealth).toFixed(2)); + $("#chargevolt").val((data.chargeconfig.chargevolt / 10.0).toFixed(1)); $("#chargecurrent").val((data.chargeconfig.chargecurrent / 10.0).toFixed(1)); $("#dischargecurrent").val((data.chargeconfig.dischargecurrent / 10.0).toFixed(1));