Add degradation data reset for LEAF

This commit is contained in:
Daniel Öster 2024-11-03 13:31:56 +02:00
parent e6d7156451
commit 16fc2fb4f1
5 changed files with 348 additions and 1 deletions

View file

@ -292,6 +292,10 @@ String advanced_battery_processor(const String& var) {
content += "<h4>Heating stopped: " + String(datalayer_extended.nissanleaf.HeatingStop) + "</h4>";
content += "<h4>Heating started: " + String(datalayer_extended.nissanleaf.HeatingStart) + "</h4>";
content += "<h4>Heating requested: " + String(datalayer_extended.nissanleaf.HeaterSendRequest) + "</h4>";
content += "<button onclick='askResetSOH()'>Reset degradation data</button>";
content += "<h4>CryptoChallenge: " + String(datalayer_extended.nissanleaf.CryptoChallenge) + "</h4>";
content += "<h4>SolvedChallenge: " + String(datalayer_extended.nissanleaf.SolvedChallengeMSB) +
String(datalayer_extended.nissanleaf.SolvedChallengeLSB) + "</h4>";
#endif
#if !defined(TESLA_BATTERY) && !defined(NISSAN_LEAF_BATTERY) && !defined(BMW_I3_BATTERY) && \
@ -302,6 +306,15 @@ String advanced_battery_processor(const String& var) {
content += "</div>";
content += "<script>";
content +=
"function askResetSOH() { if (window.confirm('Are you sure you want to reset degradation data? "
"Note this only works for 30kWh LEAF BMS')) { "
"resetSOH(); } }";
content += "function resetSOH() {";
content += " var xhr = new XMLHttpRequest();";
content += " xhr.open('GET', '/resetSOH', true);";
content += " xhr.send();";
content += "}";
content += "function goToMainPage() { window.location.href = '/'; }";
content += "</script>";
return content;