From 09e5436cea0debd954346e614ed08a80b8b346ed Mon Sep 17 00:00:00 2001
From: nmainil <100416302+nmainil@users.noreply.github.com>
Date: Sun, 23 Feb 2025 16:35:58 +0100
Subject: [PATCH] Add files via upload
---
.../webserver/advanced_battery_html.cpp | 93 ++++++++++++++++++-
Software/src/devboard/webserver/webserver.cpp | 27 ++++++
2 files changed, 119 insertions(+), 1 deletion(-)
diff --git a/Software/src/devboard/webserver/advanced_battery_html.cpp b/Software/src/devboard/webserver/advanced_battery_html.cpp
index 19baf62c..239511ad 100644
--- a/Software/src/devboard/webserver/advanced_battery_html.cpp
+++ b/Software/src/devboard/webserver/advanced_battery_html.cpp
@@ -1321,10 +1321,101 @@ String advanced_battery_processor(const String& var) {
content += "";
#endif // VOLVO_SPA_BATTERY
+#ifdef VOLVO_SPA_HYBRID_BATTERY
+ content += "
BECM reported SOC: " + String(datalayer_extended.VolvoHybrid.soc_bms) + "
";
+ content += "Calculated SOC: " + String(datalayer_extended.VolvoHybrid.soc_calc) + "
";
+ content += "Rescaled SOC: " + String(datalayer_extended.VolvoHybrid.soc_rescaled / 10) + "
";
+ content += "BECM reported SOH: " + String(datalayer_extended.VolvoHybrid.soh_bms) + "
";
+ content += "BECM supply voltage: " + String(datalayer_extended.VolvoHybrid.BECMsupplyVoltage) + " mV
";
+
+ content += "HV voltage: " + String(datalayer_extended.VolvoHybrid.BECMBatteryVoltage) + " V
";
+ content += "HV current: " + String(datalayer_extended.VolvoHybrid.BECMBatteryCurrent) + " A
";
+ content += "Dynamic max voltage: " + String(datalayer_extended.VolvoHybrid.BECMUDynMaxLim) + " V
";
+ content += "Dynamic min voltage: " + String(datalayer_extended.VolvoHybrid.BECMUDynMinLim) + " V
";
+
+ content +=
+ "Discharge power limit 1: " + String(datalayer_extended.VolvoHybrid.HvBattPwrLimDcha1) + " kW
";
+ content +=
+ "Discharge soft power limit: " + String(datalayer_extended.VolvoHybrid.HvBattPwrLimDchaSoft) + " kW
";
+
+ content += "HV system relay status: ";
+ switch (datalayer_extended.VolvoHybrid.HVSysRlySts) {
+ case 0:
+ content += String("Open");
+ break;
+ case 1:
+ content += String("Closed");
+ break;
+ case 2:
+ content += String("KeepStatus");
+ break;
+ case 3:
+ content += String("OpenAndRequestActiveDischarge");
+ break;
+ default:
+ content += String("Not valid");
+ }
+ content += "
HV system relay status 1: ";
+ switch (datalayer_extended.VolvoHybrid.HVSysDCRlySts1) {
+ case 0:
+ content += String("Open");
+ break;
+ case 1:
+ content += String("Closed");
+ break;
+ case 2:
+ content += String("KeepStatus");
+ break;
+ case 3:
+ content += String("Fault");
+ break;
+ default:
+ content += String("Not valid");
+ }
+ content += "
HV system relay status 2: ";
+ switch (datalayer_extended.VolvoHybrid.HVSysDCRlySts2) {
+ case 0:
+ content += String("Open");
+ break;
+ case 1:
+ content += String("Closed");
+ break;
+ case 2:
+ content += String("KeepStatus");
+ break;
+ case 3:
+ content += String("Fault");
+ break;
+ default:
+ content += String("Not valid");
+ }
+ content += "
HV system isolation resistance monitoring status: ";
+ switch (datalayer_extended.VolvoHybrid.HVSysIsoRMonrSts) {
+ case 0:
+ content += String("Not valid 1");
+ break;
+ case 1:
+ content += String("False");
+ break;
+ case 2:
+ content += String("True");
+ break;
+ case 3:
+ content += String("Not valid 2");
+ break;
+ default:
+ content += String("Not valid");
+ }
+
+ content += "
";
+ content += "
";
+ content += "";
+#endif // VOLVO_SPA_HYBRID_BATTERY
+
#if !defined(BMW_PHEV_BATTERY) && !defined(BMW_IX_BATTERY) && !defined(BOLT_AMPERA_BATTERY) && \
!defined(TESLA_BATTERY) && !defined(NISSAN_LEAF_BATTERY) && !defined(BMW_I3_BATTERY) && \
!defined(BYD_ATTO_3_BATTERY) && !defined(RENAULT_ZOE_GEN2_BATTERY) && !defined(CELLPOWER_BMS) && \
- !defined(MEB_BATTERY) && !defined(VOLVO_SPA_BATTERY) && \
+ !defined(MEB_BATTERY) && !defined(VOLVO_SPA_BATTERY) && !defined(VOLVO_SPA_HYBRID_BATTERY) && \
!defined(KIA_HYUNDAI_64_BATTERY) //Only the listed types have extra info
content += "No extra information available for this battery type";
#endif
diff --git a/Software/src/devboard/webserver/webserver.cpp b/Software/src/devboard/webserver/webserver.cpp
index 7bdb686c..64efbdd5 100644
--- a/Software/src/devboard/webserver/webserver.cpp
+++ b/Software/src/devboard/webserver/webserver.cpp
@@ -430,6 +430,33 @@ void init_webserver() {
request->send(200, "text/plain", "Updated successfully");
});
+ // Route for erasing DTC on Volvo hybrid batteries
+ server.on("/volvoEraseDTC", HTTP_GET, [](AsyncWebServerRequest* request) {
+ if (WEBSERVER_AUTH_REQUIRED && !request->authenticate(http_username, http_password)) {
+ return request->requestAuthentication();
+ }
+ datalayer_extended.VolvoHybrid.UserRequestDTCreset = true;
+ request->send(200, "text/plain", "Updated successfully");
+ });
+
+ // Route for reading DTC on Volvo hybrid batteries
+ server.on("/volvoReadDTC", HTTP_GET, [](AsyncWebServerRequest* request) {
+ if (WEBSERVER_AUTH_REQUIRED && !request->authenticate(http_username, http_password)) {
+ return request->requestAuthentication();
+ }
+ datalayer_extended.VolvoHybrid.UserRequestDTCreadout = true;
+ request->send(200, "text/plain", "Updated successfully");
+ });
+
+ // Route for performing ECU reset on Volvo hybrid batteries
+ server.on("/volvoBECMecuReset", HTTP_GET, [](AsyncWebServerRequest* request) {
+ if (WEBSERVER_AUTH_REQUIRED && !request->authenticate(http_username, http_password)) {
+ return request->requestAuthentication();
+ }
+ datalayer_extended.VolvoHybrid.UserRequestBECMecuReset = true;
+ request->send(200, "text/plain", "Updated successfully");
+ });
+
#ifdef TEST_FAKE_BATTERY
// Route for editing FakeBatteryVoltage
server.on("/updateFakeBatteryVoltage", HTTP_GET, [](AsyncWebServerRequest* request) {