Merge branch 'main' into feature/double-battery

This commit is contained in:
Daniel Öster 2024-07-23 16:37:15 +03:00 committed by GitHub
commit 1bf6167757
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 55 additions and 27 deletions

View file

@ -123,7 +123,7 @@ void init_webserver() {
server.on("/updateSocMax", HTTP_GET, [](AsyncWebServerRequest* request) {
if (request->hasParam("value")) {
String value = request->getParam("value")->value();
datalayer.battery.settings.max_percentage = value.toInt() * 100;
datalayer.battery.settings.max_percentage = static_cast<uint16_t>(value.toFloat() * 100);
storeSettings();
request->send(200, "text/plain", "Updated successfully");
} else {
@ -135,7 +135,7 @@ void init_webserver() {
server.on("/updateSocMin", HTTP_GET, [](AsyncWebServerRequest* request) {
if (request->hasParam("value")) {
String value = request->getParam("value")->value();
datalayer.battery.settings.min_percentage = value.toInt() * 100;
datalayer.battery.settings.min_percentage = static_cast<uint16_t>(value.toFloat() * 100);
storeSettings();
request->send(200, "text/plain", "Updated successfully");
} else {
@ -147,7 +147,7 @@ void init_webserver() {
server.on("/updateMaxChargeA", HTTP_GET, [](AsyncWebServerRequest* request) {
if (request->hasParam("value")) {
String value = request->getParam("value")->value();
datalayer.battery.info.max_charge_amp_dA = value.toInt() * 10;
datalayer.battery.info.max_charge_amp_dA = static_cast<uint16_t>(value.toFloat() * 10);
storeSettings();
request->send(200, "text/plain", "Updated successfully");
} else {
@ -159,7 +159,7 @@ void init_webserver() {
server.on("/updateMaxDischargeA", HTTP_GET, [](AsyncWebServerRequest* request) {
if (request->hasParam("value")) {
String value = request->getParam("value")->value();
datalayer.battery.info.max_discharge_amp_dA = value.toInt() * 10;
datalayer.battery.info.max_discharge_amp_dA = static_cast<uint16_t>(value.toFloat() * 10);
storeSettings();
request->send(200, "text/plain", "Updated successfully");
} else {