@@ -27,7 +27,7 @@ SOFTWARE.
2727
2828#include " Settings.h"
2929
30- #define VERSION " 2.3 "
30+ #define VERSION " 2.4 "
3131
3232#define HOSTNAME " CLOCK-"
3333#define CONFIG " /conf.txt"
@@ -69,7 +69,7 @@ boolean displayOn = true;
6969boolean timeOffsetFetched = false ;
7070
7171// GeoNames
72- GeoNamesClient geoNames (GEONAMES_USER, " " , " " );
72+ GeoNamesClient geoNames (GEONAMES_USER, " " , " " , IS_DST );
7373
7474// News Client
7575NewsApiClient newsClient (NEWS_API_KEY, NEWS_SOURCE);
@@ -107,7 +107,8 @@ String CHANGE_FORM1 = "<form class='w3-container' action='/locations' method='ge
107107 " <p><input name='showcondition' class='w3-check w3-margin-top' type='checkbox' %CONDITION_CHECKED%> Display Weather Condition</p>"
108108 " <p><input name='showhumidity' class='w3-check w3-margin-top' type='checkbox' %HUMIDITY_CHECKED%> Display Humidity</p>"
109109 " <p><input name='showwind' class='w3-check w3-margin-top' type='checkbox' %WIND_CHECKED%> Display Wind</p>"
110- " <p><input name='is24hour' class='w3-check w3-margin-top' type='checkbox' %IS_24HOUR_CHECKED%> Use 24 Hour Clock (military time)</p>" ;
110+ " <p><input name='is24hour' class='w3-check w3-margin-top' type='checkbox' %IS_24HOUR_CHECKED%> Use 24 Hour Clock (military time)</p>"
111+ " <p><input name='isDST' class='w3-check w3-margin-top' type='checkbox' %IS_DST_CHECKED%> Use DST (Daylight Savings Time)</p>" ;
111112
112113String CHANGE_FORM2 = " <p><input name='displayadvice' class='w3-check w3-margin-top' type='checkbox' %ADVICECHECKED%> Display Advice</p>"
113114 " <p><label>Marquee Message (up to 60 chars)</label><input class='w3-input w3-border w3-margin-bottom' type='text' name='marqueeMsg' value='%MSG%' maxlength='60'></p>"
@@ -308,7 +309,7 @@ void loop() {
308309
309310 if (timeClient.getHours () == " 00" && timeClient.getMinutes () == " 00" && timeClient.getSeconds () == " 00" ) {
310311 // Exactly Midnight -- fetch a new geoNames for updating the Date and time offset
311- geoNames.updateClient (GEONAMES_USER, weatherClient.getLat (0 ), weatherClient.getLon (0 ));
312+ geoNames.updateClient (GEONAMES_USER, weatherClient.getLat (0 ), weatherClient.getLon (0 ), IS_DST );
312313 UtcOffset = geoNames.getTimeOffset ();
313314 }
314315
@@ -343,6 +344,7 @@ void loop() {
343344 msg += " " ;
344345
345346 if (SHOW_DATE) {
347+ msg += weatherClient.getWeekDay (0 , UtcOffset) + " , " ;
346348 msg += geoNames.getMonthName () + " " + geoNames.getDay (false ) + " " ;
347349 }
348350 if (SHOW_CITY) {
@@ -489,6 +491,7 @@ void handleLocations() {
489491 CityIDs[0 ] = server.arg (" city1" ).toInt ();
490492 ADVICE_ENABLED = server.hasArg (" displayadvice" );
491493 IS_24HOUR = server.hasArg (" is24hour" );
494+ IS_DST = server.hasArg (" isDST" );
492495 SHOW_DATE = server.hasArg (" showdate" );
493496 SHOW_CITY = server.hasArg (" showcity" );
494497 SHOW_CONDITION = server.hasArg (" showcondition" );
@@ -744,6 +747,11 @@ void handleConfigure() {
744747 is24hourChecked = " checked='checked'" ;
745748 }
746749 form.replace (" %IS_24HOUR_CHECKED%" , is24hourChecked);
750+ String isDstChecked = " " ;
751+ if (IS_DST) {
752+ isDstChecked = " checked='checked'" ;
753+ }
754+ form.replace (" %IS_DST_CHECKED%" , isDstChecked);
747755 String checked = " " ;
748756 if (IS_METRIC) {
749757 checked = " checked='checked'" ;
@@ -849,7 +857,7 @@ void getWeatherData() //client function to send/receive GET request data.
849857 // we need to get offsets
850858 centerPrint (" ...." );
851859 timeOffsetFetched = true ;
852- geoNames.updateClient (GEONAMES_USER, weatherClient.getLat (0 ), weatherClient.getLon (0 ));
860+ geoNames.updateClient (GEONAMES_USER, weatherClient.getLat (0 ), weatherClient.getLon (0 ), IS_DST );
853861 UtcOffset = geoNames.getTimeOffset ();
854862 timeClient.setUtcOffset (UtcOffset);
855863 }
@@ -979,7 +987,7 @@ void displayWeatherData() {
979987 }
980988
981989 timeClient.setUtcOffset (getTimeOffset ());
982- String time = geoNames.getMonthName () + " " + geoNames.getDay (false ) + " , " + timeClient.getAmPmFormattedTime ();
990+ String time = weatherClient. getWeekDay ( 0 , UtcOffset) + " , " + geoNames.getMonthName () + " " + geoNames.getDay (false ) + " , " + timeClient.getAmPmFormattedTime ();
983991
984992 Serial.println (weatherClient.getCity (0 ));
985993 Serial.println (weatherClient.getCondition (0 ));
@@ -1071,7 +1079,7 @@ float getTimeOffset() {
10711079 // we need to get offsets
10721080 timeOffsetFetched = true ;
10731081
1074- geoNames.updateClient (GEONAMES_USER, weatherClient.getLat (0 ), weatherClient.getLon (0 ));
1082+ geoNames.updateClient (GEONAMES_USER, weatherClient.getLat (0 ), weatherClient.getLon (0 ), IS_DST );
10751083 UtcOffset = geoNames.getTimeOffset ();
10761084
10771085 return UtcOffset;
@@ -1218,6 +1226,7 @@ String writeCityIds() {
12181226 f.println (" newsApiKey=" + NEWS_API_KEY);
12191227 f.println (" isAdvice=" + String (ADVICE_ENABLED));
12201228 f.println (" is24hour=" + String (IS_24HOUR));
1229+ f.println (" isDST=" + String (IS_DST));
12211230 f.println (" wideclockformat=" + Wide_Clock_Style);
12221231 f.println (" isMetric=" + String (IS_METRIC));
12231232 f.println (" refreshRate=" + String (minutesBetweenDataRefresh));
@@ -1283,6 +1292,10 @@ void readCityIds() {
12831292 IS_24HOUR = line.substring (line.lastIndexOf (" is24hour=" ) + 9 ).toInt ();
12841293 Serial.println (" IS_24HOUR=" + String (IS_24HOUR));
12851294 }
1295+ if (line.indexOf (" isDST=" ) >= 0 ) {
1296+ IS_DST = line.substring (line.lastIndexOf (" isDST=" ) + 6 ).toInt ();
1297+ Serial.println (" IS_DST=" + String (IS_DST));
1298+ }
12861299 if (line.indexOf (" wideclockformat=" ) >= 0 ) {
12871300 Wide_Clock_Style = line.substring (line.lastIndexOf (" wideclockformat=" ) + 16 );
12881301 Wide_Clock_Style.trim ();
0 commit comments