Browse Source

0.8.59

* merge PR: solve display settings dependencies #1369
* fix language typos #1346
* full update of ePaper after booting #1107
* fix MqTT yield day reset even if `pause inverter during nighttime` isn't active #1368
pull/1373/head
lumapu 1 year ago
parent
commit
93b53a10d9
  1. 6
      src/CHANGES.md
  2. 21
      src/app.cpp
  3. 4
      src/app.h
  4. 2
      src/defines.h
  5. 4
      src/plugins/Display/Display.h
  6. 10
      src/plugins/Display/Display_ePaper.cpp
  7. 1
      src/plugins/Display/Display_ePaper.h
  8. 8
      src/publisher/pubMqtt.h
  9. 12
      src/web/RestApi.h
  10. 2
      src/web/lang.json
  11. 26
      src/web/web.h

6
src/CHANGES.md

@ -1,5 +1,11 @@
# Development Changes # Development Changes
## 0.8.59 - 2024-01-18
* merge PR: solve display settings dependencies #1369
* fix language typos #1346
* full update of ePaper after booting #1107
* fix MqTT yield day reset even if `pause inverter during nighttime` isn't active #1368
## 0.8.58 - 2024-01-17 ## 0.8.58 - 2024-01-17
* fix missing refresh URL #1366 * fix missing refresh URL #1366
* fix view of grid profile #1365 * fix view of grid profile #1365

21
src/app.cpp

@ -108,7 +108,7 @@ void app::setup() {
#endif #endif
// Plugins // Plugins
#if defined(PLUGIN_DISPLAY) #if defined(PLUGIN_DISPLAY)
if (mConfig->plugin.display.type != DISP_TYPE_T0_NONE) if (DISP_TYPE_T0_NONE != mConfig->plugin.display.type)
#if defined(ESP32) #if defined(ESP32)
mDisplay.setup(this, &mConfig->plugin.display, &mSys, &mNrfRadio, &mCmtRadio, &mTimestamp); mDisplay.setup(this, &mConfig->plugin.display, &mSys, &mNrfRadio, &mCmtRadio, &mTimestamp);
#else #else
@ -186,7 +186,7 @@ void app::regularTickers(void) {
everySec(std::bind(&WebType::tickSecond, &mWeb), "webSc"); everySec(std::bind(&WebType::tickSecond, &mWeb), "webSc");
// Plugins // Plugins
#if defined(PLUGIN_DISPLAY) #if defined(PLUGIN_DISPLAY)
if (mConfig->plugin.display.type != DISP_TYPE_T0_NONE) if (DISP_TYPE_T0_NONE != mConfig->plugin.display.type)
everySec(std::bind(&DisplayType::tickerSecond, &mDisplay), "disp"); everySec(std::bind(&DisplayType::tickerSecond, &mDisplay), "disp");
#endif #endif
every(std::bind(&PubSerialType::tick, &mPubSerial), 5, "uart"); every(std::bind(&PubSerialType::tick, &mPubSerial), 5, "uart");
@ -352,6 +352,14 @@ void app::tickSunrise(void) {
#endif #endif
} }
//-----------------------------------------------------------------------------
void app::notAvailChanged(void) {
#if defined(ENABLE_MQTT)
if (mMqttEnabled)
mMqtt.notAvailChanged(mAllIvNotAvail);
#endif
}
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
void app::tickZeroValues(void) { void app::tickZeroValues(void) {
zeroIvValues(!CHECK_AVAIL, SKIP_YIELD_DAY); zeroIvValues(!CHECK_AVAIL, SKIP_YIELD_DAY);
@ -403,6 +411,7 @@ void app::tickMidnight(void) {
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
void app::tickSend(void) { void app::tickSend(void) {
bool notAvail = true;
uint8_t fill = mCommunication.getFillState(); uint8_t fill = mCommunication.getFillState();
uint8_t max = mCommunication.getMaxFill(); uint8_t max = mCommunication.getMaxFill();
if((max-MAX_NUM_INVERTERS) <= fill) { if((max-MAX_NUM_INVERTERS) <= fill) {
@ -428,6 +437,9 @@ void app::tickSend(void) {
if(!iv->radio->isChipConnected()) if(!iv->radio->isChipConnected())
continue; continue;
if(InverterStatus::OFF != iv->status)
notAvail = false;
iv->tickSend([this, iv](uint8_t cmd, bool isDevControl) { iv->tickSend([this, iv](uint8_t cmd, bool isDevControl) {
if(isDevControl) if(isDevControl)
mCommunication.addImportant(iv, cmd); mCommunication.addImportant(iv, cmd);
@ -437,6 +449,10 @@ void app::tickSend(void) {
} }
} }
if(mAllIvNotAvail != notAvail)
once(std::bind(&app::notAvailChanged, this), 1, "avail");
mAllIvNotAvail = notAvail;
updateLed(); updateLed();
} }
@ -535,6 +551,7 @@ void app::resetSystem(void) {
#endif #endif
mSendFirst = true; mSendFirst = true;
mAllIvNotAvail = true;
mSunrise = 0; mSunrise = 0;
mSunset = 0; mSunset = 0;

4
src/app.h

@ -319,7 +319,7 @@ class app : public IApp, public ah::Scheduler {
#endif /*ENABLE_MQTT*/ #endif /*ENABLE_MQTT*/
#endif #endif
#if defined(PLUGIN_DISPLAY) #if defined(PLUGIN_DISPLAY)
if(mConfig->plugin.display.type != DISP_TYPE_T0_NONE) if(DISP_TYPE_T0_NONE != mConfig->plugin.display.type)
mDisplay.payloadEventListener(cmd); mDisplay.payloadEventListener(cmd);
#endif #endif
updateLed(); updateLed();
@ -366,6 +366,7 @@ class app : public IApp, public ah::Scheduler {
void tickMinute(void); void tickMinute(void);
void tickZeroValues(void); void tickZeroValues(void);
void tickMidnight(void); void tickMidnight(void);
void notAvailChanged(void);
HmSystemType mSys; HmSystemType mSys;
HmRadio<> mNrfRadio; HmRadio<> mNrfRadio;
@ -402,6 +403,7 @@ class app : public IApp, public ah::Scheduler {
uint8_t mSendLastIvId; uint8_t mSendLastIvId;
bool mSendFirst; bool mSendFirst;
bool mAllIvNotAvail;
bool mNetworkConnected; bool mNetworkConnected;

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 58 #define VERSION_PATCH 59
//------------------------------------- //-------------------------------------
typedef struct { typedef struct {

4
src/plugins/Display/Display.h

@ -93,7 +93,7 @@ class Display {
private: private:
void DataScreen() { void DataScreen() {
if (mCfg->type == DISP_TYPE_T0_NONE) if (DISP_TYPE_T0_NONE == mCfg->type)
return; return;
float totalPower = 0.0; float totalPower = 0.0;
@ -175,7 +175,7 @@ class Display {
mMono->disp(); mMono->disp();
} }
#if defined(ESP32) && !defined(ETHERNET) #if defined(ESP32) && !defined(ETHERNET)
else if (mCfg->type == DISP_TYPE_T10_EPAPER) { else if (DISP_TYPE_T10_EPAPER == mCfg->type) {
mEpaper.loop((totalPower), totalYieldDay, totalYieldTotal, nrprod); mEpaper.loop((totalPower), totalYieldDay, totalYieldTotal, nrprod);
mRefreshCycle++; mRefreshCycle++;
} }

10
src/plugins/Display/Display_ePaper.cpp

@ -27,10 +27,10 @@ DisplayEPaper::DisplayEPaper() {
void DisplayEPaper::init(uint8_t type, uint8_t _CS, uint8_t _DC, uint8_t _RST, uint8_t _BUSY, uint8_t _SCK, uint8_t _MOSI, uint32_t *utcTs, const char *version) { void DisplayEPaper::init(uint8_t type, uint8_t _CS, uint8_t _DC, uint8_t _RST, uint8_t _BUSY, uint8_t _SCK, uint8_t _MOSI, uint32_t *utcTs, const char *version) {
mUtcTs = utcTs; mUtcTs = utcTs;
mRefreshState = RefreshStatus::BLACK; mRefreshState = RefreshStatus::LOGO;
mSecondCnt = 2; mSecondCnt = 0;
if (type == DISP_TYPE_T10_EPAPER) { if (DISP_TYPE_T10_EPAPER == type) {
Serial.begin(115200); Serial.begin(115200);
_display = new GxEPD2_BW<GxEPD2_150_BN, GxEPD2_150_BN::HEIGHT>(GxEPD2_150_BN(_CS, _DC, _RST, _BUSY)); _display = new GxEPD2_BW<GxEPD2_150_BN, GxEPD2_150_BN::HEIGHT>(GxEPD2_150_BN(_CS, _DC, _RST, _BUSY));
@ -64,9 +64,9 @@ void DisplayEPaper::fullRefresh() {
void DisplayEPaper::refreshLoop() { void DisplayEPaper::refreshLoop() {
switch(mRefreshState) { switch(mRefreshState) {
case RefreshStatus::LOGO: case RefreshStatus::LOGO:
mFirst = false;
_display->fillScreen(GxEPD_BLACK); _display->fillScreen(GxEPD_BLACK);
_display->drawBitmap(0, 0, logo, 200, 200, GxEPD_WHITE); _display->drawBitmap(0, 0, logo, 200, 200, GxEPD_WHITE);
_display->display(false); // full update
mNextRefreshState = RefreshStatus::PARTITIALS; mNextRefreshState = RefreshStatus::PARTITIALS;
mRefreshState = RefreshStatus::WAIT; mRefreshState = RefreshStatus::WAIT;
break; break;
@ -81,7 +81,7 @@ void DisplayEPaper::refreshLoop() {
if(mSecondCnt == 0) { if(mSecondCnt == 0) {
_display->fillScreen(GxEPD_WHITE); _display->fillScreen(GxEPD_WHITE);
mNextRefreshState = RefreshStatus::PARTITIALS; mNextRefreshState = RefreshStatus::PARTITIALS;
mRefreshState = (mFirst) ? RefreshStatus::LOGO : RefreshStatus::WAIT; mRefreshState = RefreshStatus::WAIT;
} }
break; break;

1
src/plugins/Display/Display_ePaper.h

@ -58,7 +58,6 @@ class DisplayEPaper {
const char* _version; const char* _version;
RefreshStatus mRefreshState, mNextRefreshState; RefreshStatus mRefreshState, mNextRefreshState;
uint8_t mSecondCnt; uint8_t mSecondCnt;
bool mFirst = true;
}; };
#endif // ESP32 #endif // ESP32

8
src/publisher/pubMqtt.h

@ -156,12 +156,14 @@ 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);
if(isSunrise)
mSendIvData.resetYieldDay();
return true; return true;
} }
void notAvailChanged(bool allNotAvail) {
if(!allNotAvail)
mSendIvData.resetYieldDay();
}
bool tickerComm(bool disabled) { bool tickerComm(bool disabled) {
if (!mClient.connected()) if (!mClient.connected())
return false; return false;

12
src/web/RestApi.h

@ -689,12 +689,12 @@ class RestApi {
obj[F("disp_cont")] = (uint8_t)mConfig->plugin.display.contrast; obj[F("disp_cont")] = (uint8_t)mConfig->plugin.display.contrast;
obj[F("disp_graph_ratio")] = (uint8_t)mConfig->plugin.display.graph_ratio; obj[F("disp_graph_ratio")] = (uint8_t)mConfig->plugin.display.graph_ratio;
obj[F("disp_graph_size")] = (uint8_t)mConfig->plugin.display.graph_size; obj[F("disp_graph_size")] = (uint8_t)mConfig->plugin.display.graph_size;
obj[F("disp_clk")] = (mConfig->plugin.display.type == DISP_TYPE_T0_NONE) ? DEF_PIN_OFF : mConfig->plugin.display.disp_clk; obj[F("disp_clk")] = mConfig->plugin.display.disp_clk;
obj[F("disp_data")] = (mConfig->plugin.display.type == DISP_TYPE_T0_NONE) ? DEF_PIN_OFF : mConfig->plugin.display.disp_data; obj[F("disp_data")] = mConfig->plugin.display.disp_data;
obj[F("disp_cs")] = (mConfig->plugin.display.type < DISP_TYPE_T3_PCD8544_84X48) ? DEF_PIN_OFF : mConfig->plugin.display.disp_cs; obj[F("disp_cs")] = mConfig->plugin.display.disp_cs;
obj[F("disp_dc")] = (mConfig->plugin.display.type < DISP_TYPE_T3_PCD8544_84X48) ? DEF_PIN_OFF : mConfig->plugin.display.disp_dc; obj[F("disp_dc")] = mConfig->plugin.display.disp_dc;
obj[F("disp_rst")] = (mConfig->plugin.display.type < DISP_TYPE_T3_PCD8544_84X48) ? DEF_PIN_OFF : mConfig->plugin.display.disp_reset; obj[F("disp_rst")] = mConfig->plugin.display.disp_reset;
obj[F("disp_bsy")] = (mConfig->plugin.display.type < DISP_TYPE_T10_EPAPER) ? DEF_PIN_OFF : mConfig->plugin.display.disp_busy; obj[F("disp_bsy")] = mConfig->plugin.display.disp_busy;
obj[F("pir_pin")] = mConfig->plugin.display.pirPin; obj[F("pir_pin")] = mConfig->plugin.display.pirPin;
} }

2
src/web/lang.json

@ -1071,7 +1071,7 @@
{ {
"token": "WARN_DIFF_ENV", "token": "WARN_DIFF_ENV",
"en": "your environment does not match the update file!", "en": "your environment does not match the update file!",
"de": "Die ausgew&auml;hlte Firmware passt uU. nicht zum Chipsatz!" "de": "Die ausgew&auml;hlte Firmware passt u.U. nicht zum Chipsatz!"
}, },
{ {
"token": "CONTIUE", "token": "CONTIUE",

26
src/web/web.h

@ -601,23 +601,23 @@ class Web {
mConfig->plugin.display.type = request->arg("disp_typ").toInt(); mConfig->plugin.display.type = request->arg("disp_typ").toInt();
mConfig->plugin.display.contrast = (mConfig->plugin.display.type == DISP_TYPE_T0_NONE) || // contrast available only according optionsMap in setup.html, otherwise default value mConfig->plugin.display.contrast = (mConfig->plugin.display.type == DISP_TYPE_T0_NONE) || // contrast available only according optionsMap in setup.html, otherwise default value
(mConfig->plugin.display.type == DISP_TYPE_T10_EPAPER) ? 140 : request->arg("disp_cont").toInt(); (mConfig->plugin.display.type == DISP_TYPE_T10_EPAPER) ? 140 : request->arg("disp_cont").toInt();
mConfig->plugin.display.screenSaver = ((mConfig->plugin.display.type == DISP_TYPE_T1_SSD1306_128X64) || // screensaver available only according optionsMap in setup.html, otherwise default value mConfig->plugin.display.screenSaver = ((mConfig->plugin.display.type == DISP_TYPE_T1_SSD1306_128X64) // screensaver available only according optionsMap in setup.html, otherwise default value
(mConfig->plugin.display.type == DISP_TYPE_T2_SH1106_128X64) || || (mConfig->plugin.display.type == DISP_TYPE_T2_SH1106_128X64)
(mConfig->plugin.display.type == DISP_TYPE_T4_SSD1306_128X32) || || (mConfig->plugin.display.type == DISP_TYPE_T4_SSD1306_128X32)
(mConfig->plugin.display.type == DISP_TYPE_T5_SSD1306_64X48) || || (mConfig->plugin.display.type == DISP_TYPE_T5_SSD1306_64X48)
(mConfig->plugin.display.type == DISP_TYPE_T6_SSD1309_128X64)) ? request->arg("disp_screensaver").toInt() : 1; || (mConfig->plugin.display.type == DISP_TYPE_T6_SSD1309_128X64)) ? request->arg("disp_screensaver").toInt() : 0;
mConfig->plugin.display.graph_ratio = ((mConfig->plugin.display.type == DISP_TYPE_T1_SSD1306_128X64) || // display graph available only according optionsMap in setup.html, otherwise has to be 0 mConfig->plugin.display.graph_ratio = ((mConfig->plugin.display.type == DISP_TYPE_T1_SSD1306_128X64) // display graph available only according optionsMap in setup.html, otherwise has to be 0
(mConfig->plugin.display.type == DISP_TYPE_T2_SH1106_128X64) || || (mConfig->plugin.display.type == DISP_TYPE_T2_SH1106_128X64)
(mConfig->plugin.display.type == DISP_TYPE_T3_PCD8544_84X48) || || (mConfig->plugin.display.type == DISP_TYPE_T3_PCD8544_84X48)
(mConfig->plugin.display.type == DISP_TYPE_T6_SSD1309_128X64)) ? request->arg("disp_graph_ratio").toInt() : 0; || (mConfig->plugin.display.type == DISP_TYPE_T6_SSD1309_128X64)) ? request->arg("disp_graph_ratio").toInt() : 0;
// available pins according pinMap in setup.html, otherwise default value // available pins according pinMap in setup.html, otherwise default value
mConfig->plugin.display.disp_data = (mConfig->plugin.display.type == DISP_TYPE_T0_NONE) ? DEF_PIN_OFF : request->arg("disp_data").toInt(); mConfig->plugin.display.disp_data = (mConfig->plugin.display.type == DISP_TYPE_T0_NONE) ? DEF_PIN_OFF : request->arg("disp_data").toInt();
mConfig->plugin.display.disp_clk = (mConfig->plugin.display.type == DISP_TYPE_T0_NONE) ? DEF_PIN_OFF : request->arg("disp_clk").toInt(); mConfig->plugin.display.disp_clk = (mConfig->plugin.display.type == DISP_TYPE_T0_NONE) ? DEF_PIN_OFF : request->arg("disp_clk").toInt();
mConfig->plugin.display.disp_cs = (mConfig->plugin.display.type != DISP_TYPE_T3_PCD8544_84X48) && mConfig->plugin.display.disp_cs = (mConfig->plugin.display.type != DISP_TYPE_T3_PCD8544_84X48)
(mConfig->plugin.display.type != DISP_TYPE_T10_EPAPER) ? DEF_PIN_OFF : request->arg("disp_cs").toInt(); && (mConfig->plugin.display.type != DISP_TYPE_T10_EPAPER) ? DEF_PIN_OFF : request->arg("disp_cs").toInt();
mConfig->plugin.display.disp_dc = (mConfig->plugin.display.type != DISP_TYPE_T3_PCD8544_84X48) && mConfig->plugin.display.disp_dc = (mConfig->plugin.display.type != DISP_TYPE_T3_PCD8544_84X48)
(mConfig->plugin.display.type != DISP_TYPE_T10_EPAPER) ? DEF_PIN_OFF : request->arg("disp_dc").toInt(); && (mConfig->plugin.display.type != DISP_TYPE_T10_EPAPER) ? DEF_PIN_OFF : request->arg("disp_dc").toInt();
mConfig->plugin.display.disp_reset = (mConfig->plugin.display.type != DISP_TYPE_T10_EPAPER) ? DEF_PIN_OFF : request->arg("disp_rst").toInt(); mConfig->plugin.display.disp_reset = (mConfig->plugin.display.type != DISP_TYPE_T10_EPAPER) ? DEF_PIN_OFF : request->arg("disp_rst").toInt();
mConfig->plugin.display.disp_busy = (mConfig->plugin.display.type != DISP_TYPE_T10_EPAPER) ? DEF_PIN_OFF : request->arg("disp_bsy").toInt(); mConfig->plugin.display.disp_busy = (mConfig->plugin.display.type != DISP_TYPE_T10_EPAPER) ? DEF_PIN_OFF : request->arg("disp_bsy").toInt();
mConfig->plugin.display.pirPin = (mConfig->plugin.display.screenSaver != DISP_TYPE_T2_SH1106_128X64) ? DEF_PIN_OFF : request->arg("pir_pin").toInt(); // pir pin only for motion screensaver mConfig->plugin.display.pirPin = (mConfig->plugin.display.screenSaver != DISP_TYPE_T2_SH1106_128X64) ? DEF_PIN_OFF : request->arg("pir_pin").toInt(); // pir pin only for motion screensaver

Loading…
Cancel
Save