mirror of
https://github.com/dalathegreat/Battery-Emulator.git
synced 2025-10-03 17:59:27 +02:00
Data layer introduction (#254)
* Active power, SOH * Total and remaining capacity * pre-commit, baby! * Typo * pre-commit wrestling * Temp min/max * Voltage and current * Min/max design voltage * BMS status, max charge/discharge, cell min/max * BMS status cleanup * Pre-commit, we meet again * Cell voltages and minor fixes * Cell number * SOC * Missed a spot * Event handling moved, Wh bugs fixed, time measurements improved * Pre-commit, old friend... * Battery chemistry * Update TESLA-MODEL-3-BATTERY.cpp * Total capacity/Wh max, soem default values * Good ol' pre-comm * Some prio/core cleanup, docs... * Contactor closing variables * Max charge/discharge amps * Data layer variable documentation * USER_SETTINGS comments * Charger comment * Update datalayer.h
This commit is contained in:
parent
e7f14084e3
commit
0fee07313a
68 changed files with 1097 additions and 1510 deletions
|
@ -1,5 +1,6 @@
|
|||
#include "settings_html.h"
|
||||
#include <Arduino.h>
|
||||
#include "../../datalayer/datalayer.h"
|
||||
|
||||
String settings_processor(const String& var) {
|
||||
if (var == "ABC") {
|
||||
|
@ -13,20 +14,24 @@ String settings_processor(const String& var) {
|
|||
content += "<div style='background-color: #303E47; padding: 10px; margin-bottom: 10px;border-radius: 50px'>";
|
||||
|
||||
// Show current settings with edit buttons and input fields
|
||||
content += "<h4 style='color: white;'>Battery capacity: <span id='BATTERY_WH_MAX'>" + String(BATTERY_WH_MAX) +
|
||||
content += "<h4 style='color: white;'>Battery capacity: <span id='BATTERY_WH_MAX'>" +
|
||||
String(datalayer.battery.info.total_capacity_Wh) +
|
||||
" Wh </span> <button onclick='editWh()'>Edit</button></h4>";
|
||||
content += "<h4 style='color: white;'>Rescale SOC: <span id='USE_SCALED_SOC'>" +
|
||||
String(USE_SCALED_SOC ? "<span>✓</span>" : "<span style='color: red;'>✕</span>") +
|
||||
content += "<h4 style='color: white;'>Rescale SOC: <span id='BATTERY_USE_SCALED_SOC'>" +
|
||||
String(datalayer.battery.settings.soc_scaling_active ? "<span>✓</span>"
|
||||
: "<span style='color: red;'>✕</span>") +
|
||||
"</span> <button onclick='editUseScaledSOC()'>Edit</button></h4>";
|
||||
content += "<h4 style='color: " + String(USE_SCALED_SOC ? "white" : "darkgrey") +
|
||||
";'>SOC max percentage: " + String(MAXPERCENTAGE / 10.0, 1) +
|
||||
content += "<h4 style='color: " + String(datalayer.battery.settings.soc_scaling_active ? "white" : "darkgrey") +
|
||||
";'>SOC max percentage: " + String(datalayer.battery.settings.max_percentage / 100.0, 1) +
|
||||
" </span> <button onclick='editSocMax()'>Edit</button></h4>";
|
||||
content += "<h4 style='color: " + String(USE_SCALED_SOC ? "white" : "darkgrey") +
|
||||
";'>SOC min percentage: " + String(MINPERCENTAGE / 10.0, 1) +
|
||||
content += "<h4 style='color: " + String(datalayer.battery.settings.soc_scaling_active ? "white" : "darkgrey") +
|
||||
";'>SOC min percentage: " + String(datalayer.battery.settings.min_percentage / 100.0, 1) +
|
||||
" </span> <button onclick='editSocMin()'>Edit</button></h4>";
|
||||
content += "<h4 style='color: white;'>Max charge speed: " + String(MAXCHARGEAMP / 10.0, 1) +
|
||||
" A </span> <button onclick='editMaxChargeA()'>Edit</button></h4>";
|
||||
content += "<h4 style='color: white;'>Max discharge speed: " + String(MAXDISCHARGEAMP / 10.0, 1) +
|
||||
content +=
|
||||
"<h4 style='color: white;'>Max charge speed: " + String(datalayer.battery.info.max_charge_amp_dA / 10.0, 1) +
|
||||
" A </span> <button onclick='editMaxChargeA()'>Edit</button></h4>";
|
||||
content += "<h4 style='color: white;'>Max discharge speed: " +
|
||||
String(datalayer.battery.info.max_discharge_amp_dA / 10.0, 1) +
|
||||
" A </span> <button onclick='editMaxDischargeA()'>Edit</button></h4>";
|
||||
// Close the block
|
||||
content += "</div>";
|
||||
|
@ -34,7 +39,8 @@ String settings_processor(const String& var) {
|
|||
#ifdef TEST_FAKE_BATTERY
|
||||
// Start a new block with blue background color
|
||||
content += "<div style='background-color: #2E37AD; padding: 10px; margin-bottom: 10px;border-radius: 50px'>";
|
||||
float voltageFloat = static_cast<float>(system_battery_voltage_dV) / 10.0; // Convert to float and divide by 10
|
||||
float voltageFloat =
|
||||
static_cast<float>(datalayer.battery.status.voltage_dV) / 10.0; // Convert to float and divide by 10
|
||||
content += "<h4 style='color: white;'>Fake battery voltage: " + String(voltageFloat, 1) +
|
||||
" V </span> <button onclick='editFakeBatteryVoltage()'>Edit</button></h4>";
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue