mirror of
https://github.com/lumapu/ahoy.git
synced 2025-06-10 06:31:39 +02:00
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
This commit is contained in:
parent
b792f69faf
commit
93b53a10d9
12 changed files with 67 additions and 41 deletions
|
@ -1,5 +1,11 @@
|
|||
# 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
|
||||
* fix missing refresh URL #1366
|
||||
* fix view of grid profile #1365
|
||||
|
|
21
src/app.cpp
21
src/app.cpp
|
@ -108,7 +108,7 @@ void app::setup() {
|
|||
#endif
|
||||
// Plugins
|
||||
#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)
|
||||
mDisplay.setup(this, &mConfig->plugin.display, &mSys, &mNrfRadio, &mCmtRadio, &mTimestamp);
|
||||
#else
|
||||
|
@ -186,7 +186,7 @@ void app::regularTickers(void) {
|
|||
everySec(std::bind(&WebType::tickSecond, &mWeb), "webSc");
|
||||
// Plugins
|
||||
#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");
|
||||
#endif
|
||||
every(std::bind(&PubSerialType::tick, &mPubSerial), 5, "uart");
|
||||
|
@ -352,6 +352,14 @@ void app::tickSunrise(void) {
|
|||
#endif
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
void app::notAvailChanged(void) {
|
||||
#if defined(ENABLE_MQTT)
|
||||
if (mMqttEnabled)
|
||||
mMqtt.notAvailChanged(mAllIvNotAvail);
|
||||
#endif
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
void app::tickZeroValues(void) {
|
||||
zeroIvValues(!CHECK_AVAIL, SKIP_YIELD_DAY);
|
||||
|
@ -403,6 +411,7 @@ void app::tickMidnight(void) {
|
|||
|
||||
//-----------------------------------------------------------------------------
|
||||
void app::tickSend(void) {
|
||||
bool notAvail = true;
|
||||
uint8_t fill = mCommunication.getFillState();
|
||||
uint8_t max = mCommunication.getMaxFill();
|
||||
if((max-MAX_NUM_INVERTERS) <= fill) {
|
||||
|
@ -428,6 +437,9 @@ void app::tickSend(void) {
|
|||
if(!iv->radio->isChipConnected())
|
||||
continue;
|
||||
|
||||
if(InverterStatus::OFF != iv->status)
|
||||
notAvail = false;
|
||||
|
||||
iv->tickSend([this, iv](uint8_t cmd, bool isDevControl) {
|
||||
if(isDevControl)
|
||||
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();
|
||||
}
|
||||
|
||||
|
@ -535,6 +551,7 @@ void app::resetSystem(void) {
|
|||
#endif
|
||||
|
||||
mSendFirst = true;
|
||||
mAllIvNotAvail = true;
|
||||
|
||||
mSunrise = 0;
|
||||
mSunset = 0;
|
||||
|
|
|
@ -319,7 +319,7 @@ class app : public IApp, public ah::Scheduler {
|
|||
#endif /*ENABLE_MQTT*/
|
||||
#endif
|
||||
#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);
|
||||
#endif
|
||||
updateLed();
|
||||
|
@ -366,6 +366,7 @@ class app : public IApp, public ah::Scheduler {
|
|||
void tickMinute(void);
|
||||
void tickZeroValues(void);
|
||||
void tickMidnight(void);
|
||||
void notAvailChanged(void);
|
||||
|
||||
HmSystemType mSys;
|
||||
HmRadio<> mNrfRadio;
|
||||
|
@ -402,6 +403,7 @@ class app : public IApp, public ah::Scheduler {
|
|||
|
||||
uint8_t mSendLastIvId;
|
||||
bool mSendFirst;
|
||||
bool mAllIvNotAvail;
|
||||
|
||||
bool mNetworkConnected;
|
||||
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
//-------------------------------------
|
||||
#define VERSION_MAJOR 0
|
||||
#define VERSION_MINOR 8
|
||||
#define VERSION_PATCH 58
|
||||
#define VERSION_PATCH 59
|
||||
|
||||
//-------------------------------------
|
||||
typedef struct {
|
||||
|
|
|
@ -93,7 +93,7 @@ class Display {
|
|||
|
||||
private:
|
||||
void DataScreen() {
|
||||
if (mCfg->type == DISP_TYPE_T0_NONE)
|
||||
if (DISP_TYPE_T0_NONE == mCfg->type)
|
||||
return;
|
||||
|
||||
float totalPower = 0.0;
|
||||
|
@ -175,7 +175,7 @@ class Display {
|
|||
mMono->disp();
|
||||
}
|
||||
#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);
|
||||
mRefreshCycle++;
|
||||
}
|
||||
|
|
|
@ -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) {
|
||||
mUtcTs = utcTs;
|
||||
|
||||
mRefreshState = RefreshStatus::BLACK;
|
||||
mSecondCnt = 2;
|
||||
mRefreshState = RefreshStatus::LOGO;
|
||||
mSecondCnt = 0;
|
||||
|
||||
if (type == DISP_TYPE_T10_EPAPER) {
|
||||
if (DISP_TYPE_T10_EPAPER == type) {
|
||||
Serial.begin(115200);
|
||||
_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() {
|
||||
switch(mRefreshState) {
|
||||
case RefreshStatus::LOGO:
|
||||
mFirst = false;
|
||||
_display->fillScreen(GxEPD_BLACK);
|
||||
_display->drawBitmap(0, 0, logo, 200, 200, GxEPD_WHITE);
|
||||
_display->display(false); // full update
|
||||
mNextRefreshState = RefreshStatus::PARTITIALS;
|
||||
mRefreshState = RefreshStatus::WAIT;
|
||||
break;
|
||||
|
@ -81,7 +81,7 @@ void DisplayEPaper::refreshLoop() {
|
|||
if(mSecondCnt == 0) {
|
||||
_display->fillScreen(GxEPD_WHITE);
|
||||
mNextRefreshState = RefreshStatus::PARTITIALS;
|
||||
mRefreshState = (mFirst) ? RefreshStatus::LOGO : RefreshStatus::WAIT;
|
||||
mRefreshState = RefreshStatus::WAIT;
|
||||
}
|
||||
break;
|
||||
|
||||
|
|
|
@ -58,7 +58,6 @@ class DisplayEPaper {
|
|||
const char* _version;
|
||||
RefreshStatus mRefreshState, mNextRefreshState;
|
||||
uint8_t mSecondCnt;
|
||||
bool mFirst = true;
|
||||
};
|
||||
|
||||
#endif // ESP32
|
||||
|
|
|
@ -156,12 +156,14 @@ 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);
|
||||
|
||||
if(isSunrise)
|
||||
mSendIvData.resetYieldDay();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void notAvailChanged(bool allNotAvail) {
|
||||
if(!allNotAvail)
|
||||
mSendIvData.resetYieldDay();
|
||||
}
|
||||
|
||||
bool tickerComm(bool disabled) {
|
||||
if (!mClient.connected())
|
||||
return false;
|
||||
|
|
|
@ -30,11 +30,11 @@ class PubMqttIvData {
|
|||
|
||||
mRTRDataHasBeenSent = false;
|
||||
|
||||
mTable[IDLE] = &PubMqttIvData::stateIdle;
|
||||
mTable[START] = &PubMqttIvData::stateStart;
|
||||
mTable[FIND_NXT_IV] = &PubMqttIvData::stateFindNxtIv;
|
||||
mTable[SEND_DATA] = &PubMqttIvData::stateSend;
|
||||
mTable[SEND_TOTALS] = &PubMqttIvData::stateSendTotals;
|
||||
mTable[IDLE] = &PubMqttIvData::stateIdle;
|
||||
mTable[START] = &PubMqttIvData::stateStart;
|
||||
mTable[FIND_NXT_IV] = &PubMqttIvData::stateFindNxtIv;
|
||||
mTable[SEND_DATA] = &PubMqttIvData::stateSend;
|
||||
mTable[SEND_TOTALS] = &PubMqttIvData::stateSendTotals;
|
||||
}
|
||||
|
||||
void loop() {
|
||||
|
|
|
@ -689,13 +689,13 @@ class RestApi {
|
|||
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_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_data")] = (mConfig->plugin.display.type == DISP_TYPE_T0_NONE) ? DEF_PIN_OFF : 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_dc")] = (mConfig->plugin.display.type < DISP_TYPE_T3_PCD8544_84X48) ? DEF_PIN_OFF : 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_bsy")] = (mConfig->plugin.display.type < DISP_TYPE_T10_EPAPER) ? DEF_PIN_OFF : mConfig->plugin.display.disp_busy;
|
||||
obj[F("pir_pin")] = mConfig->plugin.display.pirPin;
|
||||
obj[F("disp_clk")] = mConfig->plugin.display.disp_clk;
|
||||
obj[F("disp_data")] = mConfig->plugin.display.disp_data;
|
||||
obj[F("disp_cs")] = mConfig->plugin.display.disp_cs;
|
||||
obj[F("disp_dc")] = mConfig->plugin.display.disp_dc;
|
||||
obj[F("disp_rst")] = mConfig->plugin.display.disp_reset;
|
||||
obj[F("disp_bsy")] = mConfig->plugin.display.disp_busy;
|
||||
obj[F("pir_pin")] = mConfig->plugin.display.pirPin;
|
||||
}
|
||||
|
||||
void getMqttInfo(JsonObject obj) {
|
||||
|
|
|
@ -1071,7 +1071,7 @@
|
|||
{
|
||||
"token": "WARN_DIFF_ENV",
|
||||
"en": "your environment does not match the update file!",
|
||||
"de": "Die ausgewählte Firmware passt uU. nicht zum Chipsatz!"
|
||||
"de": "Die ausgewählte Firmware passt u.U. nicht zum Chipsatz!"
|
||||
},
|
||||
{
|
||||
"token": "CONTIUE",
|
||||
|
|
|
@ -601,23 +601,23 @@ class Web {
|
|||
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.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.type == DISP_TYPE_T2_SH1106_128X64) ||
|
||||
(mConfig->plugin.display.type == DISP_TYPE_T4_SSD1306_128X32) ||
|
||||
(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.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_T3_PCD8544_84X48) ||
|
||||
(mConfig->plugin.display.type == DISP_TYPE_T6_SSD1309_128X64)) ? request->arg("disp_graph_ratio").toInt() : 0;
|
||||
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_T4_SSD1306_128X32)
|
||||
|| (mConfig->plugin.display.type == DISP_TYPE_T5_SSD1306_64X48)
|
||||
|| (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.type == DISP_TYPE_T2_SH1106_128X64)
|
||||
|| (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;
|
||||
|
||||
// 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_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.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.type != DISP_TYPE_T10_EPAPER) ? DEF_PIN_OFF : request->arg("disp_dc").toInt();
|
||||
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.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.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.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…
Add table
Add a link
Reference in a new issue