step count reset and temperature display bug

reset step count at midnight, and fix bug with temperature from 10 to 19 overlapping the unit on display
pull/61/head
Tomas Ekeli 2021-06-16 23:17:58 +02:00 committed by GitHub
parent aabb888069
commit 381d08d818
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 11 additions and 2 deletions

View File

@ -64,6 +64,10 @@ void Watchy7SEG::drawDate(){
display.println(currentTime.Year + YEAR_OFFSET);// offset from 1970, since year is stored in uint8_t
}
void Watchy7SEG::drawSteps(){
// reset step counter at midnight
if (currentTime.Hour == 0 && currentTime.Minute == 0){
sensor.resetStepCounter();
}
uint32_t stepCount = sensor.getCounter();
display.drawBitmap(10, 165, steps, 19, 23, DARKMODE ? GxEPD_WHITE : GxEPD_BLACK);
display.setCursor(35, 190);
@ -103,7 +107,12 @@ void Watchy7SEG::drawWeather(){
int16_t x1, y1;
uint16_t w, h;
display.getTextBounds(String(temperature), 100, 150, &x1, &y1, &w, &h);
display.setCursor(155 - w, 150);
if (temperature >= 10 && temperature < 20) {
display.setCursor(135 - w, 150);
}
else {
display.setCursor(155 - w, 150);
}
display.println(temperature);
display.drawBitmap(165, 110, strcmp(TEMP_UNIT, "metric") == 0 ? celsius : fahrenheit, 26, 20, DARKMODE ? GxEPD_WHITE : GxEPD_BLACK);
const unsigned char* weatherIcon;
@ -128,4 +137,4 @@ void Watchy7SEG::drawWeather(){
}else
return;
display.drawBitmap(145, 158, weatherIcon, WEATHER_ICON_WIDTH, WEATHER_ICON_HEIGHT, DARKMODE ? GxEPD_WHITE : GxEPD_BLACK);
}
}