diff --git a/lib/obp60task/obp60task.cpp b/lib/obp60task/obp60task.cpp index 7e1a631..c5f20fa 100644 --- a/lib/obp60task/obp60task.cpp +++ b/lib/obp60task/obp60task.cpp @@ -826,6 +826,7 @@ void OBP60Task(GwApi *api){ if(millis() > starttime3 + pagetime){ LOG_DEBUG(GwLog::DEBUG,"Page with refreshtime=%d", pagetime); starttime3 = millis(); + bool pageChanged = (lastPage != pageNumber); //refresh data from api api->getBoatDataValues(boatValues.numValues,boatValues.allBoatValues); @@ -841,6 +842,10 @@ void OBP60Task(GwApi *api){ // getdisplay().fillRect(0, 0, getdisplay().width(), getdisplay().height(), commonData.bgcolor); #ifndef DISPLAY_ST7796 getdisplay().fillScreen(commonData.bgcolor); // Clear display + #else + if (pageChanged) { + getdisplay().fillScreen(commonData.bgcolor); // Clear display after page switch + } #endif // Show header if enabled @@ -873,7 +878,7 @@ void OBP60Task(GwApi *api){ displayNextPage(); // Partial update (fast) } else{ - if (lastPage != pageNumber){ + if (pageChanged){ if (lastPage != -1){ // skip cleanup if we are during startup, and no page has been displayed yet. pages[lastPage].page->leavePage(pages[lastPage].parameters); // call page cleanup code if (hasFRAM) fram.write(FRAM_PAGE_NO, pageNumber); // remember new page for device restart