Browse Source

0.8.92

* fix read back of limit value, now with one decimal place
pull/1512/head
lumapu 7 months ago
parent
commit
3dd1b4e73b
  1. 3
      src/CHANGES.md
  2. 2
      src/defines.h
  3. 2
      src/hm/hmInverter.h
  4. 4
      src/utils/helper.cpp
  5. 1
      src/utils/helper.h
  6. 2
      src/web/RestApi.h
  7. 2
      src/web/html/visualization.html

3
src/CHANGES.md

@ -1,5 +1,8 @@
# Development Changes # 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 ## 0.8.91 - 2024-03-05
* fix javascript issues #1480 * fix javascript issues #1480

2
src/defines.h

@ -13,7 +13,7 @@
//------------------------------------- //-------------------------------------
#define VERSION_MAJOR 0 #define VERSION_MAJOR 0
#define VERSION_MINOR 8 #define VERSION_MINOR 8
#define VERSION_PATCH 91 #define VERSION_PATCH 92
//------------------------------------- //-------------------------------------
typedef struct { typedef struct {

2
src/hm/hmInverter.h

@ -335,7 +335,7 @@ class Inverter {
// eg. hw version ... // eg. hw version ...
} else if (rec->assign == SystemConfigParaAssignment) { } else if (rec->assign == SystemConfigParaAssignment) {
DPRINTLN(DBG_DEBUG, "add config"); 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]; actPowerLimit = rec->record[pos];
DPRINT(DBG_DEBUG, F("Inverter actual power limit: ")); DPRINT(DBG_DEBUG, F("Inverter actual power limit: "));
DPRINTLN(DBG_DEBUG, String(actPowerLimit, 1)); DPRINTLN(DBG_DEBUG, String(actPowerLimit, 1));

4
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]); 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) { double round3(double value) {
return (int)(value * 1000 + 0.5) / 1000.0; return (int)(value * 1000 + 0.5) / 1000.0;
} }

1
src/utils/helper.h

@ -39,6 +39,7 @@ static Timezone gTimezone(CEST, CET);
namespace ah { namespace ah {
void ip2Arr(uint8_t ip[], const char *ipStr); void ip2Arr(uint8_t ip[], const char *ipStr);
void ip2Char(uint8_t ip[], char *str); void ip2Char(uint8_t ip[], char *str);
double round1(double value);
double round3(double value); double round3(double value);
String getDateTimeStr(time_t t); String getDateTimeStr(time_t t);
String getDateTimeStrShort(time_t t); String getDateTimeStrShort(time_t t);

2
src/web/RestApi.h

@ -499,7 +499,7 @@ class RestApi {
obj[F("name")] = String(iv->config->name); obj[F("name")] = String(iv->config->name);
obj[F("serial")] = String(iv->config->serial.u64, HEX); obj[F("serial")] = String(iv->config->serial.u64, HEX);
obj[F("version")] = String(iv->getFwVersion()); 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("power_limit_ack")] = iv->powerLimitAck;
obj[F("max_pwr")] = iv->getMaxPower(); obj[F("max_pwr")] = iv->getMaxPower();
obj[F("ts_last_success")] = rec->ts; obj[F("ts_last_success")] = rec->ts;

2
src/web/html/visualization.html

@ -116,7 +116,7 @@
if(65535 != obj.power_limit_read) { if(65535 != obj.power_limit_read) {
pwrLimit = obj.power_limit_read + " %"; pwrLimit = obj.power_limit_read + " %";
if(0 != obj.max_pwr) 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)); var maxAcPwr = toIsoDateStr(new Date(obj.ts_max_ac_pwr * 1000));

Loading…
Cancel
Save