|
|
@ -64,18 +64,23 @@ class DisplayMono { |
|
|
|
return(monoMaintainDispSwitchState()); |
|
|
|
} |
|
|
|
|
|
|
|
protected: |
|
|
|
enum class DispSwitchState { |
|
|
|
TEXT, |
|
|
|
GRAPH |
|
|
|
}; |
|
|
|
|
|
|
|
protected: |
|
|
|
U8G2* mDisplay; |
|
|
|
DisplayData *mDisplayData; |
|
|
|
|
|
|
|
float *mPgData=nullptr; |
|
|
|
uint8_t mPgWidth=0; |
|
|
|
uint8_t mPgHeight=0; |
|
|
|
float mPgMaxPwr=0.0; |
|
|
|
// float mPgMaxAvailPower = 0.0;
|
|
|
|
uint32_t mPgPeriod=0; // seconds
|
|
|
|
uint32_t mPgTimeOfDay=0; |
|
|
|
uint8_t mPgLastPos=0; |
|
|
|
float *mPgData = nullptr; |
|
|
|
uint8_t mPgWidth = 0; |
|
|
|
uint8_t mPgHeight = 0; |
|
|
|
float mPgMaxPwr = 0.0; |
|
|
|
uint32_t mPgPeriod = 0; // seconds
|
|
|
|
uint32_t mPgTimeOfDay = 0; |
|
|
|
uint8_t mPgLastPos = 0; |
|
|
|
|
|
|
|
uint8_t mType; |
|
|
|
uint16_t mDispWidth; |
|
|
@ -95,15 +100,10 @@ class DisplayMono { |
|
|
|
int8_t mPixelshift=0; |
|
|
|
TimeMonitor mDisplayTime = TimeMonitor(1000 * DISP_DEFAULT_TIMEOUT, true); |
|
|
|
TimeMonitor mDispSwitchTime = TimeMonitor(); |
|
|
|
uint8_t mDispSwitchState; |
|
|
|
DispSwitchState mDispSwitchState = DispSwitchState::TEXT; |
|
|
|
bool mDisplayActive = true; // always start with display on
|
|
|
|
char mFmtText[DISP_FMT_TEXT_LEN]; |
|
|
|
|
|
|
|
enum _dispSwitchState { |
|
|
|
d_POWER_TEXT = 0, |
|
|
|
d_POWER_GRAPH = 1, |
|
|
|
}; |
|
|
|
|
|
|
|
// Common initialization function to be called by subclasses
|
|
|
|
void monoInit(U8G2* display, uint8_t type, DisplayData *displayData) { |
|
|
|
mDisplay = display; |
|
|
@ -116,9 +116,8 @@ class DisplayMono { |
|
|
|
mDispWidth = mDisplay->getDisplayWidth(); |
|
|
|
mDispHeight = mDisplay->getDisplayHeight(); |
|
|
|
mDispSwitchTime.stopTimeMonitor(); |
|
|
|
mDispSwitchState = d_POWER_TEXT; |
|
|
|
if (mGraphRatio == 100) // if graph ratio is 100% start in graph mode
|
|
|
|
mDispSwitchState = d_POWER_GRAPH; |
|
|
|
mDispSwitchState = DispSwitchState::GRAPH; |
|
|
|
else if (mGraphRatio != 0) |
|
|
|
mDispSwitchTime.startTimeMonitor(150 * (100 - mGraphRatio)); // start display mode change only if ratio is neither 0 nor 100
|
|
|
|
} |
|
|
@ -126,16 +125,16 @@ class DisplayMono { |
|
|
|
bool monoMaintainDispSwitchState(void) { |
|
|
|
bool change = false; |
|
|
|
switch(mDispSwitchState) { |
|
|
|
case d_POWER_TEXT: |
|
|
|
case DispSwitchState::TEXT: |
|
|
|
if (mDispSwitchTime.isTimeout()) { |
|
|
|
mDispSwitchState = d_POWER_GRAPH; |
|
|
|
mDispSwitchState = DispSwitchState::GRAPH; |
|
|
|
mDispSwitchTime.startTimeMonitor(150 * mGraphRatio); // mGraphRatio: 0-100 Gesamtperiode 15000 ms
|
|
|
|
change = true; |
|
|
|
} |
|
|
|
break; |
|
|
|
case d_POWER_GRAPH: |
|
|
|
case DispSwitchState::GRAPH: |
|
|
|
if (mDispSwitchTime.isTimeout()) { |
|
|
|
mDispSwitchState = d_POWER_TEXT; |
|
|
|
mDispSwitchState = DispSwitchState::TEXT; |
|
|
|
mDispSwitchTime.startTimeMonitor(150 * (100 - mGraphRatio)); |
|
|
|
change = true; |
|
|
|
} |
|
|
|