Skip to content

Commit

Permalink
#8 Add also a switch for display.width() to support small displays
Browse files Browse the repository at this point in the history
  • Loading branch information
martinberlin committed Jul 15, 2020
1 parent 7729b9a commit b421b21
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions main/demo-sleep-clock.cpp
Expand Up @@ -56,7 +56,7 @@ int sleepMinutes = 4;
// At what time your CLOCK will get in Sync with the internet time?
// Clock syncs with internet time in this two SyncHours. Leave it on -1 to avoid internet Sync (Leave at least one set otherwise it will never get synchronized)
uint8_t syncHour1 = 6; // IMPORTANT: Leave it on 0 for the first run!
uint8_t syncHour2 = 12; // Same here, 2nd request to Sync hour
uint8_t syncHour2 = 13; // Same here, 2nd request to Sync hour
uint8_t syncHourDate = 11; // The date request will be done at this hour, only once a day
// This microsCorrection represents the program time and will be discounted from deepsleep
// Fine correction: Handle with care since this will be corrected on each sleepMinutes period
Expand All @@ -66,6 +66,7 @@ int64_t microsCorrection = -300000; // 0.3 predicted boot time
9:02 -> textColor
*/
bool supportsPartialUpdate = true; // If updateWindow does not work good for your display model turns this to false
uint16_t backgroundColor = EPD_WHITE;
uint16_t textColor = EPD_BLACK;
// Adafruit GFX Font selection - - - - - -
Expand Down Expand Up @@ -216,9 +217,12 @@ void updateClock() {
/* partial update x y width height */
case 1:
printf("HH:MM updateWindow(%d, %d, %d, %d)\n",x,y,w,h);

display.updateWindow(x, y, w, h, true);
//display.update(); // If updateWindow does not work good for your display model use this and comment the other
if (supportsPartialUpdate) {
display.updateWindow(x, y, w, h, true);
} else {
display.update();
}
//
// Let's do a faster refresh using awesome updateWindow method (Thanks Jean-Marc for awesome example in GxEPD)
// Note this x,y,width,height coordinates represent the bounding box where the update takes place:
break;
Expand Down

0 comments on commit b421b21

Please sign in to comment.