Browse Source

merged PR #684, #698, #705

webserial minor overflow fix #660
web `index.html` improve version information #701
fix MQTT sets power limit to zero (0) #692
changed `reset at midnight` with timezone #697
pull/729/head
lumapu 2 years ago
parent
commit
9ef2df21fa
  1. 7
      src/CHANGES.md
  2. 6
      src/app.cpp
  3. 2
      src/defines.h
  4. 2
      src/hm/hmDefines.h
  5. 10
      src/plugins/MonochromeDisplay/MonochromeDisplay.h
  6. 2
      src/publisher/pubMqtt.h
  7. 6
      src/utils/helper.h
  8. 4
      src/web/html/index.html
  9. 4
      src/web/web.h

7
src/CHANGES.md

@ -2,6 +2,13 @@
(starting from release version `0.5.66`)
## 0.5.90
* merged PR #684, #698, #705
* webserial minor overflow fix #660
* web `index.html` improve version information #701
* fix MQTT sets power limit to zero (0) #692
* changed `reset at midnight` with timezone #697
## 0.5.89
* reduced heap fragmentation (removed `strtok` completely) #644, #645, #682
* added part of mac address to MQTT client ID to seperate multiple ESPs in same network

6
src/app.cpp

@ -193,7 +193,8 @@ void app::tickNtpUpdate(void) {
if(mConfig->inst.rstValsNotAvail)
everyMin(std::bind(&app::tickMinute, this), "tMin");
if(mConfig->inst.rstYieldMidNight) {
uint32_t midTrig = mTimestamp - ((mTimestamp + MIDNIGHTTICKER_OFFSET) % 86400) + 86400; // next midnight
uint32_t localTime = gTimezone.toLocal(mTimestamp);
uint32_t midTrig = gTimezone.toUTC(localTime - (localTime % 86400) + 86400); // next midnight local time
onceAt(std::bind(&app::tickMidnight, this), midTrig, "midNi");
}
}
@ -304,7 +305,8 @@ void app::tickMinute(void) {
//-----------------------------------------------------------------------------
void app::tickMidnight(void) {
// only triggered if 'reset values at midnight is enabled'
uint32_t nxtTrig = mTimestamp - ((mTimestamp + MIDNIGHTTICKER_OFFSET) % 86400) + 86400; // next midnight
uint32_t localTime = gTimezone.toLocal(mTimestamp);
uint32_t nxtTrig = gTimezone.toUTC(localTime - (localTime % 86400) + 86400); // next midnight local time
onceAt(std::bind(&app::tickMidnight, this), nxtTrig, "mid2");
Inverter<> *iv;

2
src/defines.h

@ -13,7 +13,7 @@
//-------------------------------------
#define VERSION_MAJOR 0
#define VERSION_MINOR 5
#define VERSION_PATCH 89
#define VERSION_PATCH 90
//-------------------------------------
typedef struct {

2
src/hm/hmDefines.h

@ -26,7 +26,7 @@ enum {FLD_UDC = 0, FLD_IDC, FLD_PDC, FLD_YD, FLD_YW, FLD_YT,
const char* const fields[] = {"U_DC", "I_DC", "P_DC", "YieldDay", "YieldWeek", "YieldTotal",
"U_AC", "I_AC", "P_AC", "F_AC", "Temp", "PF_AC", "Efficiency", "Irradiation","Q_AC",
"ALARM_MES_ID","FWVersion","FWBuildYear","FWBuildMonthDay","FWBuildHourMinute","HWPartId",
"active PowerLimit", /*"reactive PowerLimit","Powerfactor",*/ "LastAlarmCode"};
"active_PowerLimit", /*"reactivePowerLimit","Powerfactor",*/ "LastAlarmCode"};
const char* const notAvail = "n/a";
// mqtt discovery device classes

10
src/plugins/MonochromeDisplay/MonochromeDisplay.h

@ -37,13 +37,10 @@ static uint8_t bmp_arrow[] PROGMEM = {
};
static TimeChangeRule CEST = {"CEST", Last, Sun, Mar, 2, 120}; // Central European Summer Time
static TimeChangeRule CET = {"CET ", Last, Sun, Oct, 3, 60}; // Central European Standard Tim
template<class HMSYSTEM>
class MonochromeDisplay {
public:
MonochromeDisplay() : mCE(CEST, CET) {}
MonochromeDisplay() {}
void setup(display_t *cfg, HMSYSTEM *sys, uint32_t *utcTs, uint8_t disp_reset, const char *version) {
mCfg = cfg;
@ -166,9 +163,9 @@ class MonochromeDisplay {
} else {
// Get current time
if(mIsLarge)
printText(ah::getDateTimeStr(mCE.toLocal(*mUtcTs)).c_str(), 3);
printText(ah::getDateTimeStr(gTimezone.toLocal(*mUtcTs)).c_str(), 3);
else
printText(ah::getTimeStr(mCE.toLocal(*mUtcTs)).c_str(), 3);
printText(ah::getTimeStr(gTimezone.toLocal(*mUtcTs)).c_str(), 3);
}
mDisplay->sendBuffer();
@ -215,7 +212,6 @@ class MonochromeDisplay {
uint8_t mLineOffsets[5];
display_t *mCfg;
HMSYSTEM *mSys;
Timezone mCE;
};
#endif /*__MONOCHROME_DISPLAY__*/

2
src/publisher/pubMqtt.h

@ -339,6 +339,8 @@ class PubMqtt {
}
void onMessage(const espMqttClientTypes::MessageProperties& properties, const char* topic, const uint8_t* payload, size_t len, size_t index, size_t total) {
if(len == 0)
return;
DPRINT(DBG_INFO, mqttStr[MQTT_STR_GOT_TOPIC]);
DBGPRINTLN(String(topic));
if(NULL == mSubscriptionCb)

6
src/utils/helper.h

@ -11,7 +11,11 @@
#include <cstring>
#include <stdio.h>
#include <stdlib.h>
#include <TimeLib.h>
#include <Timezone.h>
static TimeChangeRule CEST = {"CEST", Last, Sun, Mar, 2, 120}; // Central European Summer Time
static TimeChangeRule CET = {"CET ", Last, Sun, Oct, 3, 60}; // Central European Standard Time
static Timezone gTimezone(CEST, CET);
#define CHECK_MASK(a,b) ((a & b) == b)

4
src/web/html/index.html

@ -219,7 +219,9 @@
if(getVerInt(version) < getVerInt(release))
p.append(svg(iconInfo, 20, 20, "#00d", "icon"), span("Update available, current released version: " + release), br());
else if(getVerInt(version) > getVerInt(release))
p.append(svg(iconInfo, 20, 20, "#00d", "icon"), span("You are using a development version, current released version: " + release), br());
p.append(svg(iconInfo, 20, 20, "#00d", "icon"), span("You are using development version " + version +". In case of issues you may want to try the current stable release: " + release), br());
else
p.append(svg(iconInfo, 20, 20, "#00d", "icon"), span("You are using the current stable release: " + release), br());
}
document.getElementById("warn_info").replaceChildren(p);

4
src/web/web.h

@ -190,7 +190,7 @@ class Web {
msg.replace("\r\n", "<rn>");
if(mSerialAddTime) {
if((9 + mSerialBufFill) <= WEB_SERIAL_BUF_SIZE) {
if((9 + mSerialBufFill) < WEB_SERIAL_BUF_SIZE) {
if(mApp->getTimestamp() > 0) {
strncpy(&mSerialBuf[mSerialBufFill], mApp->getTimeStr(mApp->getTimezoneOffset()).c_str(), 9);
mSerialBufFill += 9;
@ -208,7 +208,7 @@ class Web {
mSerialAddTime = true;
uint16_t length = msg.length();
if((length + mSerialBufFill) <= WEB_SERIAL_BUF_SIZE) {
if((length + mSerialBufFill) < WEB_SERIAL_BUF_SIZE) {
strncpy(&mSerialBuf[mSerialBufFill], msg.c_str(), length);
mSerialBufFill += length;
}

Loading…
Cancel
Save