Using wrong wttr field for temperature
All checks were successful
Compile / Compile (push) Successful in 1m24s

This commit is contained in:
leblane 2023-06-03 14:52:42 +03:00
parent fb289071e1
commit 5664ee4acd

View file

@ -187,8 +187,8 @@ void WatchFacePages::Weather::DrawPage(bool partialRefresh)
m_display.setCursor(190 - w, 142);
m_display.print(temperature.str().c_str());
// Hacky degree symbol
m_display.fillCircle(190 - 23, 129, 3, GxEPD_BLACK);
m_display.fillCircle(190 - 23, 129, 1, GxEPD_WHITE);
m_display.fillCircle(190 - 19, 129, 3, GxEPD_BLACK);
m_display.fillCircle(190 - 19, 129, 1, GxEPD_WHITE);
// Wind speed
m_display.drawBitmap(165, 145, Icons::Weather::wind, 30, 30, GxEPD_BLACK);
@ -279,6 +279,8 @@ void WatchFacePages::Weather::Resync()
// Grr. wttr.in does a redirect to HTTPS if your agent isn't curl
client.setUserAgent("curl/8.0.1");
Serial.println(url.str().c_str());
client.begin(url.str().c_str());
int httpCode = client.GET();
m_features.wifi.Disconnect();
@ -310,7 +312,8 @@ void WatchFacePages::Weather::Resync()
memcpy(m_currentWeatherCondition, parts[0].c_str(), parts[0].length());
m_currentWeatherCondition[parts[0].length()] = '\0';
std::string temperature = parts[2].substr(0, parts[2].length() - 2);
std::string temperature = parts[1].substr(1, parts[1].length() - 4);
Serial.println(temperature.c_str());
m_currentTemperature = std::stoi(temperature);
std::string humidity = parts[2].substr(0, parts[2].length() - 1);