Skip to content

Commit

Permalink
merged PR #684, #698, #705
Browse files Browse the repository at this point in the history
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
  • Loading branch information
lumapu committed Feb 22, 2023
1 parent 20864db commit 9ef2df2
Show file tree
Hide file tree
Showing 9 changed files with 28 additions and 15 deletions.
7 changes: 7 additions & 0 deletions src/CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 4 additions & 2 deletions src/app.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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");
}
}
Expand Down Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion src/defines.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
//-------------------------------------
#define VERSION_MAJOR 0
#define VERSION_MINOR 5
#define VERSION_PATCH 89
#define VERSION_PATCH 90

//-------------------------------------
typedef struct {
Expand Down
2 changes: 1 addition & 1 deletion src/hm/hmDefines.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
10 changes: 3 additions & 7 deletions src/plugins/MonochromeDisplay/MonochromeDisplay.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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();

Expand Down Expand Up @@ -215,7 +212,6 @@ class MonochromeDisplay {
uint8_t mLineOffsets[5];
display_t *mCfg;
HMSYSTEM *mSys;
Timezone mCE;
};

#endif /*__MONOCHROME_DISPLAY__*/
2 changes: 2 additions & 0 deletions src/publisher/pubMqtt.h
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
6 changes: 5 additions & 1 deletion src/utils/helper.h
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
4 changes: 3 additions & 1 deletion src/web/html/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,9 @@ <h3>Support this project:</h3>
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);
Expand Down
4 changes: 2 additions & 2 deletions src/web/web.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
}
Expand Down

0 comments on commit 9ef2df2

Please sign in to comment.