Skip to content

Commit f1e5c91

Browse files
committed
Fix a couple of UI issues
Fixes #139
1 parent 722b618 commit f1e5c91

File tree

1 file changed

+19
-19
lines changed

1 file changed

+19
-19
lines changed

esp8266-weather-station-color.ino

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -494,13 +494,9 @@ void drawCurrentWeatherDetail() {
494494
gfx.setColor(MINI_WHITE);
495495
gfx.drawString(120, 2, "Current Conditions");
496496

497-
String degreeSign = "°F";
498-
if (IS_METRIC) {
499-
degreeSign = "°C";
500-
}
501497
// String weatherIcon;
502498
// String weatherText;
503-
drawLabelValue(0, "Temperature:", currentWeather.temp + degreeSign);
499+
drawLabelValue(0, "Temperature:", String(currentWeather.temp, 1) + (IS_METRIC ? "°C" : "°F"));
504500
drawLabelValue(1, "Wind Speed:", String(currentWeather.windSpeed, 1) + (IS_METRIC ? "m/s" : "mph") );
505501
drawLabelValue(2, "Wind Dir:", String(currentWeather.windDeg, 1) + "°");
506502
drawLabelValue(3, "Humidity:", String(currentWeather.humidity) + "%");
@@ -557,6 +553,10 @@ void drawForecastTable(uint8_t start) {
557553
if (IS_METRIC) {
558554
degreeSign = "°C";
559555
}
556+
int firstColumnLabelX = 50;
557+
int firstColumnValueX = 70;
558+
int secondColumnLabelX = 130;
559+
int secondColumnValueX = 170;
560560
for (uint8_t i = start; i < start + 4; i++) {
561561
gfx.setTextAlignment(TEXT_ALIGN_LEFT);
562562
y = 45 + (i - start) * 75;
@@ -570,42 +570,42 @@ void drawForecastTable(uint8_t start) {
570570
gfx.drawString(120, y - 15, WDAY_NAMES[timeinfo->tm_wday] + " " + String(timeinfo->tm_hour) + ":00");
571571

572572

573-
gfx.drawPalettedBitmapFromPgm(0, 15 + y, getMiniMeteoconIconFromProgmem(forecasts[i].icon));
573+
gfx.drawPalettedBitmapFromPgm(0, 5 + y, getMiniMeteoconIconFromProgmem(forecasts[i].icon));
574574
gfx.setTextAlignment(TEXT_ALIGN_LEFT);
575575
gfx.setColor(MINI_YELLOW);
576576
gfx.setFont(ArialRoundedMTBold_14);
577-
gfx.drawString(10, y, forecasts[i].main);
577+
gfx.drawString(0, y - 8, forecasts[i].main);
578578
gfx.setTextAlignment(TEXT_ALIGN_LEFT);
579579

580580
gfx.setColor(MINI_BLUE);
581-
gfx.drawString(50, y, "T:");
581+
gfx.drawString(firstColumnLabelX, y, "T:");
582582
gfx.setColor(MINI_WHITE);
583-
gfx.drawString(70, y, String(forecasts[i].temp, 0) + degreeSign);
583+
gfx.drawString(firstColumnValueX, y, String(forecasts[i].temp, 0) + degreeSign);
584584

585585
gfx.setColor(MINI_BLUE);
586-
gfx.drawString(50, y + 15, "H:");
586+
gfx.drawString(firstColumnLabelX, y + 15, "H:");
587587
gfx.setColor(MINI_WHITE);
588-
gfx.drawString(70, y + 15, String(forecasts[i].humidity) + "%");
588+
gfx.drawString(firstColumnValueX, y + 15, String(forecasts[i].humidity) + "%");
589589

590590
gfx.setColor(MINI_BLUE);
591-
gfx.drawString(50, y + 30, "P: ");
591+
gfx.drawString(firstColumnLabelX, y + 30, "P: ");
592592
gfx.setColor(MINI_WHITE);
593-
gfx.drawString(70, y + 30, String(forecasts[i].rain, 2) + (IS_METRIC ? "mm" : "in"));
593+
gfx.drawString(firstColumnValueX, y + 30, String(forecasts[i].rain, 2) + (IS_METRIC ? "mm" : "in"));
594594

595595
gfx.setColor(MINI_BLUE);
596-
gfx.drawString(130, y, "Pr:");
596+
gfx.drawString(secondColumnLabelX, y, "Pr:");
597597
gfx.setColor(MINI_WHITE);
598-
gfx.drawString(170, y, String(forecasts[i].pressure, 0) + "hPa");
598+
gfx.drawString(secondColumnValueX, y, String(forecasts[i].pressure, 0) + "hPa");
599599

600600
gfx.setColor(MINI_BLUE);
601-
gfx.drawString(130, y + 15, "WSp:");
601+
gfx.drawString(secondColumnLabelX, y + 15, "WSp:");
602602
gfx.setColor(MINI_WHITE);
603-
gfx.drawString(170, y + 15, String(forecasts[i].windSpeed, 0) + (IS_METRIC ? "m/s" : "mph") );
603+
gfx.drawString(secondColumnValueX, y + 15, String(forecasts[i].windSpeed, 0) + (IS_METRIC ? "m/s" : "mph") );
604604

605605
gfx.setColor(MINI_BLUE);
606-
gfx.drawString(130, y + 30, "WDi: ");
606+
gfx.drawString(secondColumnLabelX, y + 30, "WDi: ");
607607
gfx.setColor(MINI_WHITE);
608-
gfx.drawString(170, y + 30, String(forecasts[i].windDeg, 0) + "°");
608+
gfx.drawString(secondColumnValueX, y + 30, String(forecasts[i].windDeg, 0) + "°");
609609
}
610610
}
611611

0 commit comments

Comments
 (0)