mirror of
https://github.com/dalathegreat/Battery-Emulator.git
synced 2025-10-04 18:29:48 +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
|
||||
|
||||
// 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
|
||||
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) {
|
||||
stateMachineBMSReset =
|
||||
0; //Start the BMS ECU reset statemachine, only if contactors are OPEN and BMS ECU allows it
|
||||
datalayer.battery.settings.user_requests_bms_ecu_reset = false;
|
||||
//Start the BMS ECU reset statemachine, only if contactors are OPEN and BMS ECU allows it
|
||||
stateMachineBMSReset = 0;
|
||||
datalayer.battery.settings.user_requests_tesla_bms_reset = false;
|
||||
} 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 */
|
||||
/* Bool for specifying if user has requested manual function */
|
||||
bool user_requests_balancing = false;
|
||||
bool user_requests_isolation_clear = false;
|
||||
bool user_requests_bms_ecu_reset = false;
|
||||
bool user_requests_tesla_isolation_clear = false;
|
||||
bool user_requests_tesla_bms_reset = false;
|
||||
/* Forced balancing max time & start timestamp */
|
||||
uint32_t balancing_time_ms = 3600000; //1h default, (60min*60sec*1000ms)
|
||||
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"};
|
||||
|
||||
//Buttons for user action
|
||||
content += "<button onclick='askClearIsolation()'>Clear isolation fault</button>";
|
||||
content += "<button onclick='askBMSReset()'>BMS reset</button>";
|
||||
content += "<button onclick='askTeslaClearIsolation()'>Clear isolation fault</button>";
|
||||
content += "<button onclick='askTeslaResetBMS()'>BMS reset</button>";
|
||||
//0x20A 522 HVP_contatorState
|
||||
content += "<h4>Contactor Status: " + String(contactorText[datalayer_extended.tesla.status_contactor]) + "</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 += "<script>";
|
||||
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?')) { "
|
||||
"clearIsolation(); } }";
|
||||
content += "function clearIsolation() {";
|
||||
"teslaClearIsolation(); } }";
|
||||
content += "function teslaClearIsolation() {";
|
||||
content += " var xhr = new XMLHttpRequest();";
|
||||
content += " xhr.open('GET', '/clearIsolation', true);";
|
||||
content += " xhr.open('GET', '/teslaClearIsolation', true);";
|
||||
content += " xhr.send();";
|
||||
content += "}";
|
||||
content += "function goToMainPage() { window.location.href = '/'; }";
|
||||
content += "</script>";
|
||||
content += "<script>";
|
||||
content +=
|
||||
"function askBMSReset() { if (window.confirm('Are you sure you want to reset the BMS "
|
||||
"ECU?')) { "
|
||||
"bmsECUReset(); } }";
|
||||
content += "function bmsECUReset() {";
|
||||
"function askTeslaResetBMS() { if (window.confirm('Are you sure you want to reset the "
|
||||
"BMS?')) { "
|
||||
"teslaResetBMS(); } }";
|
||||
content += "function teslaResetBMS() {";
|
||||
content += " var xhr = new XMLHttpRequest();";
|
||||
content += " xhr.open('GET', '/bmsECUReset', true);";
|
||||
content += " xhr.open('GET', '/teslaResetBMS', true);";
|
||||
content += " xhr.send();";
|
||||
content += "}";
|
||||
content += "function goToMainPage() { window.location.href = '/'; }";
|
||||
|
|
|
@ -571,20 +571,20 @@ void init_webserver() {
|
|||
});
|
||||
|
||||
// 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)) {
|
||||
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");
|
||||
});
|
||||
|
||||
// Route for resetting BMS ECU on Tesla
|
||||
server.on("/bmsECUReset", HTTP_GET, [](AsyncWebServerRequest* request) {
|
||||
// Route for resetting BMS on Tesla
|
||||
server.on("/teslaResetBMS", HTTP_GET, [](AsyncWebServerRequest* request) {
|
||||
if (WEBSERVER_AUTH_REQUIRED && !request->authenticate(http_username, http_password)) {
|
||||
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");
|
||||
});
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue