From 381d08d81856264757e8e663bb271a15a2b8bd4e Mon Sep 17 00:00:00 2001 From: Tomas Ekeli Date: Wed, 16 Jun 2021 23:17:58 +0200 Subject: [PATCH] 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 --- examples/WatchFaces/7_SEG/Watchy_7_SEG.cpp | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/examples/WatchFaces/7_SEG/Watchy_7_SEG.cpp b/examples/WatchFaces/7_SEG/Watchy_7_SEG.cpp index 7ce9207..e9dd089 100644 --- a/examples/WatchFaces/7_SEG/Watchy_7_SEG.cpp +++ b/examples/WatchFaces/7_SEG/Watchy_7_SEG.cpp @@ -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); -} \ No newline at end of file +}