mirror of
https://github.com/dalathegreat/Battery-Emulator.git
synced 2025-10-03 09:49:32 +02:00
Add configurable Tesla options
This commit is contained in:
parent
681b915faa
commit
1ec6af8ea0
5 changed files with 79 additions and 2 deletions
|
@ -317,6 +317,14 @@ void setup_battery() {
|
|||
}
|
||||
#endif
|
||||
|
||||
/* User-selected Tesla settings */
|
||||
bool user_selected_tesla_digital_HVIL = false;
|
||||
uint16_t user_selected_tesla_GTW_country = 0;
|
||||
bool user_selected_tesla_GTW_rightHandDrive = false;
|
||||
uint16_t user_selected_tesla_GTW_mapRegion = 0;
|
||||
uint16_t user_selected_tesla_GTW_chassisType = 0;
|
||||
uint16_t user_selected_tesla_GTW_packEnergy = 0;
|
||||
|
||||
/* User-selected voltages used for custom-BMS batteries (RJXZS etc.) */
|
||||
#if defined(MAX_CUSTOM_PACK_VOLTAGE_DV) && defined(MIN_CUSTOM_PACK_VOLTAGE_DV) && \
|
||||
defined(MAX_CUSTOM_CELL_VOLTAGE_MV) && defined(MIN_CUSTOM_CELL_VOLTAGE_MV)
|
||||
|
|
|
@ -61,4 +61,11 @@ extern uint16_t user_selected_min_pack_voltage_dV;
|
|||
extern uint16_t user_selected_max_cell_voltage_mV;
|
||||
extern uint16_t user_selected_min_cell_voltage_mV;
|
||||
|
||||
extern bool user_selected_tesla_digital_HVIL;
|
||||
extern uint16_t user_selected_tesla_GTW_country;
|
||||
extern bool user_selected_tesla_GTW_rightHandDrive;
|
||||
extern uint16_t user_selected_tesla_GTW_mapRegion;
|
||||
extern uint16_t user_selected_tesla_GTW_chassisType;
|
||||
extern uint16_t user_selected_tesla_GTW_packEnergy;
|
||||
|
||||
#endif
|
||||
|
|
|
@ -103,6 +103,12 @@ void init_stored_settings() {
|
|||
user_selected_inverter_ah_capacity = settings.getUInt("INVAHCAPACITY", 0);
|
||||
user_selected_inverter_battery_type = settings.getUInt("INVBTYPE", 0);
|
||||
user_selected_inverter_ignore_contactors = settings.getBool("INVICNT", false);
|
||||
user_selected_tesla_digital_HVIL = settings.getBool("DIGITALHVIL", false);
|
||||
user_selected_tesla_GTW_country = settings.getUInt("GTWCOUNTRY", 0);
|
||||
user_selected_tesla_GTW_rightHandDrive = settings.getBool("GTWRHD", false);
|
||||
user_selected_tesla_GTW_mapRegion = settings.getUInt("GTWMAPREG", 0);
|
||||
user_selected_tesla_GTW_chassisType = settings.getUInt("GTWCHASSIS", 0);
|
||||
user_selected_tesla_GTW_packEnergy = settings.getUInt("GTWPACK", 0);
|
||||
|
||||
auto readIf = [](const char* settingName) {
|
||||
auto batt1If = (comm_interface)settings.getUInt(settingName, (int)comm_interface::CanNative);
|
||||
|
|
|
@ -500,6 +500,30 @@ String settings_processor(const String& var, BatteryEmulatorSettingsStore& setti
|
|||
return settings.getBool("INVICNT") ? "checked" : "";
|
||||
}
|
||||
|
||||
if (var == "DIGITALHVIL") {
|
||||
return settings.getBool("DIGITALHVIL") ? "checked" : "";
|
||||
}
|
||||
|
||||
if (var == "GTWCOUNTRY") {
|
||||
return String(settings.getUInt("GTWCOUNTRY", 0));
|
||||
}
|
||||
|
||||
if (var == "GTWRHD") {
|
||||
return settings.getBool("GTWRHD") ? "checked" : "";
|
||||
}
|
||||
|
||||
if (var == "GTWMAPREG") {
|
||||
return String(settings.getUInt("GTWMAPREG", 0));
|
||||
}
|
||||
|
||||
if (var == "GTWCHASSIS") {
|
||||
return String(settings.getUInt("GTWCHASSIS", 0));
|
||||
}
|
||||
|
||||
if (var == "GTWPACK") {
|
||||
return String(settings.getUInt("GTWPACK", 0));
|
||||
}
|
||||
|
||||
return String();
|
||||
}
|
||||
|
||||
|
@ -686,6 +710,11 @@ const char* getCANInterfaceName(CAN_Interface interface) {
|
|||
display: contents;
|
||||
}
|
||||
|
||||
form .if-tesla { display: none; }
|
||||
form[data-battery="32"] .if-tesla, form[data-battery="33"] .if-tesla {
|
||||
display: contents;
|
||||
}
|
||||
|
||||
form .if-dblbtr { display: none; }
|
||||
form[data-dblbtr="true"] .if-dblbtr {
|
||||
display: contents;
|
||||
|
@ -735,6 +764,21 @@ const char* getCANInterfaceName(CAN_Interface interface) {
|
|||
%BATTTYPE%
|
||||
</select>
|
||||
|
||||
<div class="if-tesla">
|
||||
<label>Digital HVIL (2024+): </label>
|
||||
<input type='checkbox' name='DIGITALHVIL' value='on' style='margin-left: 0;' %DIGITALHVIL% />
|
||||
<label>Country code: </label>
|
||||
<input name='GTWCOUNTRY' type='text' value="%GTWCOUNTRY%" pattern="^[0-9]{1,2}$" />
|
||||
<label>Right hand drive: </label>
|
||||
<input type='checkbox' name='GTWRHD' value='on' style='margin-left: 0;' %GTWRHD% />
|
||||
<label>Map region: </label>
|
||||
<input name='GTWMAPREG' type='text' value="%GTWMAPREG%" pattern="^[0-9]{1,2}$" />
|
||||
<label>Chassis type: </label>
|
||||
<input name='GTWCHASSIS' type='text' value="%GTWCHASSIS%" pattern="^[0-9]{1,2}$" />
|
||||
<label>Pack type: </label>
|
||||
<input name='GTWPACK' type='text' value="%GTWPACK%" pattern="^[0-9]{1,2}$" />
|
||||
</div>
|
||||
|
||||
<div class="if-battery">
|
||||
<label for='BATTCOMM'>Battery comm I/F: </label><select name='BATTCOMM' id='BATTCOMM'>
|
||||
%BATTCOMM%
|
||||
|
|
|
@ -413,8 +413,8 @@ void init_webserver() {
|
|||
};
|
||||
|
||||
const char* boolSettingNames[] = {
|
||||
"DBLBTR", "CNTCTRL", "CNTCTRLDBL", "PWMCNTCTRL", "PERBMSRESET", "REMBMSRESET",
|
||||
"CANFDASCAN", "WIFIAPENABLED", "MQTTENABLED", "HADISC", "MQTTTOPICS", "INVICNT",
|
||||
"DBLBTR", "CNTCTRL", "CNTCTRLDBL", "PWMCNTCTRL", "PERBMSRESET", "REMBMSRESET", "CANFDASCAN",
|
||||
"WIFIAPENABLED", "MQTTENABLED", "HADISC", "MQTTTOPICS", "INVICNT", "GTWRHD", "DIGITALHVIL",
|
||||
};
|
||||
|
||||
// Handles the form POST from UI to save settings of the common image
|
||||
|
@ -515,6 +515,18 @@ void init_webserver() {
|
|||
} else if (p->name() == "INVBTYPE") {
|
||||
auto type = atoi(p->value().c_str());
|
||||
settings.saveUInt("INVBTYPE", (int)type);
|
||||
} else if (p->name() == "GTWCOUNTRY") {
|
||||
auto type = atoi(p->value().c_str());
|
||||
settings.saveUInt("GTWCOUNTRY", type);
|
||||
} else if (p->name() == "GTWMAPREG") {
|
||||
auto type = atoi(p->value().c_str());
|
||||
settings.saveUInt("GTWMAPREG", type);
|
||||
} else if (p->name() == "GTWCHASSIS") {
|
||||
auto type = atoi(p->value().c_str());
|
||||
settings.saveUInt("GTWCHASSIS", type);
|
||||
} else if (p->name() == "GTWPACK") {
|
||||
auto type = atoi(p->value().c_str());
|
||||
settings.saveUInt("GTWPACK", type);
|
||||
}
|
||||
|
||||
for (auto& boolSetting : boolSettings) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue