mirror of
https://github.com/dalathegreat/Battery-Emulator.git
synced 2025-10-03 17:59:27 +02:00
Tesla: update naming of BMS reset and Isolation clear functions
This commit is contained in:
parent
5556a873c9
commit
f1ae250266
4 changed files with 25 additions and 25 deletions
|
@ -870,17 +870,17 @@ void update_values_battery() { //This function maps all the values fetched via
|
||||||
#endif // TESLA_MODEL_3Y_BATTERY
|
#endif // TESLA_MODEL_3Y_BATTERY
|
||||||
|
|
||||||
// Check if user requests some action
|
// Check if user requests some action
|
||||||
if (datalayer.battery.settings.user_requests_isolation_clear) {
|
if (datalayer.battery.settings.user_requests_tesla_isolation_clear) {
|
||||||
stateMachineClearIsolationFault = 0; //Start the isolation fault statemachine
|
stateMachineClearIsolationFault = 0; //Start the isolation fault statemachine
|
||||||
datalayer.battery.settings.user_requests_isolation_clear = false;
|
datalayer.battery.settings.user_requests_tesla_isolation_clear = false;
|
||||||
}
|
}
|
||||||
if (datalayer.battery.settings.user_requests_bms_ecu_reset) {
|
if (datalayer.battery.settings.user_requests_tesla_bms_reset) {
|
||||||
if (battery_contactor == 1 && battery_BMS_a180_SW_ECU_reset_blocked == false) {
|
if (battery_contactor == 1 && battery_BMS_a180_SW_ECU_reset_blocked == false) {
|
||||||
stateMachineBMSReset =
|
//Start the BMS ECU reset statemachine, only if contactors are OPEN and BMS ECU allows it
|
||||||
0; //Start the BMS ECU reset statemachine, only if contactors are OPEN and BMS ECU allows it
|
stateMachineBMSReset = 0;
|
||||||
datalayer.battery.settings.user_requests_bms_ecu_reset = false;
|
datalayer.battery.settings.user_requests_tesla_bms_reset = false;
|
||||||
} else {
|
} else {
|
||||||
logging.println("ERROR: BMS ECU reset failed due to contactors not being open, or BMS ECU not allowing it");
|
logging.println("ERROR: BMS reset failed due to contactors not being open, or BMS ECU not allowing it");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -141,8 +141,8 @@ typedef struct {
|
||||||
/** Tesla specific settings that are edited on the fly when manually forcing a balance charge for LFP chemistry */
|
/** Tesla specific settings that are edited on the fly when manually forcing a balance charge for LFP chemistry */
|
||||||
/* Bool for specifying if user has requested manual function */
|
/* Bool for specifying if user has requested manual function */
|
||||||
bool user_requests_balancing = false;
|
bool user_requests_balancing = false;
|
||||||
bool user_requests_isolation_clear = false;
|
bool user_requests_tesla_isolation_clear = false;
|
||||||
bool user_requests_bms_ecu_reset = false;
|
bool user_requests_tesla_bms_reset = false;
|
||||||
/* Forced balancing max time & start timestamp */
|
/* Forced balancing max time & start timestamp */
|
||||||
uint32_t balancing_time_ms = 3600000; //1h default, (60min*60sec*1000ms)
|
uint32_t balancing_time_ms = 3600000; //1h default, (60min*60sec*1000ms)
|
||||||
uint32_t balancing_start_time_ms = 0; //For keeping track when balancing started
|
uint32_t balancing_start_time_ms = 0; //For keeping track when balancing started
|
||||||
|
|
|
@ -656,8 +656,8 @@ String advanced_battery_processor(const String& var) {
|
||||||
static const char* Fault[] = {"NOT_ACTIVE", "ACTIVE"};
|
static const char* Fault[] = {"NOT_ACTIVE", "ACTIVE"};
|
||||||
|
|
||||||
//Buttons for user action
|
//Buttons for user action
|
||||||
content += "<button onclick='askClearIsolation()'>Clear isolation fault</button>";
|
content += "<button onclick='askTeslaClearIsolation()'>Clear isolation fault</button>";
|
||||||
content += "<button onclick='askBMSReset()'>BMS reset</button>";
|
content += "<button onclick='askTeslaResetBMS()'>BMS reset</button>";
|
||||||
//0x20A 522 HVP_contatorState
|
//0x20A 522 HVP_contatorState
|
||||||
content += "<h4>Contactor Status: " + String(contactorText[datalayer_extended.tesla.status_contactor]) + "</h4>";
|
content += "<h4>Contactor Status: " + String(contactorText[datalayer_extended.tesla.status_contactor]) + "</h4>";
|
||||||
content += "<h4>HVIL: " + String(hvilStatusState[datalayer_extended.tesla.hvil_status]) + "</h4>";
|
content += "<h4>HVIL: " + String(hvilStatusState[datalayer_extended.tesla.hvil_status]) + "</h4>";
|
||||||
|
@ -1454,24 +1454,24 @@ String advanced_battery_processor(const String& var) {
|
||||||
content += "</div>";
|
content += "</div>";
|
||||||
content += "<script>";
|
content += "<script>";
|
||||||
content +=
|
content +=
|
||||||
"function askClearIsolation() { if (window.confirm('Are you sure you want to clear any active isolation "
|
"function askTeslaClearIsolation() { if (window.confirm('Are you sure you want to clear any active isolation "
|
||||||
"fault?')) { "
|
"fault?')) { "
|
||||||
"clearIsolation(); } }";
|
"teslaClearIsolation(); } }";
|
||||||
content += "function clearIsolation() {";
|
content += "function teslaClearIsolation() {";
|
||||||
content += " var xhr = new XMLHttpRequest();";
|
content += " var xhr = new XMLHttpRequest();";
|
||||||
content += " xhr.open('GET', '/clearIsolation', true);";
|
content += " xhr.open('GET', '/teslaClearIsolation', true);";
|
||||||
content += " xhr.send();";
|
content += " xhr.send();";
|
||||||
content += "}";
|
content += "}";
|
||||||
content += "function goToMainPage() { window.location.href = '/'; }";
|
content += "function goToMainPage() { window.location.href = '/'; }";
|
||||||
content += "</script>";
|
content += "</script>";
|
||||||
content += "<script>";
|
content += "<script>";
|
||||||
content +=
|
content +=
|
||||||
"function askBMSReset() { if (window.confirm('Are you sure you want to reset the BMS "
|
"function askTeslaResetBMS() { if (window.confirm('Are you sure you want to reset the "
|
||||||
"ECU?')) { "
|
"BMS?')) { "
|
||||||
"bmsECUReset(); } }";
|
"teslaResetBMS(); } }";
|
||||||
content += "function bmsECUReset() {";
|
content += "function teslaResetBMS() {";
|
||||||
content += " var xhr = new XMLHttpRequest();";
|
content += " var xhr = new XMLHttpRequest();";
|
||||||
content += " xhr.open('GET', '/bmsECUReset', true);";
|
content += " xhr.open('GET', '/teslaResetBMS', true);";
|
||||||
content += " xhr.send();";
|
content += " xhr.send();";
|
||||||
content += "}";
|
content += "}";
|
||||||
content += "function goToMainPage() { window.location.href = '/'; }";
|
content += "function goToMainPage() { window.location.href = '/'; }";
|
||||||
|
|
|
@ -571,20 +571,20 @@ void init_webserver() {
|
||||||
});
|
});
|
||||||
|
|
||||||
// Route for clearing isolation faults on Tesla
|
// Route for clearing isolation faults on Tesla
|
||||||
server.on("/clearIsolation", HTTP_GET, [](AsyncWebServerRequest* request) {
|
server.on("/teslaClearIsolation", HTTP_GET, [](AsyncWebServerRequest* request) {
|
||||||
if (WEBSERVER_AUTH_REQUIRED && !request->authenticate(http_username, http_password)) {
|
if (WEBSERVER_AUTH_REQUIRED && !request->authenticate(http_username, http_password)) {
|
||||||
return request->requestAuthentication();
|
return request->requestAuthentication();
|
||||||
}
|
}
|
||||||
datalayer.battery.settings.user_requests_isolation_clear = true;
|
datalayer.battery.settings.user_requests_tesla_isolation_clear = true;
|
||||||
request->send(200, "text/plain", "Updated successfully");
|
request->send(200, "text/plain", "Updated successfully");
|
||||||
});
|
});
|
||||||
|
|
||||||
// Route for resetting BMS ECU on Tesla
|
// Route for resetting BMS on Tesla
|
||||||
server.on("/bmsECUReset", HTTP_GET, [](AsyncWebServerRequest* request) {
|
server.on("/teslaResetBMS", HTTP_GET, [](AsyncWebServerRequest* request) {
|
||||||
if (WEBSERVER_AUTH_REQUIRED && !request->authenticate(http_username, http_password)) {
|
if (WEBSERVER_AUTH_REQUIRED && !request->authenticate(http_username, http_password)) {
|
||||||
return request->requestAuthentication();
|
return request->requestAuthentication();
|
||||||
}
|
}
|
||||||
datalayer.battery.settings.user_requests_bms_ecu_reset = true;
|
datalayer.battery.settings.user_requests_tesla_bms_reset = true;
|
||||||
request->send(200, "text/plain", "Updated successfully");
|
request->send(200, "text/plain", "Updated successfully");
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue