diff --git a/lib/obp60task/PageWhite.cpp b/lib/obp60task/PageWhite.cpp index a2b6737f..e40a3aca 100644 --- a/lib/obp60task/PageWhite.cpp +++ b/lib/obp60task/PageWhite.cpp @@ -13,6 +13,7 @@ char mode = 'W'; // display mode (W)hite | (L)ogo | (M)FD logo PageWhite(CommonData &common){ commonData = &common; common.logger->logDebug(GwLog::LOG,"Instantiate PageWhite"); + refreshtime = 15000; } virtual int handleKey(int key) { @@ -53,7 +54,11 @@ char mode = 'W'; // display mode (W)hite | (L)ogo | (M)FD logo int bgcolor = GxEPD_WHITE; // Set display in partial refresh mode - getdisplay().setPartialWindow(0, 0, getdisplay().width(), getdisplay().height()); // Set partial update + if (mode == 'W') { + getdisplay().setFullWindow(); + } else { + getdisplay().setPartialWindow(0, 0, getdisplay().width(), getdisplay().height()); // Set partial update + } if (mode == 'L') { getdisplay().drawBitmap(0, 0, gImage_Logo_OBP_400x300_sw, getdisplay().width(), getdisplay().height(), commonData->fgcolor); @@ -62,7 +67,10 @@ char mode = 'W'; // display mode (W)hite | (L)ogo | (M)FD logo } // Update display - getdisplay().nextPage(); // Partial update (fast) + getdisplay().nextPage(); + if (mode == 'W') { + getdisplay().hibernate(); + } }; }; diff --git a/lib/obp60task/Pagedata.h b/lib/obp60task/Pagedata.h index cc4c45b8..b385b5cf 100644 --- a/lib/obp60task/Pagedata.h +++ b/lib/obp60task/Pagedata.h @@ -100,6 +100,7 @@ class Page{ protected: CommonData *commonData; public: + int refreshtime = 1000; virtual void displayPage(PageData &pageData)=0; virtual void displayNew(PageData &pageData){} virtual void setupKeys() { diff --git a/lib/obp60task/obp60task.cpp b/lib/obp60task/obp60task.cpp index 662942e3..e56aaaff 100644 --- a/lib/obp60task/obp60task.cpp +++ b/lib/obp60task/obp60task.cpp @@ -550,8 +550,10 @@ void OBP60Task(GwApi *api){ //#################################################################################### bool systemPage = false; + Page *currentPage; while (true){ delay(100); // Delay 100ms (loop time) + bool keypressed = false; // Undervoltage detection if(uvoltage == true){ @@ -593,8 +595,8 @@ void OBP60Task(GwApi *api){ int keyboardMessage=0; while (xQueueReceive(allParameters.queue,&keyboardMessage,0)){ LOG_DEBUG(GwLog::LOG,"new key from keyboard %d",keyboardMessage); + keypressed = true; - Page *currentPage; if (keyboardMessage == 12) { LOG_DEBUG(GwLog::LOG, "Calling system page"); systemPage = true; // System page is out of band @@ -725,9 +727,17 @@ void OBP60Task(GwApi *api){ } } - // Refresh display data all 1s - if(millis() > starttime3 + 1000){ + // Refresh display data, default all 1s + currentPage = pages[pageNumber].page; + int pagetime = 1000; + if ((lastPage == pageNumber) and (!keypressed)) { + // same page we use page defined time + pagetime = currentPage->refreshtime; + } + if(millis() > starttime3 + pagetime){ + LOG_DEBUG(GwLog::DEBUG,"Page with refreshtime=%d", pagetime); starttime3 = millis(); + //refresh data from api api->getBoatDataValues(boatValues.numValues,boatValues.allBoatValues); api->getStatus(commonData.status); @@ -749,7 +759,6 @@ void OBP60Task(GwApi *api){ syspage->displayPage(sysparams); } else { - Page *currentPage = pages[pageNumber].page; if (currentPage == NULL){ LOG_DEBUG(GwLog::ERROR,"page number %d not found", pageNumber); // Error handling for missing page