mirror of https://github.com/sqfmi/Watchy.git
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 displaypull/61/head
parent
aabb888069
commit
381d08d818
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue