Skip to content

Commit 3e6aa1e

Browse files
committed
OpenWeatherMapClient Ctor is now parameterless, as it should. Cleanup commented out code.
Neither of the previous arguments are meaningfull at object construction.
1 parent 0399385 commit 3e6aa1e

File tree

3 files changed

+4
-39
lines changed

3 files changed

+4
-39
lines changed

marquee/OpenWeatherMapClient.cpp

Lines changed: 2 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,11 @@
1515
#include "TimeStr.h"
1616
#include "Translations.h"
1717

18-
OpenWeatherMapClient::OpenWeatherMapClient(const String &ApiKey, bool isMetric) {
18+
OpenWeatherMapClient::OpenWeatherMapClient() {
1919
myGeoLocation = "";
2020
myGeoLocation_CityID = 0;
2121
myGeoLocationType = LOC_UNSET;
22-
myApiKey = ApiKey;
23-
//this->isMetric = isMetric; // Deprecated!
24-
(void)isMetric; // suppress unused parameter warning
22+
myApiKey = "";
2523
dataGetRetryCount = 0;
2624
weather.isValid = false;
2725
}
@@ -144,8 +142,6 @@ void OpenWeatherMapClient::updateWeather() {
144142
}
145143
apiGetData += F("&units=metric&lang=");
146144
apiGetData += myLanguage;
147-
//apiGetData += F("&units=");
148-
//apiGetData += String((isMetric) ? F("metric") : F("imperial"));
149145
apiGetData += F("&APPID=");
150146
apiGetData += myApiKey + F(" HTTP/1.1");
151147
Serial.println(F("Getting Weather Data"));
@@ -276,30 +272,6 @@ void OpenWeatherMapClient::updateWeather() {
276272
#endif
277273
}
278274

279-
/* deprecated; shall be language specific
280-
String OpenWeatherMapClient::getWindDirectionText() {
281-
//int val = floor((weather.windDirection / 22.5) + 0.5);
282-
//int val = int((weather.windDirection*16 + 180) / 360) % 16;
283-
// N, NNE, NE, ENE, E, ESE, SE, SSE, S, SSW, SW, WSW, W, WNW, NW, NNW ;
284-
//String arr[] = {"N", "NNE", "NE", "ENE", "E", "ESE", "SE", "SSE", "S", "SSW", "SW", "WSW", "W", "WNW", "NW", "NNW"};
285-
//return arr[(val % 16)];
286-
return getWindDirectionString(weather.windDirection);
287-
}*/
288-
289-
/* deprecated; shall be language specific
290-
String OpenWeatherMapClient::getWeekDay() {
291-
String rtnValue = "";
292-
long timestamp = weather.reportTimestamp;
293-
long day = 0;
294-
if (timestamp != 0) {
295-
// Add timezone from OWM
296-
timestamp += weather.timeZone;
297-
day = ((timestamp / 86400) + 4) % 7;
298-
rtnValue = getDayName(day);
299-
}
300-
return rtnValue;
301-
}*/
302-
303275
String OpenWeatherMapClient::getWeatherIcon() {
304276
// match weather condition codes to OLED icon in the weatherstation font
305277
// see https://openweathermap.org/weather-conditions

marquee/OpenWeatherMapClient.h

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -84,19 +84,17 @@ class OpenWeatherMapClient {
8484
bool isValid; // Weather report is valid
8585
} weather;
8686

87-
//bool isMetric; // Weather request format Metric or Imperial
8887
const int dataGetRetryCountError = 10; // Amount of data get timeouts until we invalidate all data
8988
int dataGetRetryCount;
9089
String errorMsg; // Weather request error message
9190

9291

9392
public:
94-
OpenWeatherMapClient(const String &ApiKey, bool isMetric);
93+
OpenWeatherMapClient();
9594
int setGeoLocation(const String &location);
9695
int setLanguage(const String &languageCode); // set language for weather description (en, fr, de, ...)
9796
void updateWeather();
9897
inline void setWeatherApiKey(const String &ApiKey) {myApiKey = ApiKey;};
99-
inline void setMetric(bool isMetric) {};//{this->isMetric = isMetric;}; // DEPRECATED!
10098

10199
inline float getLat() {return weather.lat;};
102100
inline float getLon() {return weather.lon;};
@@ -127,8 +125,6 @@ class OpenWeatherMapClient {
127125
inline int getTimeZoneSeconds() {return weather.timeZone;};
128126
inline uint32_t getSunRise() {return weather.sunRise;};
129127
inline uint32_t getSunSet() {return weather.sunSet;};
130-
//String getWeekDay(); // deprecated
131-
//String getWindDirectionText(); //deprecated
132128
String getWeatherIcon();
133129

134130
float convTemperature(float temp_celcius, temperatureUnits_t tu);
@@ -138,5 +134,3 @@ class OpenWeatherMapClient {
138134
};
139135

140136
extern String EncodeUrlSpecialChars(const char *msg);
141-
extern String getWindDirectionString(int windDirectionDegrees);
142-
//extern String getTranslationStr(int msg_id);

marquee/marquee.ino

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ enum loopState_e loopState, lastState;
151151
#define SCHEDULE_INTERVAL_START(_var,_delay) {_var=millis()-(_delay);}
152152

153153
// Weather Client
154-
OpenWeatherMapClient weatherClient(owmApiKey, true);
154+
OpenWeatherMapClient weatherClient;
155155

156156
#if COMPILE_MQTT
157157
// Mqtt Client
@@ -2025,7 +2025,6 @@ void readConfiguration() {
20252025
Serial.println(F("ReadConfigFile EOF"));
20262026
matrix.setIntensity(displayIntensity);
20272027
weatherClient.setWeatherApiKey(owmApiKey);
2028-
//weatherClient.setMetric(isMetric);
20292028
weatherClient.setGeoLocation(geoLocation);
20302029
#if COMPILE_MQTT
20312030
mqttClient.updateMqttClient(MqttServer, MqttPort, MqttTopic, MqttAuthUser, MqttAuthPass);

0 commit comments

Comments
 (0)