diff --git a/src/CHANGES.md b/src/CHANGES.md index d566216a..2032f009 100644 --- a/src/CHANGES.md +++ b/src/CHANGES.md @@ -1,5 +1,8 @@ # Development Changes +## 0.8.57 - 2024-01-15 +* merge PR: fix immediate clearing of display after sunset #1364 + ## 0.8.56 - 2024-01-15 * potential fix of update problems and random reboots #1359 #1354 diff --git a/src/defines.h b/src/defines.h index 46c9a249..528aa714 100644 --- a/src/defines.h +++ b/src/defines.h @@ -13,7 +13,7 @@ //------------------------------------- #define VERSION_MAJOR 0 #define VERSION_MINOR 8 -#define VERSION_PATCH 56 +#define VERSION_PATCH 57 //------------------------------------- typedef struct { diff --git a/src/plugins/Display/Display_Mono.h b/src/plugins/Display/Display_Mono.h index e0a03c61..58b4224f 100644 --- a/src/plugins/Display/Display_Mono.h +++ b/src/plugins/Display/Display_Mono.h @@ -116,12 +116,16 @@ class DisplayMono { if (nullptr == mPgData) // power graph not initialized return; + bool storeStartEndTimes = false; bool store_entry = false; switch(mPgState) { case PowerGraphState::NO_TIME_SYNC: - if ((mDisplayData->pGraphStartTime > 0) && (mDisplayData->pGraphEndTime > 0) && // wait until period data is available ... - (mDisplayData->utcTs >= mDisplayData->pGraphStartTime) && (mDisplayData->utcTs < mDisplayData->pGraphEndTime)) { // and current time is in period - storeStartEndTimes(); // period was received -> store + if ((mDisplayData->pGraphStartTime > 0) + && (mDisplayData->pGraphEndTime > 0) // wait until period data is available ... + && (mDisplayData->utcTs >= mDisplayData->pGraphStartTime) + && (mDisplayData->utcTs < mDisplayData->pGraphEndTime)) // and current time is in period + { + storeStartEndTimes = true; // period was received -> store store_entry = true; mPgState = PowerGraphState::IN_PERIOD; } @@ -134,7 +138,7 @@ class DisplayMono { break; case PowerGraphState::WAIT_4_NEW_PERIOD: if ((mPgStartTime != mDisplayData->pGraphStartTime) || (mPgEndTime != mDisplayData->pGraphEndTime)) { // wait until new time period was received ... - storeStartEndTimes(); // and store it for next period + storeStartEndTimes = true; // and store it for next period mPgState = PowerGraphState::WAIT_4_RESTART; } break; @@ -146,6 +150,14 @@ class DisplayMono { } break; } + + // store start and end times of current time period and calculate period length + if (storeStartEndTimes) { + mPgStartTime = mDisplayData->pGraphStartTime; + mPgEndTime = mDisplayData->pGraphEndTime; + mPgPeriod = mDisplayData->pGraphEndTime - mDisplayData->pGraphStartTime; // time period of power graph in sec for scaling of x-axis + } + if (store_entry) { mPgLastPos = std::min((uint8_t) sss2PgPos(mDisplayData->utcTs - mPgStartTime), (uint8_t) (mPgWidth - 1)); // current datapoint based on seconds since start mPgData[mPgLastPos] = std::max(mPgData[mPgLastPos], val); // update current datapoint to maximum of all seen values @@ -237,13 +249,6 @@ class DisplayMono { } } - // store start and end times of current time period and calculate period length - void storeStartEndTimes() { - mPgStartTime = mDisplayData->pGraphStartTime; - mPgEndTime = mDisplayData->pGraphEndTime; - mPgPeriod = mDisplayData->pGraphEndTime - mDisplayData->pGraphStartTime; // time period of power graph in sec for scaling of x-axis - } - // get power graph datapoint index, scaled to current time period, by seconds since start uint8_t sss2PgPos(uint seconds_since_start) { if(mPgPeriod)