Skip to content

Commit

Permalink
0.8.41
Browse files Browse the repository at this point in the history
* fix display timeout (OLED) to 60s
* change offs to signed value
  • Loading branch information
lumapu committed Jan 2, 2024
1 parent 3dd4997 commit f2e1e53
Show file tree
Hide file tree
Showing 8 changed files with 18 additions and 14 deletions.
4 changes: 4 additions & 0 deletions src/CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# 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
Expand Down
6 changes: 3 additions & 3 deletions src/app.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@ void app::tickCalcSunrise(void) {
onceAt(std::bind(&app::tickCalcSunrise, this), nxtTrig, "Sunri");
if (mMqttEnabled) {
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'
}
}
Expand All @@ -254,8 +254,8 @@ void app::tickIVCommunication(void) {

iv->commEnabled = !iv->config->disNightCom; // if sun.disNightCom is false, communication is always on
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
nxtTrig = mSunrise - mConfig->sun.offsetSecMorning;
if (mTimestamp < (mSunrise + mConfig->sun.offsetSecMorning)) { // current time is before communication start, set next trigger to communication start
nxtTrig = mSunrise + mConfig->sun.offsetSecMorning;
} 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
nxtTrig = 0;
Expand Down
8 changes: 4 additions & 4 deletions src/config/settings.h
Original file line number Diff line number Diff line change
Expand Up @@ -106,8 +106,8 @@ typedef struct {
typedef struct {
float lat;
float lon;
uint16_t offsetSecMorning;
uint16_t offsetSecEvening;
int16_t offsetSecMorning;
int16_t offsetSecEvening;
} cfgSun_t;

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

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 8
#define VERSION_PATCH 40
#define VERSION_PATCH 41

//-------------------------------------
typedef struct {
Expand Down
2 changes: 1 addition & 1 deletion src/plugins/Display/Display_Mono.h
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ class DisplayMono {

uint8_t mExtra;
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
char mFmtText[DISP_FMT_TEXT_LEN];

Expand Down
6 changes: 3 additions & 3 deletions src/publisher/pubMqtt.h
Original file line number Diff line number Diff line change
Expand Up @@ -134,13 +134,13 @@ class PubMqtt {
#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())
return false;

publish(subtopics[MQTT_SUNRISE], String(sunrise).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);

Inverter<> *iv;
Expand All @@ -155,7 +155,7 @@ class PubMqtt {


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;
}
Expand Down
2 changes: 1 addition & 1 deletion src/web/html/setup.html
Original file line number Diff line number Diff line change
Expand Up @@ -895,7 +895,7 @@
document.getElementsByName("sunLon")[0].value = obj["lon"];
for(p of [["sunOffsSr", "offsSr"], ["sunOffsSs", "offsSs"]]) {
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))));
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/web/html/system.html
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@
ml("tbody", {}, [
tr("Sunrise", new Date(obj.ts_sunrise * 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_offsSr) * 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_offsSs) * 1000).toLocaleString('de-DE')),
tr("Night behaviour", badge(obj.disNightComm, ((obj.disNightComm) ? "not" : "") + " communicating", "warning"))
])
Expand Down

0 comments on commit f2e1e53

Please sign in to comment.