Merge pull request #1425 from jonny5532/feature/more-inverter-settings

Make more inverter settings configurable
This commit is contained in:
Daniel Öster 2025-08-25 20:01:37 +03:00 committed by GitHub
commit 4a24f3558f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
14 changed files with 321 additions and 48 deletions

View file

@ -414,7 +414,7 @@ void init_webserver() {
const char* boolSettingNames[] = {
"DBLBTR", "CNTCTRL", "CNTCTRLDBL", "PWMCNTCTRL", "PERBMSRESET", "REMBMSRESET",
"CANFDASCAN", "WIFIAPENABLED", "MQTTENABLED", "HADISC", "MQTTTOPICS",
"CANFDASCAN", "WIFIAPENABLED", "MQTTENABLED", "HADISC", "MQTTTOPICS", "INVICNT",
};
// Handles the form POST from UI to save settings of the common image
@ -494,6 +494,27 @@ void init_webserver() {
settings.saveString("MQTTDEVICENAME", p->value().c_str());
} else if (p->name() == "HADEVICEID") {
settings.saveString("HADEVICEID", p->value().c_str());
} else if (p->name() == "SOFAR_ID") {
auto type = atoi(p->value().c_str());
settings.saveUInt("SOFAR_ID", type);
} else if (p->name() == "INVCELLS") {
auto type = atoi(p->value().c_str());
settings.saveUInt("INVCELLS", type);
} else if (p->name() == "INVMODULES") {
auto type = atoi(p->value().c_str());
settings.saveUInt("INVMODULES", type);
} else if (p->name() == "INVCELLSPER") {
auto type = atoi(p->value().c_str());
settings.saveUInt("INVCELLSPER", type);
} else if (p->name() == "INVVLEVEL") {
auto type = atoi(p->value().c_str());
settings.saveUInt("INVVLEVEL", type);
} else if (p->name() == "INVCAPACITY") {
auto type = atoi(p->value().c_str());
settings.saveUInt("INVCAPACITY", type);
} else if (p->name() == "INVBTYPE") {
auto type = atoi(p->value().c_str());
settings.saveUInt("INVBTYPE", (int)type);
}
for (auto& boolSetting : boolSettings) {
@ -579,10 +600,6 @@ void init_webserver() {
update_string_setting(route, [setter](String value) { setter(value.toInt()); });
};
// Route for editing Sofar ID
update_int_setting("/updateSofarID",
[](int value) { datalayer.battery.settings.sofar_user_specified_battery_id = value; });
// Route for editing Wh
update_int_setting("/updateBatterySize", [](int value) { datalayer.battery.info.total_capacity_Wh = value; });