Merge pull request #67 from schodet/fix-temperature-position

Fix temperature position, closes #52
pull/61/head^2
SQFMI 2021-08-05 20:22:27 -04:00 committed by GitHub
commit c34e8812d4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 8 additions and 2 deletions

View File

@ -102,8 +102,14 @@ void Watchy7SEG::drawWeather(){
display.setFont(&DSEG7_Classic_Regular_39);
int16_t x1, y1;
uint16_t w, h;
display.getTextBounds(String(temperature), 100, 150, &x1, &y1, &w, &h);
display.setCursor(155 - w, 150);
display.getTextBounds(String(temperature), 0, 0, &x1, &y1, &w, &h);
if(159 - w - x1 > 87){
display.setCursor(159 - w - x1, 150);
}else{
display.setFont(&DSEG7_Classic_Bold_25);
display.getTextBounds(String(temperature), 0, 0, &x1, &y1, &w, &h);
display.setCursor(159 - w - x1, 136);
}
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;