Browse Source

Merge branch 'development03' into Zero-Export

pull/1155/head
DanielR92 2 years ago
parent
commit
f28843bbbb
  1. 10
      src/CHANGES.md
  2. 6
      src/app.cpp
  3. 8
      src/config/settings.h
  4. 2
      src/defines.h
  5. 2
      src/hm/Communication.h
  6. 2
      src/plugins/Display/Display_Mono.h
  7. 16
      src/publisher/pubMqtt.h
  8. 2
      src/web/html/setup.html
  9. 4
      src/web/html/system.html

10
src/CHANGES.md

@ -1,9 +1,17 @@
# Development Changes # Development Changes
## 0.8.41 - 2024-01-02
* fix display timeout (OLED) to 60s
* change offs to signed value
## 0.8.40 - 2024-01-02
* fix display of sunrise and sunset in `/system` #1308
* fix MqTT set power limit #1313
## 0.8.39 - 2024-01-01 ## 0.8.39 - 2024-01-01
* fix MqTT dis_night_comm in the morning #1309 #1286 * fix MqTT dis_night_comm in the morning #1309 #1286
* seperated offset for sunrise and sunset #1308 * seperated offset for sunrise and sunset #1308
* **BREAKING CHANGE**: powerlimit (active power control) now has one decimal place (MqTT / API) #1199 * powerlimit (active power control) now has one decimal place (MqTT / API) #1199
* merge Prometheus metrics fix #1310 * merge Prometheus metrics fix #1310
* merge MI grid profile request #1306 * merge MI grid profile request #1306
* merge update documentation / readme #1305 * merge update documentation / readme #1305

6
src/app.cpp

@ -247,7 +247,7 @@ void app::tickCalcSunrise(void) {
onceAt(std::bind(&app::tickCalcSunrise, this), nxtTrig, "Sunri"); onceAt(std::bind(&app::tickCalcSunrise, this), nxtTrig, "Sunri");
if (mMqttEnabled) { if (mMqttEnabled) {
tickSun(); tickSun();
nxtTrig = mSunrise - mConfig->sun.offsetSecMorning + 1; // one second safety to trigger correctly nxtTrig = mSunrise + mConfig->sun.offsetSecMorning + 1; // one second safety to trigger correctly
onceAt(std::bind(&app::tickSun, this), nxtTrig, "mqSr"); // trigger on sunrise to update 'dis_night_comm' onceAt(std::bind(&app::tickSun, this), nxtTrig, "mqSr"); // trigger on sunrise to update 'dis_night_comm'
} }
} }
@ -266,8 +266,8 @@ void app::tickIVCommunication(void) {
iv->commEnabled = !iv->config->disNightCom; // if sun.disNightCom is false, communication is always on iv->commEnabled = !iv->config->disNightCom; // if sun.disNightCom is false, communication is always on
if (!iv->commEnabled) { // inverter communication only during the day if (!iv->commEnabled) { // inverter communication only during the day
if (mTimestamp < (mSunrise - mConfig->sun.offsetSecMorning)) { // current time is before communication start, set next trigger to communication start if (mTimestamp < (mSunrise + mConfig->sun.offsetSecMorning)) { // current time is before communication start, set next trigger to communication start
nxtTrig = mSunrise - mConfig->sun.offsetSecMorning; nxtTrig = mSunrise + mConfig->sun.offsetSecMorning;
} else { } else {
if (mTimestamp >= (mSunset + mConfig->sun.offsetSecEvening)) { // current time is past communication stop, nothing to do. Next update will be done at midnight by tickCalcSunrise if (mTimestamp >= (mSunset + mConfig->sun.offsetSecEvening)) { // current time is past communication stop, nothing to do. Next update will be done at midnight by tickCalcSunrise
nxtTrig = 0; nxtTrig = 0;

8
src/config/settings.h

@ -106,8 +106,8 @@ typedef struct {
typedef struct { typedef struct {
float lat; float lat;
float lon; float lon;
uint16_t offsetSecMorning; int16_t offsetSecMorning;
uint16_t offsetSecEvening; int16_t offsetSecEvening;
} cfgSun_t; } cfgSun_t;
typedef struct { typedef struct {
@ -675,8 +675,8 @@ class settings {
} else { } else {
getVal<float>(obj, F("lat"), &mCfg.sun.lat); getVal<float>(obj, F("lat"), &mCfg.sun.lat);
getVal<float>(obj, F("lon"), &mCfg.sun.lon); getVal<float>(obj, F("lon"), &mCfg.sun.lon);
getVal<uint16_t>(obj, F("offs"), &mCfg.sun.offsetSecMorning); getVal<int16_t>(obj, F("offs"), &mCfg.sun.offsetSecMorning);
getVal<uint16_t>(obj, F("offsEve"), &mCfg.sun.offsetSecEvening); getVal<int16_t>(obj, F("offsEve"), &mCfg.sun.offsetSecEvening);
} }
} }

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 39 #define VERSION_PATCH 41
//------------------------------------- //-------------------------------------
typedef struct { typedef struct {

2
src/hm/Communication.h

@ -397,7 +397,7 @@ class Communication : public CommQueue<> {
DBGPRINT(F("has ")); DBGPRINT(F("has "));
if(!accepted) DBGPRINT(F("not ")); if(!accepted) DBGPRINT(F("not "));
DBGPRINT(F("accepted power limit set point ")); DBGPRINT(F("accepted power limit set point "));
DBGPRINT(String(q->iv->powerLimit[0]/10)); DBGPRINT(String((float)q->iv->powerLimit[0]/10.0));
DBGPRINT(F(" with PowerLimitControl ")); DBGPRINT(F(" with PowerLimitControl "));
DBGPRINTLN(String(q->iv->powerLimit[1])); DBGPRINTLN(String(q->iv->powerLimit[1]));
q->iv->actPowerLimit = 0xffff; // unknown, readback current value q->iv->actPowerLimit = 0xffff; // unknown, readback current value

2
src/plugins/Display/Display_Mono.h

@ -80,7 +80,7 @@ class DisplayMono {
uint8_t mExtra; uint8_t mExtra;
int8_t mPixelshift=0; int8_t mPixelshift=0;
TimeMonitor mDisplayTime = TimeMonitor(1000 * 15, true); TimeMonitor mDisplayTime = TimeMonitor(1000 * DISP_DEFAULT_TIMEOUT, true);
bool mDisplayActive = true; // always start with display on bool mDisplayActive = true; // always start with display on
char mFmtText[DISP_FMT_TEXT_LEN]; char mFmtText[DISP_FMT_TEXT_LEN];

16
src/publisher/pubMqtt.h

@ -134,13 +134,13 @@ class PubMqtt {
#endif #endif
} }
bool tickerSun(uint32_t sunrise, uint32_t sunset, uint16_t offsM, uint16_t offsE) { bool tickerSun(uint32_t sunrise, uint32_t sunset, int16_t offsM, int16_t offsE) {
if (!mClient.connected()) if (!mClient.connected())
return false; return false;
publish(subtopics[MQTT_SUNRISE], String(sunrise).c_str(), true); publish(subtopics[MQTT_SUNRISE], String(sunrise).c_str(), true);
publish(subtopics[MQTT_SUNSET], String(sunset).c_str(), true); publish(subtopics[MQTT_SUNSET], String(sunset).c_str(), true);
publish(subtopics[MQTT_COMM_START], String(sunrise - offsM).c_str(), true); publish(subtopics[MQTT_COMM_START], String(sunrise + offsM).c_str(), true);
publish(subtopics[MQTT_COMM_STOP], String(sunset + offsE).c_str(), true); publish(subtopics[MQTT_COMM_STOP], String(sunset + offsE).c_str(), true);
Inverter<> *iv; Inverter<> *iv;
@ -155,7 +155,7 @@ class PubMqtt {
snprintf(mSubTopic, 32 + MAX_NAME_LENGTH, "comm_disabled"); snprintf(mSubTopic, 32 + MAX_NAME_LENGTH, "comm_disabled");
publish(mSubTopic, (((*mUtcTimestamp > (sunset + offsE)) || (*mUtcTimestamp < (sunrise - offsM))) ? dict[STR_TRUE] : dict[STR_FALSE]), true); publish(mSubTopic, (((*mUtcTimestamp > (sunset + offsE)) || (*mUtcTimestamp < (sunrise + offsM))) ? dict[STR_TRUE] : dict[STR_FALSE]), true);
return true; return true;
} }
@ -310,15 +310,18 @@ class PubMqtt {
char *pyld = new char[len + 1]; char *pyld = new char[len + 1];
strncpy(pyld, (const char*)payload, len); strncpy(pyld, (const char*)payload, len);
pyld[len] = '\0'; pyld[len] = '\0';
if(NULL == strstr(topic, "limit"))
root[F("val")] = atoi(pyld); root[F("val")] = atoi(pyld);
else
root[F("val")] = (int)(atof(pyld) * 10.0f);
if(pyld[len-1] == 'W') if(pyld[len-1] == 'W')
limitAbs = true; limitAbs = true;
delete[] pyld; delete[] pyld;
} }
const char *p = topic + strlen(mCfgMqtt->topic); const char *p = topic + strlen(mCfgMqtt->topic);
uint8_t pos = 0; uint8_t pos = 0, elm = 0;
uint8_t elm = 0;
char tmp[30]; char tmp[30];
while(1) { while(1) {
@ -333,8 +336,7 @@ class PubMqtt {
root[F("cmd")] = F("limit_nonpersistent_absolute"); root[F("cmd")] = F("limit_nonpersistent_absolute");
else else
root[F("cmd")] = F("limit_nonpersistent_relative"); root[F("cmd")] = F("limit_nonpersistent_relative");
} } else
else
root[F("cmd")] = String(tmp); root[F("cmd")] = String(tmp);
break; break;
case 3: root[F("id")] = atoi(tmp); break; case 3: root[F("id")] = atoi(tmp); break;

2
src/web/html/setup.html

@ -942,7 +942,7 @@
document.getElementsByName("sunLon")[0].value = obj["lon"]; document.getElementsByName("sunLon")[0].value = obj["lon"];
for(p of [["sunOffsSr", "offsSr"], ["sunOffsSs", "offsSs"]]) { for(p of [["sunOffsSr", "offsSr"], ["sunOffsSs", "offsSs"]]) {
const sel = document.getElementsByName(p[0])[0]; const sel = document.getElementsByName(p[0])[0];
for(var i = 0; i <= 60; i++) { for(var i = -60; i <= 60; i++) {
sel.appendChild(opt(i, i + " minutes", (i == (obj[p[1]] / 60)))); sel.appendChild(opt(i, i + " minutes", (i == (obj[p[1]] / 60))));
} }
} }

4
src/web/html/system.html

@ -108,8 +108,8 @@
ml("tbody", {}, [ ml("tbody", {}, [
tr("Sunrise", new Date(obj.ts_sunrise * 1000).toLocaleString('de-DE')), tr("Sunrise", new Date(obj.ts_sunrise * 1000).toLocaleString('de-DE')),
tr("Sunset", new Date(obj.ts_sunset * 1000).toLocaleString('de-DE')), tr("Sunset", new Date(obj.ts_sunset * 1000).toLocaleString('de-DE')),
tr("Communication start", new Date((obj.ts_sunrise - obj.ts_offset) * 1000).toLocaleString('de-DE')), tr("Communication start", new Date((obj.ts_sunrise + obj.ts_offsSr) * 1000).toLocaleString('de-DE')),
tr("Communication stop", new Date((obj.ts_sunset + obj.ts_offset) * 1000).toLocaleString('de-DE')), tr("Communication stop", new Date((obj.ts_sunset + obj.ts_offsSs) * 1000).toLocaleString('de-DE')),
tr("Night behaviour", badge(obj.disNightComm, ((obj.disNightComm) ? "not" : "") + " communicating", "warning")) tr("Night behaviour", badge(obj.disNightComm, ((obj.disNightComm) ? "not" : "") + " communicating", "warning"))
]) ])
) )

Loading…
Cancel
Save