|
@@ -45,8 +45,8 @@ void drawDayProgressBar(int y, int padding, uint16_t color) {
|
|
|
display.setTextColor(GxEPD_RED);
|
|
|
for (int i = 0; i < numberOfBlocksToRender; i++) {
|
|
|
int barHeight = 8;
|
|
|
- if (i == int(totalNumberOfBlocks * 0.25) || i == int(totalNumberOfBlocks * 0.5) || i == int(totalNumberOfBlocks * 0.75)){
|
|
|
- barHeight= 12;
|
|
|
+ if (i == int(totalNumberOfBlocks * 0.25) || i == int(totalNumberOfBlocks * 0.5) || i == int(totalNumberOfBlocks * 0.75)) {
|
|
|
+ barHeight = 12;
|
|
|
}
|
|
|
display.fillRect(padding + (i * (progressBarBlockSize * 2)), y + 5, progressBarBlockSize, barHeight, GxEPD_BLACK);
|
|
|
}
|
|
@@ -125,21 +125,22 @@ void drawCalender(int y) {
|
|
|
//Offset the y downward by 1.5 line height
|
|
|
y += int(gridHeight * 1.5);
|
|
|
|
|
|
+ //Get the number of days in previous month
|
|
|
+ int previousMonthID = ptm->tm_mon;
|
|
|
+ if (previousMonthID == 0) {
|
|
|
+ //loop back to last year Dec
|
|
|
+ previousMonthID = 11;
|
|
|
+ } else {
|
|
|
+ previousMonthID = previousMonthID - 1;
|
|
|
+ }
|
|
|
+ int dayInPrevMonth = getNumberOfDayByMonth(previousMonthID);
|
|
|
+ int nextMonthDayCounter = 1;
|
|
|
+
|
|
|
//Render the calender dates
|
|
|
display.setFont(&FreeSans12pt7b);
|
|
|
int cx, cy, tcx, tcy;
|
|
|
for (int dy = 0; dy < 6; dy++) {
|
|
|
for (int dx = 0; dx < 7; dx++) {
|
|
|
- if (dayCounter > dayInMonth) {
|
|
|
- //End of this month
|
|
|
- break;
|
|
|
- }
|
|
|
- if (dayCounter <= 0) {
|
|
|
- //Shifting in first day of month
|
|
|
- dayCounter++;
|
|
|
- continue;
|
|
|
- }
|
|
|
-
|
|
|
//Get the center of the grid
|
|
|
cx = dx * gridWidth + horizontalPadding + int(float(gridWidth) / 2.0);
|
|
|
cy = y + dy * gridHeight + verticalPadding - int(float(gridHeight) / 2.0);
|
|
@@ -149,7 +150,36 @@ void drawCalender(int y) {
|
|
|
tcx = cx - (tbw / 2.0);
|
|
|
tcy = cy + (tbh / 2.0);
|
|
|
|
|
|
- //Draw the text to screen
|
|
|
+ //Check for special case
|
|
|
+ if (dayCounter > dayInMonth) {
|
|
|
+ //End of this month
|
|
|
+ if (SHOW_PREVIOUS_NEXT_MONTH_DAYS) {
|
|
|
+ //Show next months days in another colors
|
|
|
+ display.setTextColor(GxEPD_RED);
|
|
|
+ display.setCursor(tcx, tcy);
|
|
|
+ display.print(String(nextMonthDayCounter));
|
|
|
+ display.setTextColor(GxEPD_BLACK);
|
|
|
+ nextMonthDayCounter++;
|
|
|
+ continue;
|
|
|
+ } else {
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (dayCounter <= 0) {
|
|
|
+ //Shifting in first day of month
|
|
|
+ if (SHOW_PREVIOUS_NEXT_MONTH_DAYS) {
|
|
|
+ //Show previous months days in another colors
|
|
|
+ display.setTextColor(GxEPD_RED);
|
|
|
+ display.setCursor(tcx, tcy);
|
|
|
+ display.print(String(dayInPrevMonth + dayCounter));
|
|
|
+ display.setTextColor(GxEPD_BLACK);
|
|
|
+ }
|
|
|
+
|
|
|
+ dayCounter++;
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+
|
|
|
+ //Draw the date to screen
|
|
|
if (dayCounter == ptm->tm_mday) {
|
|
|
//Today
|
|
|
//display.fillRoundRect(dx * gridWidth + horizontalPadding, y + dy * gridHeight + verticalPadding - gridHeight, gridWidth, gridHeight, 3, GxEPD_RED);
|