mPgPeriod=mDisplayData->pGraphEndTime-mDisplayData->pGraphStartTime;// length of power graph for scaling of x-axis
uint32_toldTimeOfDay=mPgTimeOfDay;
mPgTimeOfDay=(mDisplayData->utcTs>mDisplayData->pGraphStartTime)?mDisplayData->utcTs-mDisplayData->pGraphStartTime:0;// current time of day with respect to current sunrise time
if(oldTimeOfDay>mPgTimeOfDay)// new day -> reset old data
resetPowerGraph();
if(0==mPgPeriod)
mPgPeriod=1;
mPgLastPos=std::min((uint8_t)(mPgTimeOfDay*(mPgWidth-1)/mPgPeriod),(uint8_t)(mPgWidth-1));// current datapoint based on currenct time of day
}
voidaddPowerGraphEntry(floatval){
if((nullptr!=mPgData)&&(mDisplayData->utcTs>0)){// precondition: power graph initialized and utc time available
calcPowerGraphValues();
@ -192,18 +122,6 @@ class DisplayMono {
}
}
uint8_tgetPowerGraphXpos(uint8_tp){
if((p<=mPgLastPos)&&(mPgLastPos>0))
return((p*(mPgWidth-1))/mPgLastPos);// scaling of x-axis
return0;
}
uint8_tgetPowerGraphYpos(uint8_tp){
if((p<mPgWidth)&&(mPgMaxPwr>0))
return((mPgData[p]*(uint32_t)mPgHeight/mPgMaxPwr));// scaling of data to graph height
return0;
}
voidplotPowerGraph(uint8_txoff,uint8_tyoff){
if(nullptr==mPgData)// power graph not initialized
mPgPeriod=mDisplayData->pGraphEndTime-mDisplayData->pGraphStartTime;// length of power graph for scaling of x-axis
uint32_toldTimeOfDay=mPgTimeOfDay;
mPgTimeOfDay=(mDisplayData->utcTs>mDisplayData->pGraphStartTime)?mDisplayData->utcTs-mDisplayData->pGraphStartTime:0;// current time of day with respect to current sunrise time
if(oldTimeOfDay>mPgTimeOfDay)// new day -> reset old data
resetPowerGraph();
if(0==mPgPeriod)
mPgPeriod=1;
mPgLastPos=std::min((uint8_t)(mPgTimeOfDay*(mPgWidth-1)/mPgPeriod),(uint8_t)(mPgWidth-1));// current datapoint based on currenct time of day
}
uint8_tgetPowerGraphXpos(uint8_tp){
if((p<=mPgLastPos)&&(mPgLastPos>0))
return((p*(mPgWidth-1))/mPgLastPos);// scaling of x-axis
return0;
}
uint8_tgetPowerGraphYpos(uint8_tp){
if((p<mPgWidth)&&(mPgMaxPwr>0))
return((mPgData[p]*(uint32_t)mPgHeight/mPgMaxPwr));// scaling of data to graph height