mirror of
https://github.com/dalathegreat/Battery-Emulator.git
synced 2025-10-03 17:59:27 +02:00
Add button for NVROL reset
This commit is contained in:
parent
5859cb0504
commit
12d0bbded3
3 changed files with 24 additions and 0 deletions
|
@ -701,6 +701,8 @@ typedef struct {
|
|||
} DATALAYER_INFO_VOLVO_HYBRID;
|
||||
|
||||
typedef struct {
|
||||
/** User requesting NVROL reset via WebUI*/
|
||||
bool UserRequestNVROLReset = false;
|
||||
/** uint16_t */
|
||||
/** Values WIP*/
|
||||
uint16_t battery_soc = 0;
|
||||
|
|
|
@ -1234,6 +1234,7 @@ String advanced_battery_processor(const String& var) {
|
|||
#endif //MEB_BATTERY
|
||||
|
||||
#ifdef RENAULT_ZOE_GEN2_BATTERY
|
||||
content += "<button onclick='askTriggerNVROL()'>Perform NVROL reset</button>";
|
||||
content += "<h4>soc: " + String(datalayer_extended.zoePH2.battery_soc) + "</h4>";
|
||||
content += "<h4>usable soc: " + String(datalayer_extended.zoePH2.battery_usable_soc) + "</h4>";
|
||||
content += "<h4>soh: " + String(datalayer_extended.zoePH2.battery_soh) + "</h4>";
|
||||
|
@ -1501,6 +1502,18 @@ String advanced_battery_processor(const String& var) {
|
|||
content += "function goToMainPage() { window.location.href = '/'; }";
|
||||
content += "</script>";
|
||||
content += "<script>";
|
||||
content +=
|
||||
"function askTriggerNVROL() { if (window.confirm('Are you sure you want to trigger "
|
||||
"an NVROL reset? Battery will be unavailable for 30 seconds while this is active!')) { "
|
||||
"TriggerNVROL(); } }";
|
||||
content += "function TriggerNVROL() {";
|
||||
content += " var xhr = new XMLHttpRequest();";
|
||||
content += " xhr.open('GET', '/triggerNVROL', true);";
|
||||
content += " xhr.send();";
|
||||
content += "}";
|
||||
content += "function goToMainPage() { window.location.href = '/'; }";
|
||||
content += "</script>";
|
||||
content += "<script>";
|
||||
content +=
|
||||
"function askResetSOH() { if (window.confirm('Are you sure you want to reset degradation data? "
|
||||
"Note this should only be used on 2011-2017 24/30kWh batteries!')) { "
|
||||
|
|
|
@ -588,6 +588,15 @@ void init_webserver() {
|
|||
request->send(200, "text/plain", "Updated successfully");
|
||||
});
|
||||
|
||||
// Route for triggering NVROL reset on Zoe Gen2 batteries
|
||||
server.on("/triggerNVROL", HTTP_GET, [](AsyncWebServerRequest* request) {
|
||||
if (WEBSERVER_AUTH_REQUIRED && !request->authenticate(http_username, http_password)) {
|
||||
return request->requestAuthentication();
|
||||
}
|
||||
datalayer_extended.zoePH2.UserRequestNVROLReset = true;
|
||||
request->send(200, "text/plain", "Updated successfully");
|
||||
});
|
||||
|
||||
// Route for resetting SOH on Nissan LEAF batteries
|
||||
server.on("/resetSOH", HTTP_GET, [](AsyncWebServerRequest* request) {
|
||||
if (WEBSERVER_AUTH_REQUIRED && !request->authenticate(http_username, http_password)) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue