Browse Source

0.8.57

* merge PR: fix immediate clearing of display after sunset #1364
pull/1367/head
lumapu 1 year ago
parent
commit
1ac920d52d
  1. 3
      src/CHANGES.md
  2. 2
      src/defines.h
  3. 27
      src/plugins/Display/Display_Mono.h

3
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

2
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 {

27
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)

Loading…
Cancel
Save