diff --git a/lib/obp60task/OBP60Hardware.h b/lib/obp60task/OBP60Hardware.h index ace84d2..5219ded 100644 --- a/lib/obp60task/OBP60Hardware.h +++ b/lib/obp60task/OBP60Hardware.h @@ -38,7 +38,6 @@ #define OBP_SPI_CLK 38 #define OBP_SPI_DIN 48 #define SHOW_TIME 6000 // Show time in [ms] for logo and WiFi QR code - #define FAST_FULL_UPDATE false// Enable fast full update for e-paper display GDEY042T81 #define FULL_REFRESH_TIME 600 // Refresh cycle time in [s][600...3600] for full display update (very important healcy function) #define MAX_PAGE_NUMBER 10 // Max number of pages for show data #define FONT1 "Ubuntu_Bold8pt7b" diff --git a/lib/obp60task/config.json b/lib/obp60task/config.json index 099d230..af4a141 100644 --- a/lib/obp60task/config.json +++ b/lib/obp60task/config.json @@ -650,7 +650,32 @@ "label": "Refresh", "type": "boolean", "default": "true", - "description": "Refresh E-Ink display after each new page request to reduce ghost effects [on|off]", + "description": "Refresh e-paper display after each new page request to reduce ghost effects [on|off]", + "category": "OBP60 Display", + "capabilities": { + "obp60":"true" + } + }, + { + "name": "fastRefresh", + "label": "Fast Refresh", + "type": "boolean", + "default": "true", + "description": "Fast refresh for e-paper display [on|off]", + "category": "OBP60 Display", + "capabilities": { + "obp60":"true" + } + }, + { + "name": "fullRefreshTime", + "label": "Full Refresh Time [min]", + "type": "number", + "default": "10", + "check": "checkMinMax", + "min": 1, + "max": 10, + "description": "E-Paper full refresh time all [1...10 min]", "category": "OBP60 Display", "capabilities": { "obp60":"true" diff --git a/lib/obp60task/obp60task.cpp b/lib/obp60task/obp60task.cpp index 363b9a3..66ef3bc 100644 --- a/lib/obp60task/obp60task.cpp +++ b/lib/obp60task/obp60task.cpp @@ -47,8 +47,11 @@ void OBP60Init(GwApi *api){ // Init hardware hardwareInit(); + // Settings for e-paper display + String fastrefresh = api->getConfig()->getConfigItem(api->getConfig()->fastRefresh,true)->asString(); + api->getLogger()->logDebug(GwLog::DEBUG,"Fast Refresh Mode is: %s", fastrefresh); #ifdef DISPLAY_GDEY042T81 - if(FAST_FULL_UPDATE == true){ + if(fastrefresh == "On"){ static const bool useFastFullUpdate = true; // Enable fast full display update only for GDEY042T81 } #endif @@ -296,6 +299,8 @@ void OBP60Task(GwApi *api){ String systemname = api->getConfig()->getConfigItem(api->getConfig()->systemName,true)->asString(); String wifipass = api->getConfig()->getConfigItem(api->getConfig()->apPassword,true)->asString(); bool refreshmode = api->getConfig()->getConfigItem(api->getConfig()->refresh,true)->asBoolean(); + String fastrefresh = api->getConfig()->getConfigItem(api->getConfig()->fastRefresh,true)->asString(); + uint fullrefreshtime = uint(api->getConfig()->getConfigItem(api->getConfig()->fullRefreshTime,true)->asInt()); int textcolor = GxEPD_BLACK; int pixelcolor = GxEPD_BLACK; int bgcolor = GxEPD_WHITE; @@ -542,7 +547,7 @@ void OBP60Task(GwApi *api){ starttime1 = millis(); starttime2 = millis(); getdisplay().setFullWindow(); // Set full update - if(FAST_FULL_UPDATE == false){ + if(fastrefresh == "Off"){ getdisplay().fillScreen(pixelcolor);// Clear display getdisplay().nextPage(); // Full update getdisplay().fillScreen(bgcolor); // Clear display @@ -558,7 +563,7 @@ void OBP60Task(GwApi *api){ starttime2 = millis(); LOG_DEBUG(GwLog::DEBUG,"E-Ink full refresh first 5 min"); getdisplay().setFullWindow(); // Set full update - if(FAST_FULL_UPDATE == false){ + if(fastrefresh == "Off"){ getdisplay().fillScreen(pixelcolor);// Clear display getdisplay().nextPage(); // Full update getdisplay().fillScreen(bgcolor); // Clear display @@ -567,12 +572,11 @@ void OBP60Task(GwApi *api){ } // Subtask E-Ink full refresh - //if(millis() > starttime2 + FULL_REFRESH_TIME * 1000){ - if(millis() > starttime2 + 1 * 60 * 1000){ + if(millis() > starttime2 + fullrefreshtime * 60 * 1000){ starttime2 = millis(); LOG_DEBUG(GwLog::DEBUG,"E-Ink full refresh"); getdisplay().setFullWindow(); // Set full update - if(FAST_FULL_UPDATE == false){ + if(fastrefresh == "Off"){ getdisplay().fillScreen(pixelcolor);// Clear display getdisplay().nextPage(); // Full update getdisplay().fillScreen(bgcolor); // Clear display