diff --git a/src/CHANGES.md b/src/CHANGES.md index 876e7f93..e78ddd66 100644 --- a/src/CHANGES.md +++ b/src/CHANGES.md @@ -1,5 +1,8 @@ # Development Changes +## 0.8.92 - 2024-03-10 +* fix read back of limit value, now with one decimal place + ## 0.8.91 - 2024-03-05 * fix javascript issues #1480 diff --git a/src/defines.h b/src/defines.h index 0d1509cc..bfe29c7a 100644 --- a/src/defines.h +++ b/src/defines.h @@ -13,7 +13,7 @@ //------------------------------------- #define VERSION_MAJOR 0 #define VERSION_MINOR 8 -#define VERSION_PATCH 91 +#define VERSION_PATCH 92 //------------------------------------- typedef struct { diff --git a/src/hm/hmInverter.h b/src/hm/hmInverter.h index 4252800d..1d7e6620 100644 --- a/src/hm/hmInverter.h +++ b/src/hm/hmInverter.h @@ -335,7 +335,7 @@ class Inverter { // eg. hw version ... } else if (rec->assign == SystemConfigParaAssignment) { DPRINTLN(DBG_DEBUG, "add config"); - if (getPosByChFld(0, FLD_ACT_ACTIVE_PWR_LIMIT, rec) == pos){ + if (getPosByChFld(0, FLD_ACT_ACTIVE_PWR_LIMIT, rec) == pos) { actPowerLimit = rec->record[pos]; DPRINT(DBG_DEBUG, F("Inverter actual power limit: ")); DPRINTLN(DBG_DEBUG, String(actPowerLimit, 1)); diff --git a/src/utils/helper.cpp b/src/utils/helper.cpp index 24a4d9ee..c49e6159 100644 --- a/src/utils/helper.cpp +++ b/src/utils/helper.cpp @@ -28,6 +28,10 @@ namespace ah { snprintf(str, 16, "%d.%d.%d.%d", ip[0], ip[1], ip[2], ip[3]); } + double round1(double value) { + return (int)(value * 10 + 0.5) / 10.0; + } + double round3(double value) { return (int)(value * 1000 + 0.5) / 1000.0; } diff --git a/src/utils/helper.h b/src/utils/helper.h index 1dbba3d9..5683cdfa 100644 --- a/src/utils/helper.h +++ b/src/utils/helper.h @@ -39,6 +39,7 @@ static Timezone gTimezone(CEST, CET); namespace ah { void ip2Arr(uint8_t ip[], const char *ipStr); void ip2Char(uint8_t ip[], char *str); + double round1(double value); double round3(double value); String getDateTimeStr(time_t t); String getDateTimeStrShort(time_t t); diff --git a/src/web/RestApi.h b/src/web/RestApi.h index f6917077..f7a87e4d 100644 --- a/src/web/RestApi.h +++ b/src/web/RestApi.h @@ -499,7 +499,7 @@ class RestApi { obj[F("name")] = String(iv->config->name); obj[F("serial")] = String(iv->config->serial.u64, HEX); obj[F("version")] = String(iv->getFwVersion()); - obj[F("power_limit_read")] = iv->actPowerLimit; + obj[F("power_limit_read")] = ah::round1(iv->getChannelFieldValue(CH0, FLD_ACT_ACTIVE_PWR_LIMIT, iv->getRecordStruct(SystemConfigPara))); obj[F("power_limit_ack")] = iv->powerLimitAck; obj[F("max_pwr")] = iv->getMaxPower(); obj[F("ts_last_success")] = rec->ts; diff --git a/src/web/html/visualization.html b/src/web/html/visualization.html index 81962add..aec6b0d8 100644 --- a/src/web/html/visualization.html +++ b/src/web/html/visualization.html @@ -116,7 +116,7 @@ if(65535 != obj.power_limit_read) { pwrLimit = obj.power_limit_read + " %"; if(0 != obj.max_pwr) - pwrLimit += ", " + Math.round(obj.max_pwr * obj.power_limit_read / 100) + " W"; + pwrLimit += ", " + (obj.max_pwr * obj.power_limit_read / 100) + " W"; } var maxAcPwr = toIsoDateStr(new Date(obj.ts_max_ac_pwr * 1000));