Skip to content

Commit

Permalink
Merge pull request G6EJD#169 from skiphansen/fix_forecast_timezone_adj
Browse files Browse the repository at this point in the history
Revert WxConditions[0].Timezone -> WxForecast[index].Timezone, it wasn't wrong.
  • Loading branch information
G6EJD authored Dec 11, 2021
2 parents 081decb + ad775d4 commit 3523156
Show file tree
Hide file tree
Showing 8 changed files with 12 additions and 12 deletions.
6 changes: 3 additions & 3 deletions Waveshare_2_9_v4.ino
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ void DisplayWeather() { // 2.9" e-paper display is 296x128 resolutio
String MidTime = "09:00" + String((Units == "M" ? "" : "a"));
String FinishTime = "10:00" + String((Units == "M" ? "" : "a"));
do {
String Ftime = ConvertUnixTime(WxForecast[Forecast].Dt + WxForecast[Forecast].Timezone).substring(0, (Units == "M" ? 5 : 6));
String Ftime = ConvertUnixTime(WxForecast[Forecast].Dt + WxConditions[0].Timezone).substring(0, (Units == "M" ? 5 : 6));
if (Ftime == StartTime || Ftime == MidTime || Ftime == FinishTime) {
DisplayForecastWeather(18, 104, Forecast, Dposition, 57); // x,y coordinates, forecast number, position, spacing width
Dposition++;
Expand Down Expand Up @@ -392,8 +392,8 @@ void GetHighsandLows() {
String StartTime = "08:00" + String((Units == "M" ? "" : "a"));
String FinishTime = "10:00" + String((Units == "M" ? "" : "a"));
for (int r = 0; r < max_readings; r++) {
if (ConvertUnixTime(WxForecast[r].Dt + WxForecast[r].Timezone).substring(0, (Units == "M" ? 5 : 6)) >= StartTime && ConvertUnixTime(WxForecast[r].Dt + WxForecast[r].Timezone).substring(0, (Units == "M" ? 5 : 6)) <= FinishTime) { // found first period in day
HLReadings[Day].Time = ConvertUnixTime(WxForecast[r].Dt + WxForecast[r].Timezone).substring(0, (Units == "M" ? 5 : 6));
if (ConvertUnixTime(WxForecast[r].Dt + WxConditions[0].Timezone).substring(0, (Units == "M" ? 5 : 6)) >= StartTime && ConvertUnixTime(WxForecast[r].Dt + WxForecast[r].Timezone).substring(0, (Units == "M" ? 5 : 6)) <= FinishTime) { // found first period in day
HLReadings[Day].Time = ConvertUnixTime(WxForecast[r].Dt + WxConditions[0].Timezone).substring(0, (Units == "M" ? 5 : 6));
for (int InDay = 0; InDay < 8; InDay++) { // 00:00 to 21:00 is 8 readings
if (r + InDay < max_readings) {
if (WxForecast[r + InDay].High > HLReadings[Day].High) {
Expand Down
2 changes: 1 addition & 1 deletion examples/M5_CoreInk/M5_CoreInk.ino
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ void DisplayForecastWeather(int x, int y, int offset, int index) {
display.drawRect(x, y, offset, 65, GxEPD_BLACK);
display.drawLine(x, y + 13, x + offset, y + 13, GxEPD_BLACK);
DisplayWxIcon(x + offset / 2 + 1, y + 35, WxForecast[index].Icon, SmallIcon);
drawString(x + offset / 2, y + 3, String(ConvertUnixTime(WxForecast[index].Dt + WxForecast[index].Timezone).substring(0,5)), CENTER);
drawString(x + offset / 2, y + 3, String(ConvertUnixTime(WxForecast[index].Dt + WxConditions[0].Timezone).substring(0,5)), CENTER);
drawString(x + offset / 2, y + 50, String(WxForecast[index].High, 0) + "/" + String(WxForecast[index].Low, 0), CENTER);
}
//#########################################################################################
Expand Down
2 changes: 1 addition & 1 deletion examples/Waveshare_1_54/Waveshare_1_54.ino
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ void DisplayForecastWeather(int x, int y, int offset, int index) {
display.drawRect(x, y, offset, 65, GxEPD_BLACK);
display.drawLine(x, y + 13, x + offset, y + 13, GxEPD_BLACK);
DisplayWxIcon(x + offset / 2 + 1, y + 35, WxForecast[index].Icon, SmallIcon);
drawString(x + offset / 2, y + 3, String(ConvertUnixTime(WxForecast[index].Dt + WxForecast[index].Timezone).substring(0,5)), CENTER);
drawString(x + offset / 2, y + 3, String(ConvertUnixTime(WxForecast[index].Dt + WxConditions[0].Timezone).substring(0,5)), CENTER);
drawString(x + offset / 2, y + 50, String(WxForecast[index].High, 0) + "/" + String(WxForecast[index].Low, 0), CENTER);
}
//#########################################################################################
Expand Down
6 changes: 3 additions & 3 deletions examples/Waveshare_2_9/Waveshare_2_9_v4.ino
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ void DisplayWeather() { // 2.9" e-paper display is 296x128 resolutio
String MidTime = "09:00" + String((Units == "M" ? "" : "a"));
String FinishTime = "10:00" + String((Units == "M" ? "" : "a"));
do {
String Ftime = ConvertUnixTime(WxForecast[Forecast].Dt + WxForecast[Forecast].Timezone).substring(0, (Units == "M" ? 5 : 6));
String Ftime = ConvertUnixTime(WxForecast[Forecast].Dt + WxConditions[0].Timezone).substring(0, (Units == "M" ? 5 : 6));
if (Ftime == StartTime || Ftime == MidTime || Ftime == FinishTime) {
DisplayForecastWeather(18, 104, Forecast, Dposition, 57); // x,y coordinates, forecast number, position, spacing width
Dposition++;
Expand Down Expand Up @@ -392,8 +392,8 @@ void GetHighsandLows() {
String StartTime = "08:00" + String((Units == "M" ? "" : "a"));
String FinishTime = "10:00" + String((Units == "M" ? "" : "a"));
for (int r = 0; r < max_readings; r++) {
if (ConvertUnixTime(WxForecast[r].Dt + WxForecast[r].Timezone).substring(0, (Units == "M" ? 5 : 6)) >= StartTime && ConvertUnixTime(WxForecast[r].Dt + WxForecast[r].Timezone).substring(0, (Units == "M" ? 5 : 6)) <= FinishTime) { // found first period in day
HLReadings[Day].Time = ConvertUnixTime(WxForecast[r].Dt + WxForecast[r].Timezone).substring(0, (Units == "M" ? 5 : 6));
if (ConvertUnixTime(WxForecast[r].Dt + WxConditions[0].Timezone).substring(0, (Units == "M" ? 5 : 6)) >= StartTime && ConvertUnixTime(WxForecast[r].Dt + WxForecast[r].Timezone).substring(0, (Units == "M" ? 5 : 6)) <= FinishTime) { // found first period in day
HLReadings[Day].Time = ConvertUnixTime(WxForecast[r].Dt + WxConditions[0].Timezone).substring(0, (Units == "M" ? 5 : 6));
for (int InDay = 0; InDay < 8; InDay++) { // 00:00 to 21:00 is 8 readings
if (r + InDay < max_readings) {
if (WxForecast[r + InDay].High > HLReadings[Day].High) {
Expand Down
2 changes: 1 addition & 1 deletion examples/Waveshare_4_2/Waveshare_4_2.ino
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ void DrawForecastWeather(int x, int y, int index) {
display.drawRect(x, y, 55, 65, GxEPD_BLACK);
display.drawLine(x + 1, y + 13, x + 54, y + 13, GxEPD_BLACK);
DisplayWXicon(x + 28, y + 35, WxForecast[index].Icon, SmallIcon);
drawString(x + 31, y + 3, String(ConvertUnixTime(WxForecast[index].Dt + WxForecast[index].Timezone).substring(0,5)), CENTER);
drawString(x + 31, y + 3, String(ConvertUnixTime(WxForecast[index].Dt + WxConditions[0].Timezone).substring(0,5)), CENTER);
drawString(x + 41, y + 52, String(WxForecast[index].High, 0) + "° / " + String(WxForecast[index].Low, 0) + "°", CENTER);
}
//#########################################################################################
Expand Down
2 changes: 1 addition & 1 deletion examples/Waveshare_7_5/Waveshare_7_5.ino
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,7 @@ void DisplayForecastWeather(int x, int y, int index) {
display.drawRect(x, y, fwidth - 1, 65, GxEPD_BLACK);
display.drawLine(x, y + 13, x + fwidth - 3, y + 13, GxEPD_BLACK);
DisplayConditionsSection(x + fwidth / 2, y + 35, WxForecast[index].Icon, SmallIcon);
drawString(x + fwidth / 2, y + 3, String(ConvertUnixTime(WxForecast[index].Dt + WxForecast[index].Timezone).substring(0,5)), CENTER);
drawString(x + fwidth / 2, y + 3, String(ConvertUnixTime(WxForecast[index].Dt + WxConditions[0].Timezone).substring(0,5)), CENTER);
drawString(x + fwidth / 2, y + 53, String(WxForecast[index].High, 0) + "°/" + String(WxForecast[index].Low, 0) + "°", CENTER);
}
//#########################################################################################
Expand Down
2 changes: 1 addition & 1 deletion examples/Waveshare_7_5_T7/Waveshare_7_5_T7.ino
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,7 @@ void DisplayForecastWeather(int x, int y, int index) {
display.drawRect(x, y, fwidth - 1, 81, GxEPD_BLACK);
display.drawLine(x, y + 16, x + fwidth - 3, y + 16, GxEPD_BLACK);
DisplayConditionsSection(x + fwidth / 2, y + 43, WxForecast[index].Icon, SmallIcon);
drawString(x + fwidth / 2, y + 4, String(ConvertUnixTime(WxForecast[index].Dt + WxForecast[index].Timezone).substring(0,5)), CENTER);
drawString(x + fwidth / 2, y + 4, String(ConvertUnixTime(WxForecast[index].Dt + WxConditions[0].Timezone).substring(0,5)), CENTER);
drawString(x + fwidth / 2 + 12, y + 66, String(WxForecast[index].High, 0) + "°/" + String(WxForecast[index].Low, 0) + "°", CENTER);
}
//#########################################################################################
Expand Down
2 changes: 1 addition & 1 deletion examples/Waveshare_9_7/Waveshare_9_7.ino
Original file line number Diff line number Diff line change
Expand Up @@ -359,7 +359,7 @@ void DisplayForecastWeather(int x, int y, int index) {
display.drawLine(x, y + 40, x + fwidth - 3, y + 40, GxEPD_BLACK);
DisplayConditionsSection(x + fwidth / 2, y + 90, WxForecast[index].Icon, SmallIcon);
u8g2Fonts.setFont(u8g2_font_helvB14_tf);
drawString(x + fwidth / 2 - 10, y + 20, String(ConvertUnixTime(WxForecast[index].Dt + WxForecast[index].Timezone).substring(0,5)), CENTER);
drawString(x + fwidth / 2 - 10, y + 20, String(ConvertUnixTime(WxForecast[index].Dt + WxConditions[0].Timezone).substring(0,5)), CENTER);
drawString(x + fwidth / 2 + 0, y + 130, String(WxForecast[index].High, 0) + "°/" + String(WxForecast[index].Low, 0) + "°", CENTER);
}
//#########################################################################################
Expand Down

0 comments on commit 3523156

Please sign in to comment.