mirror of
https://github.com/thooge/esp32-nmea2000-obp60.git
synced 2026-08-18 18:32:30 +02:00
Fix for display flicker by display refresh
This commit is contained in:
@@ -826,6 +826,7 @@ void OBP60Task(GwApi *api){
|
|||||||
if(millis() > starttime3 + pagetime){
|
if(millis() > starttime3 + pagetime){
|
||||||
LOG_DEBUG(GwLog::DEBUG,"Page with refreshtime=%d", pagetime);
|
LOG_DEBUG(GwLog::DEBUG,"Page with refreshtime=%d", pagetime);
|
||||||
starttime3 = millis();
|
starttime3 = millis();
|
||||||
|
bool pageChanged = (lastPage != pageNumber);
|
||||||
|
|
||||||
//refresh data from api
|
//refresh data from api
|
||||||
api->getBoatDataValues(boatValues.numValues,boatValues.allBoatValues);
|
api->getBoatDataValues(boatValues.numValues,boatValues.allBoatValues);
|
||||||
@@ -841,6 +842,10 @@ void OBP60Task(GwApi *api){
|
|||||||
// getdisplay().fillRect(0, 0, getdisplay().width(), getdisplay().height(), commonData.bgcolor);
|
// getdisplay().fillRect(0, 0, getdisplay().width(), getdisplay().height(), commonData.bgcolor);
|
||||||
#ifndef DISPLAY_ST7796
|
#ifndef DISPLAY_ST7796
|
||||||
getdisplay().fillScreen(commonData.bgcolor); // Clear display
|
getdisplay().fillScreen(commonData.bgcolor); // Clear display
|
||||||
|
#else
|
||||||
|
if (pageChanged) {
|
||||||
|
getdisplay().fillScreen(commonData.bgcolor); // Clear display after page switch
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Show header if enabled
|
// Show header if enabled
|
||||||
@@ -873,7 +878,7 @@ void OBP60Task(GwApi *api){
|
|||||||
displayNextPage(); // Partial update (fast)
|
displayNextPage(); // Partial update (fast)
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
if (lastPage != pageNumber){
|
if (pageChanged){
|
||||||
if (lastPage != -1){ // skip cleanup if we are during startup, and no page has been displayed yet.
|
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
|
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
|
if (hasFRAM) fram.write(FRAM_PAGE_NO, pageNumber); // remember new page for device restart
|
||||||
|
|||||||
Reference in New Issue
Block a user