start a new diagram each day
This commit is contained in:
parent
efb38cc423
commit
da10f4cfba
@ -19,7 +19,6 @@ public:
|
||||
private:
|
||||
void averageLoop();
|
||||
void dataPointLoop();
|
||||
void resetDataPoints();
|
||||
|
||||
uint32_t getSecondsPerDot();
|
||||
|
||||
@ -35,4 +34,5 @@ private:
|
||||
float _iRunningAverage = 0;
|
||||
uint16_t _iRunningAverageCnt = 0;
|
||||
uint32_t _daySeconds = 0;
|
||||
bool wasNight = false;
|
||||
};
|
||||
|
||||
@ -31,7 +31,15 @@ void DisplayGraphicDiagramClass::averageLoop()
|
||||
const float currentWatts = Datastore.getTotalAcPowerEnabled(); // get the current AC production
|
||||
_iRunningAverage += currentWatts;
|
||||
_iRunningAverageCnt++;
|
||||
if(SunPosition.dayPeriodLength() == 0) { // noch keine Uhrzeit oder ein neuer tag
|
||||
if(SunPosition.isDayPeriod()) {
|
||||
if(wasNight) { //neuer tag
|
||||
_graphValuesCount = 0;
|
||||
wasNight = false;
|
||||
}
|
||||
} else {
|
||||
wasNight = true;
|
||||
}
|
||||
if(SunPosition.dayPeriodLength() == 0) { // noch keine Uhrzeit
|
||||
_graphValuesCount = 0;
|
||||
} else {
|
||||
if(SunPosition.dayPeriodLength() != _daySeconds) { // neue Tageslänge
|
||||
@ -56,11 +64,6 @@ void DisplayGraphicDiagramClass::dataPointLoop()
|
||||
}
|
||||
}
|
||||
|
||||
void DisplayGraphicDiagramClass::resetDataPoints()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
uint32_t DisplayGraphicDiagramClass::getSecondsPerDot()
|
||||
{
|
||||
return SunPosition.dayPeriodLength() / _chartWidth;
|
||||
@ -111,7 +114,7 @@ void DisplayGraphicDiagramClass::redraw(uint8_t screenSaverOffsetX, uint8_t xPos
|
||||
}
|
||||
else {
|
||||
float wattsToday = Datastore.getTotalAcYieldDayEnabled();
|
||||
char * text = new char[10]();
|
||||
char text[5];
|
||||
if (wattsToday > 999) {
|
||||
snprintf(text, 10, "%.0fkWh" , wattsToday / 1000);
|
||||
} else {
|
||||
@ -139,7 +142,7 @@ void DisplayGraphicDiagramClass::redraw(uint8_t screenSaverOffsetX, uint8_t xPos
|
||||
}
|
||||
|
||||
_display->drawLine(
|
||||
graphPosX + i / scaleFactorX, horizontal_line_y - std::max<int16_t>(0, _graphValues[i] / scaleFactorY - 0.5),
|
||||
graphPosX + i / scaleFactorX, horizontal_line_y - std::max<int16_t>(0, _graphValues[i] / scaleFactorY),
|
||||
graphPosX + i / scaleFactorX, horizontal_line_y);
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user