mirror of
https://github.com/dalathegreat/Battery-Emulator.git
synced 2025-10-03 17:59:27 +02:00
Merge branch 'main' into common-final
This commit is contained in:
commit
5b88ee03a5
5 changed files with 20 additions and 15 deletions
|
@ -150,6 +150,13 @@ void BydAttoBattery::
|
|||
datalayer_battery->status.voltage_dV = BMS_voltage * 10;
|
||||
}
|
||||
|
||||
if (battery_type == EXTENDED_RANGE) {
|
||||
battery_estimated_SOC = estimateSOCextended(datalayer_battery->status.voltage_dV);
|
||||
}
|
||||
if (battery_type == STANDARD_RANGE) {
|
||||
battery_estimated_SOC = estimateSOCstandard(datalayer_battery->status.voltage_dV);
|
||||
}
|
||||
|
||||
if (SOC_method == MEASURED) {
|
||||
// Pack is not crashed, we can use periodically transmitted SOC
|
||||
datalayer_battery->status.real_soc = battery_highprecision_SOC * 10;
|
||||
|
@ -157,12 +164,7 @@ void BydAttoBattery::
|
|||
// When the battery is crashed hard, it locks itself and SOC becomes unavailable.
|
||||
// We instead estimate the SOC% based on the battery voltage.
|
||||
// This is a bad solution, you wont be able to use 100% of the battery
|
||||
if (battery_type == EXTENDED_RANGE) {
|
||||
datalayer_battery->status.real_soc = estimateSOCextended(datalayer_battery->status.voltage_dV);
|
||||
}
|
||||
if (battery_type == STANDARD_RANGE) {
|
||||
datalayer_battery->status.real_soc = estimateSOCstandard(datalayer_battery->status.voltage_dV);
|
||||
}
|
||||
datalayer_battery->status.real_soc = battery_estimated_SOC;
|
||||
}
|
||||
|
||||
datalayer_battery->status.current_dA = -BMS_current;
|
||||
|
@ -254,8 +256,7 @@ void BydAttoBattery::
|
|||
// Update webserver datalayer
|
||||
if (datalayer_bydatto) {
|
||||
datalayer_bydatto->SOC_method = SOC_method;
|
||||
datalayer_bydatto->SOC_estimated = datalayer_battery->status.real_soc;
|
||||
//Once we implement switching logic, remember to change from where the estimated is taken
|
||||
datalayer_bydatto->SOC_estimated = battery_estimated_SOC;
|
||||
datalayer_bydatto->SOC_highprec = battery_highprecision_SOC;
|
||||
datalayer_bydatto->SOC_polled = BMS_SOC;
|
||||
datalayer_bydatto->voltage_periodic = battery_voltage;
|
||||
|
|
|
@ -103,6 +103,7 @@ class BydAttoBattery : public CanBattery {
|
|||
int16_t battery_calc_min_temperature = 0;
|
||||
int16_t battery_calc_max_temperature = 0;
|
||||
uint16_t battery_highprecision_SOC = 0;
|
||||
uint16_t battery_estimated_SOC = 0;
|
||||
uint16_t BMS_SOC = 0;
|
||||
uint16_t BMS_voltage = 0;
|
||||
int16_t BMS_current = 0;
|
||||
|
|
|
@ -84,6 +84,7 @@ String advanced_battery_processor(const String& var) {
|
|||
"button { background-color: #505E67; color: white; border: none; padding: 10px 20px; margin-bottom: 20px; "
|
||||
"cursor: pointer; border-radius: 10px; }";
|
||||
content += "button:hover { background-color: #3A4A52; }";
|
||||
content += "h4 { margin: 0.6em 0; line-height: 1.2; }";
|
||||
content += "</style>";
|
||||
content += "<button onclick='goToMainPage()'>Back to main page</button>";
|
||||
|
||||
|
|
|
@ -77,6 +77,7 @@ String settings_processor(const String& var) {
|
|||
"button { background-color: #505E67; color: white; border: none; padding: 10px 20px; margin-bottom: 20px; "
|
||||
"cursor: pointer; border-radius: 10px; }";
|
||||
content += "button:hover { background-color: #3A4A52; }";
|
||||
content += "h4 { margin: 0.6em 0; line-height: 1.2; }";
|
||||
content += "</style>";
|
||||
|
||||
content += "<button onclick='goToMainPage()'>Back to main page</button>";
|
||||
|
|
|
@ -952,20 +952,21 @@ String get_firmware_info_processor(const String& var) {
|
|||
String processor(const String& var) {
|
||||
if (var == "X") {
|
||||
String content = "";
|
||||
content += "<h2>" + String(ssidAP) + "</h2>"; // ssidAP name is used as header name
|
||||
//Page format
|
||||
content += "<style>";
|
||||
content += "body { background-color: black; color: white; }";
|
||||
content +=
|
||||
"button { background-color: #505E67; color: white; border: none; padding: 10px 20px; margin-bottom: 20px; "
|
||||
"cursor: pointer; border-radius: 10px; }";
|
||||
content += "button:hover { background-color: #3A4A52; }";
|
||||
content += "h2 { font-size: 1.2em; margin: 0.3em 0 0.5em 0; }";
|
||||
content += "h4 { margin: 0.6em 0; line-height: 1.2; }";
|
||||
content += "</style>";
|
||||
|
||||
// Start a new block with a specific background color
|
||||
content += "<div style='background-color: #303E47; padding: 10px; margin-bottom: 10px;border-radius: 50px'>";
|
||||
// Compact header
|
||||
content += "<h2>" + String(ssidAP) + "</h2>";
|
||||
|
||||
// Show version number
|
||||
// Start content block
|
||||
content += "<div style='background-color: #303E47; padding: 10px; margin-bottom: 10px; border-radius: 50px'>";
|
||||
content += "<h4>Software: " + String(version_number);
|
||||
|
||||
#ifdef COMMON_IMAGE
|
||||
|
@ -1528,14 +1529,14 @@ String processor(const String& var) {
|
|||
content += "<button onclick='logout()'>Logout</button>";
|
||||
if (!datalayer.system.settings.equipment_stop_active)
|
||||
content +=
|
||||
"<br/><br/><button style=\"background:red;color:white;cursor:pointer;\""
|
||||
"<br/><button style=\"background:red;color:white;cursor:pointer;\""
|
||||
" onclick=\""
|
||||
"if(confirm('This action will attempt to open contactors on the battery. Are you "
|
||||
"sure?')) { estop(true); }\""
|
||||
">Open Contactors</button><br/>";
|
||||
else
|
||||
content +=
|
||||
"<br/><br/><button style=\"background:green;color:white;cursor:pointer;\""
|
||||
"<br/><button style=\"background:green;color:white;cursor:pointer;\""
|
||||
"20px;font-size:16px;font-weight:bold;cursor:pointer;border-radius:5px; margin:10px;"
|
||||
" onclick=\""
|
||||
"if(confirm('This action will attempt to close contactors and enable power transfer. Are you sure?')) { "
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue