From ea29e49c93cdb1fa017886b441ce0a23d9a73a4e Mon Sep 17 00:00:00 2001 From: lumapu Date: Tue, 2 Jan 2024 00:21:06 +0100 Subject: [PATCH] 0.8.39 * fix MqTT dis_night_comm in the morning #1309 #1286 * seperated offset for sunrise and sunset #1308 * **BREAKING CHANGE**: powerlimit (active power control) now has one decimal place (MqTT / API) #1199 --- src/CHANGES.md | 3 ++- src/hm/Communication.h | 4 ++-- src/hm/hmDefines.h | 4 ++-- src/hm/hmInverter.h | 8 ++++---- src/hm/hmRadio.h | 10 +++++----- src/hms/hmsRadio.h | 10 +++++----- src/web/html/visualization.html | 4 ++-- 7 files changed, 22 insertions(+), 21 deletions(-) diff --git a/src/CHANGES.md b/src/CHANGES.md index 66056890..67e94621 100644 --- a/src/CHANGES.md +++ b/src/CHANGES.md @@ -1,8 +1,9 @@ # Development Changes ## 0.8.39 - 2024-01-01 -* fix MqTT dis_night_comm in the morning #1309 +* fix MqTT dis_night_comm in the morning #1309 #1286 * seperated offset for sunrise and sunset #1308 +* **BREAKING CHANGE**: powerlimit (active power control) now has one decimal place (MqTT / API) #1199 ## 0.8.38 - 2023-12-31 * fix Grid-Profile JSON #1304 diff --git a/src/hm/Communication.h b/src/hm/Communication.h index 9f96533d..79f5d34a 100644 --- a/src/hm/Communication.h +++ b/src/hm/Communication.h @@ -1,5 +1,5 @@ //----------------------------------------------------------------------------- -// 2023 Ahoy, https://github.com/lumpapu/ahoy +// 2024 Ahoy, https://github.com/lumpapu/ahoy // Creative Commons - http://creativecommons.org/licenses/by-nc-sa/4.0/deed //----------------------------------------------------------------------------- @@ -392,7 +392,7 @@ class Communication : public CommQueue<> { DBGPRINT(F("has ")); if(!accepted) DBGPRINT(F("not ")); DBGPRINT(F("accepted power limit set point ")); - DBGPRINT(String(q->iv->powerLimit[0])); + DBGPRINT(String(q->iv->powerLimit[0]/10)); DBGPRINT(F(" with PowerLimitControl ")); DBGPRINTLN(String(q->iv->powerLimit[1])); q->iv->actPowerLimit = 0xffff; // unknown, readback current value diff --git a/src/hm/hmDefines.h b/src/hm/hmDefines.h index 55259289..a2a2d6b4 100644 --- a/src/hm/hmDefines.h +++ b/src/hm/hmDefines.h @@ -1,6 +1,6 @@ //----------------------------------------------------------------------------- -// 2023 Ahoy, https://github.com/lumpapu/ahoy -// Creative Commons - http://creativecommons.org/licenses/by-nc-sa/3.0/de/ +// 2024 Ahoy, https://github.com/lumpapu/ahoy +// Creative Commons - http://creativecommons.org/licenses/by-nc-sa/4.0/deed //----------------------------------------------------------------------------- #ifndef __HM_DEFINES_H__ diff --git a/src/hm/hmInverter.h b/src/hm/hmInverter.h index 776b9c6f..fa8e1b87 100644 --- a/src/hm/hmInverter.h +++ b/src/hm/hmInverter.h @@ -1,6 +1,6 @@ //----------------------------------------------------------------------------- -// 2023 Ahoy, https://www.mikrocontroller.net/topic/525778 -// Creative Commons - http://creativecommons.org/licenses/by-nc-sa/3.0/de/ +// 2024 Ahoy, https://www.mikrocontroller.net/topic/525778 +// Creative Commons - http://creativecommons.org/licenses/by-nc-sa/4.0/deed //----------------------------------------------------------------------------- #ifndef __HM_INVERTER_H__ @@ -110,7 +110,7 @@ class Inverter { uint8_t id; // unique id uint8_t type; // integer which refers to inverter type uint16_t alarmMesIndex; // Last recorded Alarm Message Index - uint16_t powerLimit[2]; // limit power output + uint16_t powerLimit[2]; // limit power output (multiplied by 10) float actPowerLimit; // actual power limit bool powerLimitAck; // acknowledged power limit (default: false) uint8_t devControlCmd; // carries the requested cmd @@ -152,7 +152,7 @@ class Inverter { Inverter() { ivGen = IV_HM; - powerLimit[0] = 0xffff; // 65535 W Limit -> unlimited + powerLimit[0] = 0xffff; // 6553.5 W Limit -> unlimited powerLimit[1] = AbsolutNonPersistent; // default power limit setting powerLimitAck = false; actPowerLimit = 0xffff; // init feedback from inverter to -1 diff --git a/src/hm/hmRadio.h b/src/hm/hmRadio.h index 0754f83c..6539dd21 100644 --- a/src/hm/hmRadio.h +++ b/src/hm/hmRadio.h @@ -1,5 +1,5 @@ //----------------------------------------------------------------------------- -// 2023 Ahoy, https://github.com/lumpapu/ahoy +// 2024 Ahoy, https://github.com/lumpapu/ahoy // Creative Commons - http://creativecommons.org/licenses/by-nc-sa/4.0/deed //----------------------------------------------------------------------------- @@ -177,10 +177,10 @@ class HmRadio : public Radio { mTxBuf[cnt++] = cmd; // cmd -> 0 on, 1 off, 2 restart, 11 active power, 12 reactive power, 13 power factor mTxBuf[cnt++] = 0x00; if(cmd >= ActivePowerContr && cmd <= PFSet) { // ActivePowerContr, ReactivePowerContr, PFSet - mTxBuf[cnt++] = ((data[0] * 10) >> 8) & 0xff; // power limit - mTxBuf[cnt++] = ((data[0] * 10) ) & 0xff; // power limit - mTxBuf[cnt++] = ((data[1] ) >> 8) & 0xff; // setting for persistens handlings - mTxBuf[cnt++] = ((data[1] ) ) & 0xff; // setting for persistens handling + mTxBuf[cnt++] = (data[0] >> 8) & 0xff; // power limit, multiplied by 10 (because of fraction) + mTxBuf[cnt++] = (data[0] ) & 0xff; // power limit + mTxBuf[cnt++] = (data[1] >> 8) & 0xff; // setting for persistens handlings + mTxBuf[cnt++] = (data[1] ) & 0xff; // setting for persistens handling } } else { //MI 2nd gen. specific uint16_t powerMax = ((iv->powerLimit[1] == RelativNonPersistent) ? 0 : iv->getMaxPower()); diff --git a/src/hms/hmsRadio.h b/src/hms/hmsRadio.h index d2779012..6b502816 100644 --- a/src/hms/hmsRadio.h +++ b/src/hms/hmsRadio.h @@ -1,5 +1,5 @@ //----------------------------------------------------------------------------- -// 2023 Ahoy, https://github.com/lumpapu/ahoy +// 2024 Ahoy, https://github.com/lumpapu/ahoy // Creative Commons - https://creativecommons.org/licenses/by-nc-sa/4.0/deed //----------------------------------------------------------------------------- @@ -50,10 +50,10 @@ class CmtRadio : public Radio { mTxBuf[cnt++] = cmd; // cmd -> 0 on, 1 off, 2 restart, 11 active power, 12 reactive power, 13 power factor mTxBuf[cnt++] = 0x00; if(cmd >= ActivePowerContr && cmd <= PFSet) { // ActivePowerContr, ReactivePowerContr, PFSet - mTxBuf[cnt++] = ((data[0] * 10) >> 8) & 0xff; // power limit - mTxBuf[cnt++] = ((data[0] * 10) ) & 0xff; // power limit - mTxBuf[cnt++] = ((data[1] ) >> 8) & 0xff; // setting for persistens handlings - mTxBuf[cnt++] = ((data[1] ) ) & 0xff; // setting for persistens handling + mTxBuf[cnt++] = (data[0] >> 8) & 0xff; // power limit, multiplied by 10 (because of fraction) + mTxBuf[cnt++] = (data[0] ) & 0xff; // power limit + mTxBuf[cnt++] = (data[1] >> 8) & 0xff; // setting for persistens handlings + mTxBuf[cnt++] = (data[1] ) & 0xff; // setting for persistens handling } sendPacket(iv, cnt, isRetransmit); diff --git a/src/web/html/visualization.html b/src/web/html/visualization.html index 9567504c..d8896e14 100644 --- a/src/web/html/visualization.html +++ b/src/web/html/visualization.html @@ -399,7 +399,7 @@ var html = ml("div", {}, [ ml("div", {class: "row mb-3"}, [ ml("div", {class: "col-12 col-sm-5 my-2"}, "Limit Value"), - ml("div", {class: "col-8 col-sm-5"}, ml("input", {name: "limit", type: "number"}, "")), + ml("div", {class: "col-8 col-sm-5"}, ml("input", {name: "limit", type: "number", step: "0.1", min: 1}, "")), ml("div", {class: "col-4 col-sm-2"}, sel("type", opt, "pct")) ]), ml("div", {class: "row mb-3"}, [ @@ -450,7 +450,7 @@ var obj = new Object(); obj.id = id; obj.cmd = cmd; - obj.val = val; + obj.val = Math.round(val*10); getAjax("/api/ctrl", ctrlCb, "POST", JSON.stringify(obj)); }