From 0118fd1431176e2add1d1421e45af2b005c6bd00 Mon Sep 17 00:00:00 2001 From: lumapu Date: Sun, 18 Jun 2023 01:03:55 +0200 Subject: [PATCH] fix yield correction (data type was not correct during save) --- src/config/settings.h | 2 +- src/web/RestApi.h | 2 +- src/web/html/setup.html | 2 +- src/web/web.h | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/config/settings.h b/src/config/settings.h index 2fdcab0e..2f35295d 100644 --- a/src/config/settings.h +++ b/src/config/settings.h @@ -132,7 +132,7 @@ typedef struct { char name[MAX_NAME_LENGTH]; serial_u serial; uint16_t chMaxPwr[6]; - double yieldCor[6]; // signed YieldTotal correction value + double yieldCor[6]; // YieldTotal correction value char chName[6][MAX_NAME_LENGTH]; } cfgIv_t; diff --git a/src/web/RestApi.h b/src/web/RestApi.h index e2fefd86..20a7245d 100644 --- a/src/web/RestApi.h +++ b/src/web/RestApi.h @@ -315,7 +315,7 @@ class RestApi { obj2[F("version")] = String(iv->getFwVersion()); for(uint8_t j = 0; j < iv->channels; j ++) { - obj2[F("ch_yield_cor")][j] = iv->config->yieldCor[j]; + obj2[F("ch_yield_cor")][j] = (double)iv->config->yieldCor[j]; obj2[F("ch_name")][j] = iv->config->chName[j]; obj2[F("ch_max_pwr")][j] = iv->config->chMaxPwr[j]; } diff --git a/src/web/html/setup.html b/src/web/html/setup.html index c968e390..4f1f7b6a 100644 --- a/src/web/html/setup.html +++ b/src/web/html/setup.html @@ -593,7 +593,7 @@ for(var j of [ ["ModPwr", "ch_max_pwr", "Max Module Power (Wp)", 4, "[0-9]+"], ["ModName", "ch_name", "Module Name", 15, null], - ["YieldCor", "ch_yield_cor", "Yield Total Correction [kWh]", 8, "[0-9-]+"]]) { + ["YieldCor", "ch_yield_cor", "Yield Total Correction [kWh]", 8, "[0-9-\.]+"]]) { var cl = (re.test(obj["serial"])) ? "" : " hide"; diff --git a/src/web/web.h b/src/web/web.h index 92b024ac..b8841f2e 100644 --- a/src/web/web.h +++ b/src/web/web.h @@ -509,7 +509,7 @@ class Web { // max channel power / name for (uint8_t j = 0; j < 6; j++) { - iv->config->yieldCor[j] = request->arg("inv" + String(i) + "YieldCor" + String(j)).toInt(); + iv->config->yieldCor[j] = request->arg("inv" + String(i) + "YieldCor" + String(j)).toDouble(); iv->config->chMaxPwr[j] = request->arg("inv" + String(i) + "ModPwr" + String(j)).toInt() & 0xffff; request->arg("inv" + String(i) + "ModName" + String(j)).toCharArray(iv->config->chName[j], MAX_NAME_LENGTH); }